[BUG] Field mapped in only some indices fails shards with opaque "Failed to get value for parameter ?N"
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 72/100
Research direction
Start by reading CalciteScriptEngine.ScriptDataContext.get and getFromDocValue, then trace how unmapped fields are handled by the document provider. Add coverage for a field mapped in one index but absent from another, including the two-index pattern in the report. Done means both documents are counted, the absent field evaluates to null, and shard failures retain a useful cause.
Written by the indexing model from the issue text.
Description
What is the bug?
When a pushed-down script reads a field that one index in the pattern doesn't map, that index's shard fails with Failed to get value for parameter ?0 instead of reading the field as null, and aggregates come back wrong.
How can one reproduce the bug?
Steps to reproduce the behavior:
- Create two indices. Only the first maps
rt.
curl -s -X PUT localhost:9200/mixdemo_a -H 'Content-Type: application/json' \
-d '{"mappings":{"properties":{"rt":{"type":"keyword"}}}}' | jq .acknowledged
curl -s -X PUT localhost:9200/mixdemo_b -H 'Content-Type: application/json' \
-d '{"mappings":{"properties":{"other":{"type":"long"}}}}' | jq .acknowledged
- Index one doc into each.
curl -s -X POST 'localhost:9200/mixdemo_a/_doc?refresh=true' -H 'Content-Type: application/json' -d '{"rt":"12.5"}' | jq .result
curl -s -X POST 'localhost:9200/mixdemo_b/_doc?refresh=true' -H 'Content-Type: application/json' -d '{"other":1}' | jq .result
- Count docs while casting
rt. The count is 1, not 2, and themixdemo_bshard fails.
curl -s -X POST localhost:9200/_plugins/_ppl -H 'Content-Type: application/json' \
-d '{"query":"source=mixdemo_* | eval t = cast(rt as double) | stats count() as n, max(t) as mx"}' \
| jq -c '{datarows, warnings}'
# {"datarows":[[1,12.5]],"warnings":[{"type":"PARTIAL_RESULT","message":"Results are partial: 1 of 2 shards failed.",
# "detail":"_shards: total 2, successful 1, skipped 0, failed 1; failures: [[mixdemo_b][0] IllegalStateException: Failed to get value for parameter ?0]"}]}
What is the expected behavior?
n is 2 and there's no shard failure: rt reads as null on mixdemo_b, the same as a doc that lacks the field. When a shard does fail, the message should say why.
What is your host/environment?
- mainline (3.10.0-SNAPSHOT), single node
Do you have any screenshots?
N/A
Do you have any additional context?
CalciteScriptEngine.ScriptDataContext.getcatches every exception and rethrowsIllegalStateException("Failed to get value for parameter " + name)without the cause, so neither the response nor the node log says what went wrong. Nothing was logged in this repro.- The likely cause (from code, since the original exception is swallowed): core
LeafDocLookup.getthrowsNo field found for [rt] in mappingfor unmapped fields, andgetFromDocValueonly handlesdocValue == null. - Possible fix: keep the cause and name the field in the message; return null when
!docProvider.containsKey(name); add a unit test and an IT using this two-index pattern. - Seen at thousands of shard failures per day on a large index pattern, mostly from casts inside aggregations.
- Related: #5825 and #5835 (mixed mappings across a pattern give opaque 500s), #4508 and #4461 (earlier
ScriptDataContext.getbugs).
- Dominant language
- Java
- Stars
- 176
- Forks
- 237
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 34
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from opensearch-project/sql
-
bug untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
opensearch-project/sql#5990 ·
Maintainers usually reply within 1 day
-
bug untriaged
Difficulty 1/5 Under an hour Newbie friendliness 85/100
opensearch-project/sql#5983 ·
Maintainers usually reply within 1 day
-
[BUG] PromQL queries fail with InvalidTypeIdException when metric has a label named "type"Possibly taken @nagendramohan claimed this 107 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
opensearch-project/sql#5684 · 4 comments ·
Maintainers usually reply within 1 day
-
[DOC] Calcite settings documentation missing examplesPossibly taken @AzazelSensei claimed this 64 days ago. Opendocumentation PPL
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
opensearch-project/sql#4806 · 1 comment ·
Maintainers usually reply within 1 day
-
calcite enhancement Meta performance PPL untriaged
Difficulty 5/5 Over a week Newbie friendliness 8/100
opensearch-project/sql#5991 ·
Maintainers usually reply within 1 day
All issues in opensearch-project/sql
Similar issues
-
chore
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
lugassawan/swe-workbench#841 ·
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
EndlessPixel-Studio/FakePlayer-CE#155 ·
Maintainers usually reply within 1 day
-
Document the isv:HDFGroup Linux package repositories and signing keyPossibly taken @brtnfld claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
checkstyle/checkstyle#23174 ·
Maintainers usually reply within 1 day