[BUG] Field mapped in only some indices fails shards with opaque "Failed to get value for parameter ?N"

Đang mở
#5,947 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
backend, databases

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug error-experience

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:

  1. 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
  1. 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
  1. Count docs while casting rt. The count is 1, not 2, and the mixdemo_b shard 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.get catches every exception and rethrows IllegalStateException("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.get throws No field found for [rt] in mapping for unmapped fields, and getFromDocValue only handles docValue == 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.get bugs).
Ngôn ngữ chính
Java
Star
176
Fork
237
Merge trung bình
2 ngày 12 giờ
Pull request đã merge (30 ngày)
34

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của opensearch-project/sql

Tất cả issue của opensearch-project/sql

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.