JVM columnar shuffle panics on a struct column with a NullType field
メンテナーはふだん 2 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
調査の方向性
native/shuffle/src/spark_unsafe/row.rs の、フィールド優先の 2 つの関数 append_struct_fields_field_major と append_nested_struct_fields_field_major から始めてください。これらは DataType::Null に対して unreachable! に到達します。同じファイルの append_field にある既存の Null 分岐と比べて、行ごとの null がどのように追加されるかを確認してください。issue にある 3 つの SQL 再現ケースが Spark と同じ行を返し、トップレベルの struct とネストした struct の null フィールドを扱う回帰テストがあれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
A shuffle that runs on Comet's JVM columnar shuffle fails the query when one of its columns is a struct with a NullType field, such as named_struct('x', a, 'n', null). The row-to-Arrow conversion panics:
org.apache.comet.CometNativeException: internal error: entered unreachable code: Unsupported data type of struct field: Null
at datafusion_comet_shuffle::spark_unsafe::row::append_struct_fields_field_major
at datafusion_comet_shuffle::spark_unsafe::row::append_columns
at datafusion_comet_shuffle::spark_unsafe::row::process_sorted_row_partition
at comet::execution::jni_api::write_sorted_file
at comet::execution::jni_api::Java_org_apache_comet_Native_writeSortedFileNative
Spark returns the rows. Both field-major struct paths in native/shuffle/src/spark_unsafe/row.rs lack a DataType::Null arm and fall through to unreachable!. append_struct_fields_field_major handles a top-level struct column, and append_nested_struct_fields_field_major handles a struct inside a struct:
append_field in the same file already has the arm. The JVM columnar shuffle's type check accepts NullType at any depth, so nothing keeps these schemas away from the converter, and Null is the only type that check accepts that the two functions are missing.
With the default configuration this hits every round-robin repartition of such a column, because native round robin is off by default and those shuffles run on JVM columnar shuffle. It also hits a hash shuffle that runs on JVM columnar shuffle, for example under spark.comet.shuffle.mode=jvm. A hash shuffle over a native child runs on native shuffle and works. Arrays and maps that hold nulls (array(null), map(k, null), array(named_struct('x', a, 'n', null))) also work.
Steps to reproduce
CREATE TABLE t (a INT) USING parquet;
INSERT INTO t SELECT CAST(id AS INT) FROM range(1000);
-- top-level struct column
SELECT /*+ REPARTITION(4) */ a, named_struct('x', a, 'n', null) AS st FROM t;
-- struct inside a struct
SELECT /*+ REPARTITION(4) */ a, named_struct('s', named_struct('x', a, 'n', null)) AS st FROM t;
-- hash partitioning on JVM columnar shuffle
SET spark.comet.shuffle.mode=jvm;
SELECT a, named_struct('x', a, 'n', null) AS st FROM t DISTRIBUTE BY a;
All three fail with the panic above. 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 rows as Spark. Every value of a NullType field is null, so a DataType::Null arm in both functions that appends one null per row, as append_field does, should be enough. A regression test with a top-level and a nested struct would cover both paths.
Additional context
#6977 proposes merging the two field-major functions, which would make an arm like this one change instead of two.
- 主要言語
- Scala
- スター
- 1.3k
- フォーク
- 391
- 平均マージ
- 2日 20時間
- マージ済み PR(30日)
- 437
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/datafusion-comet のほかの issue
-
enhancement
難易度 1/5 1〜3時間 初心者へのやさしさ 83/100
apache/datafusion-comet#7101 ·
メンテナーはふだん 2 日以内に返信
-
Native hashing of NullType and ANSI interval values fails with "Unsupported data type in hasher"対応中かも @ump45nose が 4 日前に担当しました。 オープンarea:expressions area:shuffle bug priority:high
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
apache/datafusion-comet#7063 ·
メンテナーはふだん 2 日以内に返信
-
requires-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
apache/datafusion-comet#7001 ·
メンテナーはふだん 2 日以内に返信
-
Deduplicate spark_ceil and spark_floor and port floor's decimal boundary tests to ceil対応中かも @med9110 が 6 日前に担当しました。 オープンarea:expressions enhancement help wanted requires-triage rust tech debt
難易度 2/5 半日 初心者へのやさしさ 68/100
apache/datafusion-comet#6974 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Iceberg data tables whose names end with a metadata-table name fall back to Spark再び着手できるかも @aryan9948 が 14 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンrequires-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
apache/datafusion-comet#6719 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
apache/datafusion-comet の issue をすべて見る
似ている issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 91/100
com-vitthalmirji/toon4s#117 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
zio/zio-blocks#1780 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
digital-asset/participant-query-store#168 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
propensive/soundness#2294 ·
メンテナーはふだん 1 日以内に返信