What is the bug?
When operations transform numeric fields to produce non-numeric string values (e.g., "30-40", "20-25"), the response parser fails. The aggregation itself executes correctly in OpenSearch, but parsing the response fails because the parser uses type information that is not updated.
How can one reproduce the bug?
This issue affects multiple operations that transform field types:
Example 1: bin command produces range strings
curl -X POST "localhost:9200/_plugins/_ppl" \
-H "Content-Type: application/json" \
-d '{"query":"source=accounts | bin age span=10 | stats count() by age"}'
Error: For input string: "30-40"
Example 2: eval with string concatenation
curl -X POST "localhost:9200/_plugins/_ppl" \
-H "Content-Type: application/json" \
-d '{"query":"source=accounts | eval age = CAST(age AS STRING) + \"-25\" | stats count() by age | head 3"}'
Error: For input string: "20-25"
Both fail with:
{
"error": {
"reason": "There was internal problem at backend",
"details": "java.sql.SQLException: exception while executing query: For input string: \"20-25\"",
"type": "RuntimeException"
},
"status": 500
}
What is the expected behavior?
Expected for bin command:
{
"schema": [
{"name": "count()", "type": "bigint"},
{"name": "age", "type": "string"}
],
"datarows": [
[451, "20-30"],
[504, "30-40"],
[45, "40-50"]
]
}
Expected for eval with concatenation:
{
"schema": [
{"name": "count()", "type": "bigint"},
{"name": "age", "type": "string"}
],
"datarows": [
[44, "20-25"],
[46, "21-25"],
[51, "22-25"]
]
}
Do you have any additional context?
- This issue was initially discovered with the bin command but affects any operation that transforms field types to produce non-numeric strings
- The extendTypeMapping method uses
putIfAbsent which was designed to prevent overwriting field types
What is the bug?
When operations transform numeric fields to produce non-numeric string values (e.g., "30-40", "20-25"), the response parser fails. The aggregation itself executes correctly in OpenSearch, but parsing the response fails because the parser uses type information that is not updated.
How can one reproduce the bug?
This issue affects multiple operations that transform field types:
Example 1: bin command produces range strings
Example 2: eval with string concatenation
Both fail with:
What is the expected behavior?
Expected for bin command:
Expected for eval with concatenation:
Do you have any additional context?
putIfAbsentwhich was designed to prevent overwriting field types