You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When quoting the field passed to an aggregation and when this field is a nested field, a SQL query with the JSON format return an incorrect value (0 or null) for the aggregation instead of the actual result.
How can one reproduce the bug?
Given an index with documents with a nested (field_nested.c2) and a non-nested field (field_float), using the following two queries to perform some basic aggregations:
SELECT sum(`field_float`) AS `SUM(field_float)`, sum(`field_nested.c2`) AS `SUM(field_nested.c2)` FROM data1 LIMIT 5000;
SELECT sum(field_float) AS `SUM(field_float)`, sum(field_nested.c2) AS `SUM(field_nested.c2)` FROM data1 LIMIT 5000;
We expect the same result. But when requesting JSON documents, the first query produce wrong values:
In order to ease-up reproducing the issue, here is another example targeting the demo dataset, and that can be reproduced on https://playground.opensearch.org:
What is the bug?
When quoting the field passed to an aggregation and when this field is a nested field, a SQL query with the JSON format return an incorrect value (0 or null) for the aggregation instead of the actual result.
How can one reproduce the bug?
Given an index with documents with a nested (
field_nested.c2
) and a non-nested field (field_float
), using the following two queries to perform some basic aggregations:SELECT sum(`field_float`) AS `SUM(field_float)`, sum(`field_nested.c2`) AS `SUM(field_nested.c2)` FROM data1 LIMIT 5000;
SELECT sum(field_float) AS `SUM(field_float)`, sum(field_nested.c2) AS `SUM(field_nested.c2)` FROM data1 LIMIT 5000;
We expect the same result. But when requesting JSON documents, the first query produce wrong values:
First query result:
Second query result:
Note how
aggregations."SUM(field_nested.c2)".value
is0
in the first example and6
it the second.What is the expected behavior?
Quoted and non-quoted nested fields in aggregations should return the same (correct) value.
What is your host/environment?
Do you have any additional context?
sum
as in the example above) always return0
, but other (e.g.avg
) always returnnull
instead of the actual value.The text was updated successfully, but these errors were encountered: