fix(hive): may get wrong datablocks if not sorted by output schema
@@ -195,7 +195,10 @@ impl HiveTableSource {
let prewhere_datablocks = prewhere_datablocks
.into_iter()
.zip(valids.iter())
- .map(|(datablock, valid)| DataBlock::filter(datablock, valid).unwrap())
+ .map(|(datablock, valid)| {
+ let datablock = DataBlock::filter(datablock, valid).unwrap();
+ datablock.resort(&self.source_schema, &self.output_schema).unwrap()
+ })
.filter(|x| !x.is_empty())
.collect();
@@ -246,7 +249,7 @@ impl HiveTableSource {
.collect::<Vec<_>>();
allblocks
} else {
- prewhere_data.data_blocks
+ return Err(ErrorCode::Internal("It's a bug. No remain reader"));
};
// 3 trans to generate state
