Skip to content

Commit

Permalink
Actually fix multiplication/division with null columns
Browse files Browse the repository at this point in the history
  • Loading branch information
cswinter committed Jul 31, 2024
1 parent 1e00038 commit fc541af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/engine/execution/batch_merging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,13 @@ pub fn combine<'a>(
for (&(ileft, aggregator), &(iright, _)) in
batch1.aggregations.iter().zip(batch2.aggregations.iter())
{
let left = left[ileft];
let right = right[iright];
let (left, right) = unify_types(&mut qp, left, right);
let left = null_to_val(&mut qp, left);
let right = null_to_val(&mut qp, right);
let mut left = left[ileft];
let mut right = right[iright];
if (left.tag, right.tag) == (EncodingType::I64, EncodingType::F64) {
left = qp.cast(left, EncodingType::F64);
} else if (left.tag, right.tag) == (EncodingType::F64, EncodingType::I64) {
right = qp.cast(right, EncodingType::F64);
}
let aggregated = qp.merge_aggregate(ops, left, right, aggregator);
aggregates.push((aggregated.any(), aggregator));
}
Expand Down
2 changes: 1 addition & 1 deletion src/engine/operators/type_conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl Cast<of64> for u16 { fn cast(self) -> OrderedFloat<f64> { OrderedFloat::fro

impl Cast<of64> for u32 { fn cast(self) -> OrderedFloat<f64> { OrderedFloat::from(self as f64) } }

impl Cast<of64> for i64 { fn cast(self) -> OrderedFloat<f64> { OrderedFloat::from(self as f64) } }
impl Cast<of64> for i64 { fn cast(self) -> OrderedFloat<f64> { if self == I64_NULL { F64_NULL } else { OrderedFloat::from(self as f64) } } }


impl<'a> Cast<Val<'a>> for u8 { fn cast(self) -> Val<'a> { Val::Integer(self as i64) } }
Expand Down

0 comments on commit fc541af

Please sign in to comment.