Skip to content

Commit c0715aa

Browse files
committed
sum_ansi_mode_checks_fix_tests
1 parent 31b3ad2 commit c0715aa

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

native/spark-expr/src/agg_funcs/sum_int.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use datafusion::common::{DataFusionError, Result as DFResult, ScalarValue};
2727
use datafusion::logical_expr::function::{AccumulatorArgs, StateFieldsArgs};
2828
use datafusion::logical_expr::Volatility::Immutable;
2929
use datafusion::logical_expr::{
30-
Accumulator, AggregateUDFImpl, EmitTo, GroupsAccumulator, Signature,
30+
Accumulator, AggregateUDFImpl, EmitTo, GroupsAccumulator, ReversedUDAF, Signature,
3131
};
3232
use std::{any::Any, sync::Arc};
3333

@@ -93,6 +93,10 @@ impl AggregateUDFImpl for SumInteger {
9393
) -> DFResult<Box<dyn GroupsAccumulator>> {
9494
Ok(Box::new(SumIntGroupsAccumulator::new(self.eval_mode)))
9595
}
96+
97+
fn reverse_expr(&self) -> ReversedUDAF {
98+
ReversedUDAF::Identical
99+
}
96100
}
97101

98102
#[derive(Debug)]

spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ import org.apache.comet.shims.CometExprShim
6262
*/
6363
object QueryPlanSerde extends Logging with CometExprShim {
6464

65+
val integerTypes = Seq(ByteType, ShortType, IntegerType, LongType)
66+
6567
/**
6668
* Mapping of Spark operator class to Comet operator handler.
6769
*/
@@ -414,7 +416,7 @@ object QueryPlanSerde extends Logging with CometExprShim {
414416
}
415417
case s: Sum =>
416418
if (AggSerde.sumDataTypeSupported(s.dataType) && !s.dataType
417-
.isInstanceOf[DecimalType]) {
419+
.isInstanceOf[DecimalType] && !integerTypes.contains(s.dataType)) {
418420
Some(agg)
419421
} else {
420422
withInfo(windowExpr, s"datatype ${s.dataType} is not supported", expr)

0 commit comments

Comments
 (0)