Bug
When running any PPL stats aggregation on an index with no documents, the query fails with a NullPointerException instead of returning an empty or zero result.
Reproduce
PUT /test_empty_index
source=test_empty_index | stats sum(amount), count()
Error response 500:
Caused by: java.lang.NullPointerException
at org.opensearch.sql.expression.aggregation.CountAggregator.iterate(...)
Expected
Should return sum(amount) = null, count() = 0 gracefully.
Version
OpenSearch 2.17 with SQL plugin 2.17.0
Bug
When running any PPL stats aggregation on an index with no documents, the query fails with a NullPointerException instead of returning an empty or zero result.
Reproduce
Error response 500:
Expected
Should return
sum(amount) = null, count() = 0gracefully.Version
OpenSearch 2.17 with SQL plugin 2.17.0