Native hashing of NullType and ANSI interval values fails with "Unsupported data type in hasher"
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 62/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- data-engineering
Direzione di ricerca
Il ramo che fallisce è il catch-all in create_hashes_internal! in native/spark-expr/src/hash_funcs/utils.rs, e lo stesso kernel è usato anche da native/shuffle/src/partitioners/multi_partition.rs. Inizia riproducendo la query hash(a, null) e leggendo come sono scritti i rami esistenti per i primitivi int e long. Il lavoro è completo quando i valori Null lasciano invariato il seed, Interval(YearMonth) e Duration(Microsecond) producono hash come int e long, e le query della issue corrispondono a Spark.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
The native Murmur3 and xxHash64 hashers have no branch for Arrow Null, Interval(YearMonth) or Duration(Microsecond), the types Comet maps Spark's NullType, YearMonthIntervalType and DayTimeIntervalType to. A value of any of them falls through to the catch-all in create_hashes_internal! and fails the query:
org.apache.comet.CometNativeException: Unsupported data type in hasher: Null.
This issue was likely caused by a bug in DataFusion's code. Please help us to resolve this by filing a bug report in our issue tracker: https://github.com/apache/datafusion/issues
at org.apache.comet.Native.executePlan(Native Method)
at org.apache.comet.CometExecIterator.$anonfun$getNextBatch$2(CometExecIterator.scala:260)
Two Scala gates let these types reach it. hash.scala checks a hash expression's children with QueryPlanSerde.supportedDataType, which accepts NullType at any depth. So with the default configuration, hash(a, null), xxhash64(a, null) and hash(named_struct('x', a, 'n', null)) run natively and fail. For hash(a, null) Spark returns the same value as hash(a). The ANSI interval types are rejected there, so hashing them falls back to Spark.
Native round-robin shuffle places rows by hashing every data column with the same kernel, and the native shuffle's type check accepts NullType and both ANSI interval types as data columns. So with spark.comet.shuffle.native.partitioning.roundrobin.enabled=true, a repartition(n) over a native plan with a column of any of the three types, at any depth, fails with Error inserting batch: Internal error: Unsupported data type in hasher: .... With the config off, which is the default, those shuffles run on JVM columnar shuffle or Spark shuffle and work.
Steps to reproduce
CREATE TABLE t (a INT) USING parquet;
INSERT INTO t SELECT CAST(id AS INT) FROM range(1000);
-- default configuration
SELECT a, hash(a, null) AS h FROM t;
SELECT a, xxhash64(a, null) AS h FROM t;
SELECT a, hash(named_struct('x', a, 'n', null)) AS h FROM t;
-- native round robin
SET spark.comet.shuffle.native.partitioning.roundrobin.enabled=true;
SELECT /*+ REPARTITION(4) */ a, null AS n FROM t;
SELECT /*+ REPARTITION(4) */ a, make_ym_interval(a % 5, 1) AS ym FROM t;
SELECT /*+ REPARTITION(4) */ a, make_dt_interval(a % 5, 1, 2, 3.5) AS dt FROM t;
Every query fails. I reproduced them on c3316fbe39 with the Spark 4.1 profile, and the code involved is unchanged on main at 3a4a159409.
Expected behavior
The queries should return the same results as Spark. Spark's HashExpression leaves the hash unchanged for NullType, hashes YearMonthIntervalType as an int and hashes DayTimeIntervalType as a long. The native side can match that exactly with a no-op arm for Null and the existing primitive int and long paths for Interval(YearMonth) and Duration(Microsecond), which fixes both entry points. With those arms in place, hash.scala could also accept the ANSI interval types, which #5061 lists as falling back today.
Additional context
#5059 was the same failure for Interval(MonthDayNano), fixed in #5135.
- Lingua principale
- Scala
- Stelle
- 1.3k
- Fork
- 391
- Merge medio
- 2g 12h
- PR unite (30g)
- 432
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
-
perf: use extend when buffering partition row indices in the native shuffle writerForse già presa @HarshilMital l’ha presa 1 giorno fa. Apertaarea:shuffle enhancement good first issue performance requires-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/datafusion-comet#7072 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
JVM columnar shuffle panics on a struct column with a NullType fieldForse già presa @jadenfix l’ha presa oggi. Apertaarea:shuffle bug priority:high requires-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
apache/datafusion-comet#7062 ·
I maintainer di solito rispondono entro 1 giorno
-
requires-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
apache/datafusion-comet#7001 ·
I maintainer di solito rispondono entro 1 giorno
-
Extract shared list-array construction from the split_* functions in split.rsForse già presa @arminazimi l’ha presa 3 giorni fa. Apertaarea:expressions enhancement good first issue help wanted requires-triage rust tech debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
apache/datafusion-comet#6983 ·
I maintainer di solito rispondono entro 1 giorno
-
Deduplicate spark_ceil and spark_floor and port floor's decimal boundary tests to ceilForse già presa @med9110 l’ha presa 3 giorni fa. Apertaarea:expressions enhancement help wanted requires-triage rust tech debt
Difficoltà 2/5 Mezza giornata Idoneità per principianti 68/100
apache/datafusion-comet#6974 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di apache/datafusion-comet
Issue simili
-
scope:security type:aquasec
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
AbsaOSS/atum-service#494 ·
-
Send camera_pitch and camera_roll to the AI API so validator crops can be tilt-correctedForse già presa Una pull request collegata a questa issue è aperta o già unita. ApertaAI Auto-validate
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
ProjectSidewalk/SidewalkWebpage#5788 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
A-network C-bug S-ready-for-human
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ergoplatform/ergo#2741 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
scalameta/metals-zed#99 ·
-
area:ops priority:P2 status:idea
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
KD5UJC-XYZ/scarab#112 ·