Skip to content

Commit 13b7d68

Browse files
committed
sum_ansi_mode_checks_fix_tests_rebase_main
1 parent 008d85d commit 13b7d68

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl SumIntegerAccumulator {
110110
fn new(eval_mode: EvalMode) -> Self {
111111
if eval_mode == EvalMode::Try {
112112
Self {
113-
// Try mode starts with 0 (because if this is init to None we cant say if it is none due to all nulls or due to an overflow
113+
// Try mode starts with 0 (because if this is init to None we cant say if it is none due to all nulls or due to an overflow)
114114
sum: Some(0),
115115
has_all_nulls: true,
116116
eval_mode,
@@ -152,7 +152,7 @@ impl Accumulator for SumIntegerAccumulator {
152152
"integer",
153153
)))
154154
} else {
155-
return Ok(None);
155+
Ok(None)
156156
};
157157
}
158158
};

spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3061,7 +3061,7 @@ class CometExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelper {
30613061
(null.asInstanceOf[java.lang.Long], "b"),
30623062
(null.asInstanceOf[java.lang.Long], "b")),
30633063
"tbl") {
3064-
val res = sql("SELECT _2, sum(_1) FROM tbl group by 1")
3064+
val res = sql("SELECT _2, try_sum(_1) FROM tbl group by 1")
30653065
checkSparkAnswerAndOperator(res)
30663066
assert(res.orderBy(col("_2")).collect() === Array(Row("a", null), Row("b", null)))
30673067
}
@@ -3076,7 +3076,7 @@ class CometExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelper {
30763076
withParquetTable(Seq((Long.MaxValue, 1L), (100L, 1L)), "tbl") {
30773077
val res = sql("SELECT SUM(_1) FROM tbl")
30783078
if (ansiEnabled) {
3079-
checkSparkMaybeThrows(res) match {
3079+
checkSparkAnswerMaybeThrows(res) match {
30803080
case (Some(sparkExc), Some(cometExc)) =>
30813081
assert(sparkExc.getMessage.contains("ARITHMETIC_OVERFLOW"))
30823082
assert(cometExc.getMessage.contains("ARITHMETIC_OVERFLOW"))
@@ -3090,7 +3090,7 @@ class CometExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelper {
30903090
withParquetTable(Seq((Long.MinValue, 1L), (-100L, 1L)), "tbl") {
30913091
val res = sql("SELECT SUM(_1) FROM tbl")
30923092
if (ansiEnabled) {
3093-
checkSparkMaybeThrows(res) match {
3093+
checkSparkAnswerMaybeThrows(res) match {
30943094
case (Some(sparkExc), Some(cometExc)) =>
30953095
assert(sparkExc.getMessage.contains("ARITHMETIC_OVERFLOW"))
30963096
assert(cometExc.getMessage.contains("ARITHMETIC_OVERFLOW"))
@@ -3133,7 +3133,7 @@ class CometExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelper {
31333133
"tbl") {
31343134
val res = sql("SELECT _2, SUM(_1) FROM tbl GROUP BY _2").repartition(2)
31353135
if (ansiEnabled) {
3136-
checkSparkMaybeThrows(res) match {
3136+
checkSparkAnswerMaybeThrows(res) match {
31373137
case (Some(sparkExc), Some(cometExc)) =>
31383138
assert(sparkExc.getMessage.contains("ARITHMETIC_OVERFLOW"))
31393139
assert(cometExc.getMessage.contains("ARITHMETIC_OVERFLOW"))
@@ -3150,7 +3150,7 @@ class CometExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelper {
31503150
"tbl") {
31513151
val res = sql("SELECT _2, SUM(_1) FROM tbl GROUP BY _2")
31523152
if (ansiEnabled) {
3153-
checkSparkMaybeThrows(res) match {
3153+
checkSparkAnswerMaybeThrows(res) match {
31543154
case (Some(sparkExc), Some(cometExc)) =>
31553155
assert(sparkExc.getMessage.contains("ARITHMETIC_OVERFLOW"))
31563156
assert(cometExc.getMessage.contains("ARITHMETIC_OVERFLOW"))

0 commit comments

Comments
 (0)