Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Chiusa Adatta ai principianti
#5,840 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@RyanL1997 ci sta già lavorando.

Dal 13/10/2026.

  • #5841 di @RyanL1997 — aperta

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
85/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java
Ambito
backend

Direzione di ricerca

La conversione problematica si trova in CalciteRelNodeVisitor.java alla riga 4459; individua prima il controllo esistente per la destinazione non supportata di mvexpand nello stesso metodo da usare come modello. Aggiungi un controllo del tipo per il risultato di rexVisitor.analyze prima di convertirlo in RexInputRef, e restituisci un errore rivolto all'utente che indichi che expand richiede un campo indice invece di un valore calcolato. Esegui il caso di test di riproduzione fornito su una colonna di tipo mappa per confermare che la ClassCastException viene sostituita dal messaggio di errore corretto.

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

Descrizione

bug PPL
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.

Lingua principale
Java
Stelle
175
Fork
232
Merge medio
3g 3h
PR unite (30g)
42

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 opensearch-project/sql

Tutte le issue di opensearch-project/sql

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.