Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[BUG] expand on a field that is not a column of the input fails as a ClassCastException

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

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

@RyanL1997 がすでに取り組んでいます。

2026年10月6日 から。

  • #5841 @RyanL1997 による — オープン

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
85/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
java
領域
backend

調査の方向性

問題のあるキャストは CalciteRelNodeVisitor.java の4459行目にあります。まず同じメソッド内の mvexpand のサポート対象外ターゲットチェックを既存のものとして探し、パターンとして使用してください。rexVisitor.analyze の結果を RexInputRef にキャストする前に型チェックを追加し、expand が計算値ではなくインデックスフィールドを必要とすることを示すユーザー向けエラーを返してください。提供された再現テストケースをマップ列に対して実行し、ClassCastException が正しいエラーメッセージに置き換えられることを確認してください。

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

説明

untriaged
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:

https://github.com/opensearch-project/sql/blob/803ed31c8/core/src/main/java/org/opensearch/sql/calcite/CalciteRelNodeVisitor.java#L4459

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

環境構築

はじめの一歩

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

opensearch-project/sql のほかの issue

opensearch-project/sql の issue をすべて見る

似ている issue

Java の issue をもっと見る

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

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