[BUG] expand on a field that is not a column of the input fails as a ClassCastException
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
問題のあるキャストは CalciteRelNodeVisitor.java の4459行目にあります。まず同じメソッド内の mvexpand のサポート対象外ターゲットチェックを既存のものとして探し、パターンとして使用してください。rexVisitor.analyze の結果を RexInputRef にキャストする前に型チェックを追加し、expand が計算値ではなくインデックスフィールドを必要とすることを示すユーザー向けエラーを返してください。提供された再現テストケースをマップ列に対して実行し、ClassCastException が正しいエラーメッセージに置き換えられることを確認してください。
索引モデルが issue の本文から書いたものです。
説明
What is wrong
expand correlates the expansion with a column of its input, and the planner casts the resolved field to a RexInputRef without checking it:
RexInputRef arrayFieldRex = (RexInputRef) rexVisitor.analyze(arrayField, context);
Anything that is not a column of the input resolves to something else — a leaf of an object or a map reaches the planner as an ITEM call — so the cast fails:
java.lang.ClassCastException: class org.apache.calcite.rex.RexCall cannot be cast to
class org.apache.calcite.rex.RexInputRef
The user gets an internal error naming Calcite classes rather than a message about their query. The sibling check in the same method already reports an unsupported mvexpand target properly, so the vocabulary for saying this is there.
Reproduce
A unit test against main at 803ed31c8, on a table with a map column:
getRelNode("source=DEPT_MAP | expand ATTRS.k");
// -> ClassCastException: RexCall cannot be cast to RexInputRef
Any expand target that is not a column of the input reaches it — a sub-field of an object field, or an expression.
What it should do
Report it the way the mvexpand check in the same method does: name the field, say that expand takes a field of the index rather than a value computed from one, and suggest expanding the field itself or projecting the value first.
Found while
Adding flat_object support (#5830), whose leaves are reached the same way. The cast predates that change and is reached without it.
- 主要言語
- Java
- スター
- 175
- フォーク
- 231
- 平均マージ
- 2日 7時間
- マージ済み PR(30日)
- 35
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
opensearch-project/sql のほかの issue
-
enhancement untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
opensearch-project/sql#5842 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] PromQL queries fail with InvalidTypeIdException when metric has a label named "type"対応中かも @nagendramohan が 59 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
opensearch-project/sql#5684 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
Mend: dependency security vulnerability
難易度 1/5 1〜3時間 初心者へのやさしさ 84/100
opensearch-project/sql#5445 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
[DOC] Calcite settings documentation missing examples対応中かも @AzazelSensei が 16 日前に担当しました。 オープンdocumentation PPL
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
opensearch-project/sql#4806 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
untriaged
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
opensearch-project/sql#5849 ·
メンテナーはふだん 1 日以内に返信
opensearch-project/sql の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
sqlcipher/sqlcipher-android#97 · コメント 1 件 ·
-
bug IIIF interoperability
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Netcracker/qubership-integration-platform#1046 ·
メンテナーはふだん 2 日以内に返信
-
`check_java_version()` fails when Java path contains spaces (Windows / Git Bash, `C:\Program Files`)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100