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

オープン 初心者向け
#7,458 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
scala, sql
領域
testing

調査の方向性

spark/src/test/resources/sql-tests/operators/one_row_relation.sql から始めてください。このファイルには -- ConstantFolding: enabled ディレクティブがありません。また CometSqlFileTestSuite は、ファイルがそれを要求しない限り定数畳み込みをスキップします。そのディレクティブをこれらのクエリに追加するか、expressions/array/folded_array_map_literals.sql に移動してください。そして、リテラルが Comet オペレータの下で実行されるようにしてください。たとえばテーブル上で射影するなどです。spark/src/main/scala/org/apache/comet/serde/literals.scala の toArray[Any] 呼び出しを元に戻したときにスイートが失敗すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Scala
スター
1.3k
フォーク
405
平均マージ
3日 7時間
マージ済み PR(30日)
225

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/datafusion-comet のほかの issue

apache/datafusion-comet の issue をすべて見る

似ている issue

Scala の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。