The API returns `"-Infinity"` and the Web UI shows...
# troubleshooting
j
The API returns
"-Infinity"
and the Web UI shows the same
m
Can you paste the returned json?
j
Sure
m
If no rows selected, why is there even a value being returned
1
j
Copy code
{'exceptions': [],
 'minConsumingFreshnessTimeMs': 0,
 'numConsumingSegmentsQueried': 0,
 'numDocsScanned': 0,
 'numEntriesScannedInFilter': 2,
 'numEntriesScannedPostFilter': 0,
 'numGroupsLimitReached': False,
 'numSegmentsMatched': 0,
 'numSegmentsProcessed': 2,
 'numSegmentsQueried': 2,
 'numServersQueried': 1,
 'numServersResponded': 1,
 'resultTable': {'dataSchema': {'columnDataTypes': ['DOUBLE'],
                                'columnNames': ['aggregated_value']},
                 'rows': [['-Infinity']]},
 'segmentStatistics': [],
 'timeUsedMs': 6,
 'totalDocs': 894,
 'traceInfo': {}}
m
Hmm, I would have expected
rows
to be empty?
Given
numDocsScanned
= 0
@Jackie?
j
Yeah, sounds more logical to me too I can confirm that querying without the aggregation really yields 0 documents
j
I assume this is a
max()
aggregation?
j
@Jackie Nope, it is
AVG
j
For aggregation, when there is no record selected, Pinot returns the default aggregation result
m
Why not empty?
j
(And
SUM
returns
0.0
)
j
Because even if there is no row selected, aggregation still make sense.
SUM
of 0 record is
0.0
For
MAX
, it is `-Infinity`; For
MIN
, it is
Infinity
etc.
m
In group-by though, woud we have empty results?
j
Yes, because there is no group exists
m
If you think of output as a table, then we should return empty row for aggr only
j
@Jackie Is there any way to influence this default aggregation result ?
j
No, the default result is fixed for each aggregation
🆗 1
Seems the standard SQL behavior returns
null
in case there is no record selected
j
Would this change be desirable for Pinot ?
j
Pinot does not support real
null
yet, and
null
is always represented as a default value as of now
But we are trying to match the standard SQL behavior
👍 1
j
Even with https://docs.pinot.apache.org/developers/advanced/null-value-support ? I know (according to docs) that it's still a "partial" support, as in there's no "interaction" with aggregations etc, but it's possible to efficiently filter null values (and not mix them with real values [e.g. 0.0]), right ? Edit: Updated link
j
True, currently we only support explicit filtering on null values
✔️ 1
We don't support null values in the query responses yet
j
Yep okay So AVG with null values (without explicit filtering) will just result in the values being considered as their default (e.g. 0.0) value in the aggregation ?
j
Yes
j
Thanks @Jackie 🙂
And @Mayank
👍 1
j
The default default null values is documented here: https://docs.pinot.apache.org/basics/components/schema
👌 1
j
@Jackie And empty group aggregation results ?