ANSI integral SUM overflow reports "integer overflow" without Spark's try_add suggestion
Maintainer thường phản hồi trong vòng 2 ngày
@0lai0 đang làm issue này rồi.
Từ ngày 6/10/2026.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
Hướng nghiên cứu
Bắt đầu với native/spark-expr/src/agg_funcs/sum_int.rs và ba vị trí tràn số được mô tả trong issue, sau đó đọc bài kiểm thử hiện có ANSI support - SUM function trong CometAggregateSuite. So sánh các tham số lỗi của Comet với Spark cho cả đường dẫn tràn số update và merge. Hoàn thành khi các tham số message và alternative khớp với Spark và bài kiểm thử xác minh phép so sánh đó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
Under spark.sql.ansi.enabled=true, an integral SUM overflow in Comet raises ARITHMETIC_OVERFLOW with the message parameter integer overflow and an empty alternative. Spark raises long overflow with the suggestion Use 'try_add' to tolerate overflow and return NULL instead.
Spark's SUM over integral input always returns LONG, and Sum adds through Add(left, right, evalContext) in both its update and merge expressions. So the overflow goes through MathUtils.addExact(Long, Long, context) with the try_add hint, the same on 3.4.3 through 4.2.0. Comet's native/spark-expr/src/agg_funcs/sum_int.rs raises arithmetic_overflow_error("integer") at its three overflow sites: the ungrouped update (which the ungrouped merge reuses), the grouped update, and the grouped merge.
Comet's decision to throw matches Spark. Only the message parameters differ, which matters to code that inspects getMessageParameters() or the message text.
This was part of item 2 in #5071, which also named SumInteger. #6217 assumed the rest of #5071 had been fixed, and #6249 fixes the binary +, - and * kernels but not SUM. Once #6249 removes the #6217 bullet, the compatibility guide no longer lists this divergence.
Steps to reproduce
SET spark.sql.ansi.enabled=true;
CREATE TABLE t (l BIGINT) USING parquet;
INSERT INTO t SELECT CASE WHEN id = 0 THEN 9223372036854775807 ELSE 1 END FROM range(0, 3, 1, 1);
SELECT SUM(l) FROM t;
-- Spark: [ARITHMETIC_OVERFLOW] long overflow. Use 'try_add' to tolerate overflow and return NULL instead. If necessary set "spark.sql.ansi.enabled" to "false" to bypass this error.
-- Comet: [ARITHMETIC_OVERFLOW] integer overflow. If necessary set "spark.sql.ansi.enabled" to "false" to bypass this error.
The final merge diverges the same way when each of two partitions holds part of the overflowing sum.
Expected behavior
The message parameter is long overflow and alternative carries the try_add suggestion, as in Spark.
Additional context
Reproduced locally on Spark 3.4 and 4.1 for both the partial and the merge path. With the function_name field that #6249 adds to SparkError::ArithmeticOverflow, raising ArithmeticOverflow { from_type: "long", function_name: "try_add" } at the three call sites made Comet match Spark's error class, parameters and message on both paths.
The existing ANSI support - SUM function test in CometAggregateSuite only checks that both messages contain ARITHMETIC_OVERFLOW, so it passes either way. It should compare the message parameters with Spark's.
- Ngôn ngữ chính
- Scala
- Star
- 1.3k
- Fork
- 405
- Merge trung bình
- 3 ngày 4 phút
- Pull request đã merge (30 ngày)
- 282
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/datafusion-comet
-
area:ci enhancement priority:low requires-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
apache/datafusion-comet#7319 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
area:ci bug priority:low requires-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/datafusion-comet#7315 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
requires-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
apache/datafusion-comet#7240 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug priority:low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
apache/datafusion-comet#7176 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
docs: update Scala comments that reference the removed iceberg-writes.md pageCó thể đã có người làm @Abhishek-Mohan đã nhận 4 ngày trước. Đang mởenhancement
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 83/100
apache/datafusion-comet#7101 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của apache/datafusion-comet
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
propensive/soundness#2351 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Traffic event delivered/rejected counters appear swapped in TrafficStateController.updateWithReceiptĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
digital-asset/canton#705 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
easy first-contributor first-contributors good first issue help wanted scala up-for-grabs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
fork-commit-merge/fork-commit-merge#8457 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[GC] Empty or non-numeric GC_*_HEAP_SIZE reads out of bounds or uses an uninitialised sizeCó thể đã có người làm @oluies đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
scala-native/scala-native#5177 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
promovolve/promovolve#358 ·
Maintainer thường phản hồi trong vòng 1 ngày