test: no test on main reaches the folded UnsafeArrayData literal fix from #6666

Aperta Adatta ai principianti
#7,458 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
scala, sql
Ambito
testing

Direzione di ricerca

Inizia da spark/src/test/resources/sql-tests/operators/one_row_relation.sql, che non ha la direttiva -- ConstantFolding: enabled, e da CometSqlFileTestSuite, che salta il constant folding a meno che un file non lo richieda. Aggiungi la direttiva a quelle query oppure spostale in expressions/array/folded_array_map_literals.sql, e assicurati che i literal vengano eseguiti sotto un operatore Comet, per esempio proiettando su una tabella. È completato quando annullare le chiamate toArray[Any] in spark/src/main/scala/org/apache/comet/serde/literals.scala fa fallire la suite.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

requires-triage
Describe the bug

#6666 changed CometLiteral to read array literal values with toArray[Any](elementType) instead of ArrayData.array. A constant-folded array such as sequence(1, 5) is an UnsafeArrayData, and UnsafeArrayData.array() throws. Before the change, planning such a query failed with UNSUPPORTED_CALL.

The test added for that change is the first three queries in spark/src/test/resources/sql-tests/operators/one_row_relation.sql. That file has no -- ConstantFolding: enabled line, and CometSqlFileTestSuite excludes ConstantFolding unless the file asks for it (the directive came in #6731, two days after #6666). So SELECT sequence(1, 5) there never folds. It runs through the native CometSequence, and the CometLiteral lines from #6666 are never reached. I couldn't find another test on main that folds an array into an UnsafeArrayData literal under a Comet operator, so putting .array back should go unnoticed.

Found in #7449, the branch-1.1 backport of the fix, which adds a Scala test that does fold: https://github.com/apache/datafusion-comet/pull/7449#pullrequestreview-5754272211

Steps to reproduce
  1. On main, change the two toArray[Any](...) calls in spark/src/main/scala/org/apache/comet/serde/literals.scala back to .array.
  2. Run CometSqlFileTestSuite for one_row_relation. With folding excluded, sequence(1, 5) stays a Sequence expression, so the reverted lines are never called and the file should still pass.
Expected behavior

A test on main fails when the fix is reverted. Either of these would do it:

  • Add -- ConstantFolding: enabled to the queries in one_row_relation.sql, or move them into a fixture that has it, such as expressions/array/folded_array_map_literals.sql.
  • Port the test from #7449, which projects sequence(1, 5) and array(sequence(1, 3), sequence(4, 5)) over a Parquet table. The nested query covers the inner makeListLiteral call as well.
Additional context

The queries need to read from a table, or run over a OneRowRelation with folding on, so that the folded literal sits under an operator Comet converts.

Lingua principale
Scala
Stelle
1.3k
Fork
405
Merge medio
3g 3h
PR unite (30g)
269

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/datafusion-comet

Tutte le issue di apache/datafusion-comet

Issue simili

Altre issue su Scala

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.