ANSI integral SUM overflow reports "integer overflow" without Spark's try_add suggestion
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 82/100
Direzione di ricerca
Inizia da native/spark-expr/src/agg_funcs/sum_int.rs e dai tre punti di overflow descritti nell’issue, poi leggi il test esistente ANSI support - SUM function in CometAggregateSuite. Confronta i parametri di errore di Comet con quelli di Spark per i percorsi di overflow sia di update sia di merge. Il lavoro è completato quando i parametri message e alternative corrispondono a quelli di Spark e il test verifica tale confronto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Scala
- Stelle
- 1.3k
- Fork
- 383
- Merge medio
- 2g 4h
- PR unite (30g)
- 419
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/datafusion-comet
-
Iceberg data tables whose names end with a metadata-table name fall back to SparkForse già presa @aryan9948 l’ha presa oggi. Apertarequires-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
apache/datafusion-comet#6719 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Native from_json with a schema that repeats a field name fails with "ArrowArray struct has 2 children (expected 1)"Forse già presa @Samearth17 l’ha presa 1 giorno fa. Apertaarea:expressions area:ffi bug good first issue priority:medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
apache/datafusion-comet#6592 ·
I maintainer di solito rispondono entro 1 giorno
-
Casting to a struct type with repeated field names fails with "ArrowArray struct has 2 children (expected 1)"Forse già presa @Samearth17 l’ha presa 1 giorno fa. Apertaarea:expressions area:ffi bug good first issue priority:high
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
apache/datafusion-comet#6591 ·
I maintainer di solito rispondono entro 1 giorno
-
arrays_zip with two same-named inputs fails with "ArrowArray struct has 2 children (expected 1)"Forse già presa @mohitgurav20 l’ha presa 8 giorni fa. Apertaarea:expressions area:ffi bug priority:high
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/datafusion-comet#6251 · 4 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
ci: a transient Maven Central failure in lint-java is reported as a scalafix violationForse già presa @andygrove l’ha presa 16 giorni fa. Apertaarea:ci bug priority:low
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
apache/datafusion-comet#6060 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di apache/datafusion-comet
Issue simili
-
area/map-site bug layer/core size/S
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
marola-dev/marola-app#60 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
lambdaworks/zio-elasticsearch#863 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
lichess-org/lila#21971 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
com-lihaoyi/mill#7670 ·
I maintainer di solito rispondono entro 1 giorno