[BUG] expand on a field that is not a column of the input fails as a ClassCastException
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 1/5
- Tiempo estimado
- Menos de una hora
- Aptitud para principiantes
- 85/100
Línea de trabajo
La conversión problemática se encuentra en CalciteRelNodeVisitor.java en la línea 4459; primero localiza la comprobación existente de destino no compatible de mvexpand en el mismo método para usarla como patrón. Agrega una comprobación de tipo para el resultado de rexVisitor.analyze antes de convertirlo a RexInputRef, y devuelve un error orientado al usuario que indique que expand requiere un campo de índice en lugar de un valor calculado. Ejecuta el caso de prueba de reproducción proporcionado contra una columna de mapa para confirmar que la ClassCastException se reemplaza por el mensaje de error correcto.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Java
- Estrellas
- 175
- Forks
- 231
- Merge medio
- 2 d 7 h
- PR fusionados (30 d)
- 35
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de opensearch-project/sql
-
enhancement untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
opensearch-project/sql#5842 ·
Los mantenedores suelen responder en 1 día
-
[BUG] PromQL queries fail with InvalidTypeIdException when metric has a label named "type"Posiblemente ocupada @nagendramohan la tomó hace 59 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
opensearch-project/sql#5684 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
-
Mend: dependency security vulnerability
Dificultad 1/5 1-3 horas Aptitud para principiantes 84/100
opensearch-project/sql#5445 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
[DOC] Calcite settings documentation missing examplesPosiblemente ocupada @AzazelSensei la tomó hace 16 días. Abiertodocumentation PPL
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
opensearch-project/sql#4806 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
untriaged
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
opensearch-project/sql#5849 ·
Los mantenedores suelen responder en 1 día
Todos los issues de opensearch-project/sql
Issues similares
-
Fix Math.ceilDiv wrong result for exact positive divisionsPosiblemente ocupada @pamod-madubashana la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
scala-native/scala-native#5094 ·
Los mantenedores suelen responder en 1 día
-
[Bug] AI unread message badge counts a batch of new bubbles as one messagePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
apache/rocketmq-dashboard#5784 ·
Los mantenedores suelen responder en 3 días
-
[i18n] 安装实例完成后的成功提示未正确本地化Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
PCL-Community/PCL-CE#3658 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
apache/skywalking#14127 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día