[BUG] concat, concat_ws, locate, position and truncate return 500 on an argument type they do not support
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
Start with PPLFuncImpTable.registerOperator and PPLTypeChecker.wrapComposite, where the Calcite operator checkers for concat, concat_ws, locate, position and truncate fail to wrap and become null. Then check CalciteFuncSignature.match, which accepts any argument list when the checker is null. Reproduce with the curl commands in the issue. Done means these five functions return HTTP 400 naming the argument type on the wrong-type fields, as upper does, and existing type-check tests still pass.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Query Information
PPL Command/Query:
source=nums | eval x = concat(f, 'z') | fields x
f is a long field. The concat documentation lists its parameters as strings.
Expected Result: HTTP 400 naming the argument type, as upper(f) on the same field returns.
{
"error": {
"context": {
"stage": "analyzing",
"stage_description": "Parsing and validating the query"
},
"reason": "UPPER function expects {[STRING]}, but got [LONG]",
"details": "UPPER function expects {[STRING]}, but got [LONG]",
"location": ["while preparing and validating the query plan"],
"code": "UNKNOWN",
"type": "ExpressionEvaluationException"
},
"status": 400
}
Actual Result: HTTP 500.
{
"error": {
"context": {
"stage": "executing",
"stage_description": "Running the query"
},
"reason": "Internal error while compiling the query plan.",
"details": "Line 23, Column 54: Assignment conversion not possible from type \"long\" to type \"java.lang.String\"",
"location": [
"while running the query",
"while compiling the optimized query plan for physical execution"
],
"code": "PLANNING_ERROR",
"type": "SQLException"
},
"status": 500
}
Analysis accepts concat on a long, and the generated Java then fails to compile. The v2 engine, with plugins.calcite.enabled=false, returns HTTP 400 invalid to get stringValue from value of type LONG for the same query.
Five functions return 500 on a wrong type.
| Function | keyword |
long |
double |
boolean |
date |
ip |
object |
flat_object |
nested |
|---|---|---|---|---|---|---|---|---|---|
concat(f, 'z') |
200 | 500 | 500 | 500 | 200 | 500 | 500 | 500 | 500 |
locate('a', f) |
200 | 500 | 500 | 500 | 200 | 500 | 500 | 500 | 500 |
truncate(f, 1) |
500 | 200 | 200 | 500 | 500 | 500 | 500 | 500 | 500 |
upper(f), for comparison |
200 | 400 | 400 | 400 | 400 | 400 | 400 | 400 | 400 |
concat_ws matches the concat row and position matches the locate row.
Dataset Information
Dataset/Schema Type
- OpenTelemetry (OTEL)
- Simple Schema for Observability (SS4O)
- Open Cybersecurity Schema Framework (OCSF)
- Custom (details below)
Index Mapping
PUT nums { "mappings": { "properties": { "host": { "type": "keyword" }, "f": { "type": "long" } } } }
Sample Data
POST nums/_doc/1?refresh=true { "host": "a", "f": 5 }
A single index reproduces it. No mapping conflict is involved.
Bug Description
Issue Summary
PPLFuncImpTable.registerOperator wraps each Calcite operator's own operand checker into a PPLTypeChecker through PPLTypeChecker.wrapComposite, which accepts only an OR composition of ImplicitCastOperandTypeChecker rules. All five functions are registered with Calcite checkers outside that shape, so the wrap throws and the checker is set to null. CalciteFuncSignature.match treats a null checker as matching every argument list. The call is then built with no cast, and the mismatch surfaces only in code generation.
Steps to Reproduce
curl -s -XPUT "localhost:9200/nums" -H 'Content-Type: application/json' \
-d '{"mappings":{"properties":{"host":{"type":"keyword"},"f":{"type":"long"}}}}'
curl -s -XPOST "localhost:9200/nums/_doc/1?refresh=true" -H 'Content-Type: application/json' -d '{"host":"a","f":5}'
# 1. Returns HTTP 500 with a Janino compile error
curl -s -XPOST "localhost:9200/_plugins/_ppl" -H 'Content-Type: application/json' \
-d '{"query":"source=nums | eval x = concat(f, '\''z'\'') | fields x"}' -w '\nHTTP %{http_code}\n'
# 2. locate also returns 500, with the reason Failed to prepare the query plan for execution.
curl -s -XPOST "localhost:9200/_plugins/_ppl" -H 'Content-Type: application/json' \
-d '{"query":"source=nums | eval x = locate('\''a'\'', f) | fields x"}' -w '\nHTTP %{http_code}\n'
# 3. upper on the same field is checked and returns HTTP 400
curl -s -XPOST "localhost:9200/_plugins/_ppl" -H 'Content-Type: application/json' \
-d '{"query":"source=nums | eval x = upper(f) | fields x"}' -w '\nHTTP %{http_code}\n'
Impact
Building a label with concat over a numeric field, such as concat(status_code, ' ', method), returns a 500 reporting an engine defect, with no hint that the field needs a cast. The same holds for locate and position on a number, truncate on a string, and every one of the five on an object, flat_object, ip or boolean field.
Environment Information
OpenSearch Version: main at 4d9839398, 3.10.0-SNAPSHOT, one node, with the defaults plugins.calcite.enabled=true, plugins.calcite.pushdown.enabled=true and plugins.calcite.fallback.allowed=false.
- 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
-
better night vision compatAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
QuicksilverMC/Argentum#31 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
navikt/mock-oauth2-server#1129 ·
I maintainer di solito rispondono entro 1 giorno
-
bug main ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
openhab/openhab-webui#4600 ·
I maintainer di solito rispondono entro 4 giorni
-
26.4 area: tags enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
`DeepSeekChatModel` streaming returns no content when chunks have no `id`Forse già presa @lejuho l’ha presa oggi. Apertastatus: waiting-for-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
spring-projects/spring-ai#7214 ·
I maintainer di solito rispondono entro 2 giorni