diff --git a/src/mito2/src/compaction.rs b/src/mito2/src/compaction.rs index dbd1739716..7d4302cb74 100644 --- a/src/mito2/src/compaction.rs +++ b/src/mito2/src/compaction.rs @@ -1006,6 +1006,8 @@ impl CompactionSstReaderBuilder<'_> { /// for compaction. The schema of the [FlatSource] is unified. async fn build_flat_sst_reader(self) -> Result { let scan_input = self.build_scan_input().await?.with_compaction(true); + // Compaction reads/writes flat SST batches (with internal columns), so this must use + // the flat input schema instead of the logical output schema. let schema = scan_input.mapper.input_arrow_schema(scan_input.compaction); let stream = SeqScan::new(scan_input)