Skip to content

Commit 8b7fb3b

Browse files
committed
Remove unnecessary guard
1 parent a0aa47a commit 8b7fb3b

2 files changed

Lines changed: 1 addition & 8 deletions

File tree

datafusion/functions-aggregate/src/sum.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,6 @@ impl AggregateUDFImpl for Sum {
398398
if lit_type == DataType::Null {
399399
return Ok(None);
400400
}
401-
// Skip the rewrite for interval: it requires `lit * COUNT(arg)`, but
402-
// there is no generic Interval×Int64 multiplication kernel.
403-
if matches!(lit_type, DataType::Interval(_)) {
404-
return Ok(None);
405-
}
406401

407402
// Build up SUM(arg)
408403
let mut sum_agg = agg_function.clone();

datafusion/sqllogictest/test_files/aggregate.slt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6627,9 +6627,7 @@ SELECT sum(DISTINCT v) FROM (VALUES
66276627
----
66286628
3 days
66296629

6630-
# Regression: SUM(col + interval_lit) must NOT be rewritten to
6631-
# SUM(col) + lit * COUNT(col) by simplify_expr_op_literal — there is no
6632-
# Interval×Int64 multiplication kernel. Without the guard, this query fails.
6630+
# SUM(col + interval_lit) — exercises the simplify_expr_op_literal path.
66336631
query ?
66346632
SELECT sum(v + interval '1 day') FROM (VALUES
66356633
(interval '1 day'),

0 commit comments

Comments
 (0)