[BUG] Comparing a string field to both an integer and a decimal literal returns 500 ClassCastException
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 22/100
Línea de trabajo
The failure comes from the Calcite RexSimplify$RexSargBuilder.addRange call at RexSimplify.java:3617, reached through RexSimplify$SargCollector.accept2b, so start by reproducing the two-comparison query with the PPL endpoint and reading that path. The open question is whether string-to-number comparison should be allowed at all, which the maintainers need to settle before the literal-type merge can be fixed. Done means the same query either returns consistent results or fails with a 400 instead of a 500.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What is the bug?
A filter that compares a string field to an integer literal and a decimal literal fails in Calcite's RexSimplify with a ClassCastException.
How can one reproduce the bug?
- Create the index and doc:
curl -s -X PUT localhost:9200/hdemo -H 'Content-Type: application/json' \
-d '{"mappings":{"properties":{"s":{"type":"keyword"},"n":{"type":"integer"},"d":{"type":"double"},"b":{"type":"boolean"},"ts":{"type":"date"}}}}' | jq .acknowledged
curl -s -X POST 'localhost:9200/hdemo/_doc?refresh=true' -H 'Content-Type: application/json' \
-d '{"s":"abc","n":7,"d":1.5,"b":true,"ts":"2026-01-02T03:04:05Z"}' | jq .result
- Either comparison on its own works (
where s = 0andwhere s = 0.5each return no rows). - Both together fail:
curl -s -X POST localhost:9200/_plugins/_ppl -H 'Content-Type: application/json' \
-d '{"query":"source=hdemo | where s = 0.5 or s = 0"}' | jq -c '{status, type: .error.type, error: .error.details[0:120]}'
# {"status":500,"type":"ClassCastException","error":"class java.math.BigDecimal cannot be cast to class java.lang.Double (java.math.BigDecimal and java.lang.Double are in mo"}
- Two separate
wherecommands fail too, because they get merged:where s = 0.5 | where s = 0, orwhere s <= 0.5 | where 0 = s. Reversing the literal order flips the message (Double cannot be cast to BigDecimal).
What is the expected behavior?
No rows, the same as each comparison on its own, or a 400 if comparing a string to a number is meant to be rejected. Not a 500.
What is your host/environment?
- mainline (3.10.0-SNAPSHOT, c7e2cea98), single node. Same result with
plugins.calcite.pushdown.enabled=false.
Do you have any screenshots?
N/A
Do you have any additional context?
- Stack:
RexSimplify$RexSargBuilder.addRange(RexSimplify.java:3617)←RexSimplify$SargCollector.accept2b. The implicit cast ofsto a number gives the two comparisons different literal types (DOUBLE vs DECIMAL), and the Sarg builder merges them into one range set without unifying the types. - Whether string = number comparison should be allowed at all is a separate question. Today it's accepted silently (
where s = 0→ 200). - Found by a property-based type checker (hegel).
- Lenguaje dominante
- Java
- Estrellas
- 176
- Forks
- 237
- Merge medio
- 2 d 12 h
- PR fusionados (30 d)
- 34
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
-
bug untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
opensearch-project/sql#5990 ·
Los mantenedores suelen responder en 1 día
-
bug untriaged
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
opensearch-project/sql#5983 ·
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 106 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
-
[DOC] Calcite settings documentation missing examplesPosiblemente ocupada @AzazelSensei la tomó hace 64 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
-
calcite enhancement Meta performance PPL untriaged
Dificultad 5/5 Más de una semana Aptitud para principiantes 8/100
opensearch-project/sql#5991 ·
Los mantenedores suelen responder en 1 día
Todos los issues de opensearch-project/sql
Issues similares
-
Document the isv:HDFGroup Linux package repositories and signing keyPosiblemente ocupada @brtnfld la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
checkstyle/checkstyle#23174 ·
Los mantenedores suelen responder en 1 día
-
bug follow-up lane:backlog
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Sanne/incus-spawn#2620 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[BUG] Execute API reports every non-400 error, including 404 "not found", with reason "System Error"Abiertountriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
opensearch-project/ml-commons#5296 · 1 comentario ·
Los mantenedores suelen responder en 1 día