[BUG] expand on a field that is not a column of the input fails as a ClassCastException
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Idoneità per principianti
- 85/100
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
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.
- Lingua principale
- Java
- Stelle
- 175
- Fork
- 232
- Merge medio
- 3g 3h
- PR unite (30g)
- 42
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di opensearch-project/sql
-
[Enhancement] Make the flat_object read depth cap configurable instead of a constantForse già presa @RyanL1997 l’ha presa 8 giorni fa. Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
opensearch-project/sql#5842 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] PromQL queries fail with InvalidTypeIdException when metric has a label named "type"Forse già presa @nagendramohan l’ha presa 71 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
opensearch-project/sql#5684 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[DOC] Calcite settings documentation missing examplesForse già presa @AzazelSensei l’ha presa 28 giorni fa. Apertadocumentation PPL
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
opensearch-project/sql#4806 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug PPL untriaged
Difficoltà 3/5 1-2 giorni Idoneità per principianti 66/100
opensearch-project/sql#5900 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] spath and seven json functions return 500 or a wrong 200 on a field type they do not supportApertabug PPL untriaged
Difficoltà 4/5 3-5 giorni Idoneità per principianti 50/100
opensearch-project/sql#5899 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di opensearch-project/sql
Issue simili
-
enhancement web-ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
jenkinsci/jenkins#27583 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/rocketmq-dashboard#7302 ·
I maintainer di solito rispondono entro 3 giorni
-
area: android good first issue help wanted testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Gautam-aman/ResQNet#56 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation hermes-queue
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
chrisalunlloyd2-sudo/mindpalace#294 ·
I maintainer di solito rispondono entro 1 giorno