[BUG] Comparing a string field to both an integer and a decimal literal returns 500 ClassCastException
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ó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 22/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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).
- 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
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của opensearch-project/sql
-
bug untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
opensearch-project/sql#5990 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug untriaged
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
opensearch-project/sql#5983 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] PromQL queries fail with InvalidTypeIdException when metric has a label named "type"Có thể đã có người làm @nagendramohan đã nhận 106 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
opensearch-project/sql#5684 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[DOC] Calcite settings documentation missing examplesCó thể đã có người làm @AzazelSensei đã nhận 64 ngày trước. Đang mởdocumentation PPL
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
opensearch-project/sql#4806 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
calcite enhancement Meta performance PPL untriaged
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 8/100
opensearch-project/sql#5991 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của opensearch-project/sql
Issue tương tự
-
Document the isv:HDFGroup Linux package repositories and signing keyCó thể đã có người làm @brtnfld đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
checkstyle/checkstyle#23174 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug follow-up lane:backlog
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Sanne/incus-spawn#2620 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] Execute API reports every non-400 error, including 404 "not found", with reason "System Error"Đang mởuntriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
opensearch-project/ml-commons#5296 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày