Native hashing of NullType and ANSI interval values fails with "Unsupported data type in hasher"
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 62/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Área
- data-engineering
Línea de trabajo
La rama que falla es el catch-all de create_hashes_internal! en native/spark-expr/src/hash_funcs/utils.rs, y el mismo kernel lo usa native/shuffle/src/partitioners/multi_partition.rs. Empieza reproduciendo la consulta hash(a, null) y leyendo cómo están escritos los brazos existentes para enteros primitivos int y long. Se considera terminado cuando los valores Null dejan la semilla sin cambios, Interval(YearMonth) y Duration(Microsecond) producen hashes como int y long, y las consultas del issue coinciden con Spark.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Scala
- Estrellas
- 1.3k
- Forks
- 391
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/datafusion-comet
-
enhancement
Dificultad 1/5 1-3 horas Aptitud para principiantes 83/100
apache/datafusion-comet#7101 ·
-
requires-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
apache/datafusion-comet#7001 ·
-
Deduplicate spark_ceil and spark_floor and port floor's decimal boundary tests to ceilQuizá libre de nuevo @med9110 la tomó hace 7 días y no hay ningún pull request abierto. Abiertoarea:expressions enhancement help wanted requires-triage rust tech debt
Dificultad 2/5 Medio día Aptitud para principiantes 68/100
apache/datafusion-comet#6974 · 1 comentario ·
-
Iceberg data tables whose names end with a metadata-table name fall back to SparkQuizá libre de nuevo @aryan9948 la tomó hace 16 días y no hay ningún pull request abierto. Abiertorequires-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
apache/datafusion-comet#6719 · 1 comentario ·
-
Casting to a struct type with repeated field names fails with "ArrowArray struct has 2 children (expected 1)"Posiblemente ocupada @Samearth17 la tomó hace 17 días. Abiertoarea:expressions area:ffi bug good first issue priority:high
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
apache/datafusion-comet#6591 ·
Todos los issues de apache/datafusion-comet
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
scylladb/scylla-migrator#417 ·
-
arch build failsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
digital-asset/participant-query-store#177 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
containerbase/base#7891 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 91/100
com-vitthalmirji/toon4s#117 ·
Los mantenedores suelen responder en 1 día