https://pinot.apache.org/ logo
j

Jonathan Meyer

05/24/2021, 7:59 PM
The API returns
"-Infinity"
and the Web UI shows the same
m

Mayank

05/24/2021, 8:00 PM
Can you paste the returned json?
j

Jonathan Meyer

05/24/2021, 8:01 PM
Sure
m

Mayank

05/24/2021, 8:01 PM
If no rows selected, why is there even a value being returned
1
j

Jonathan Meyer

05/24/2021, 8:02 PM
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

Mayank

05/24/2021, 8:03 PM
Hmm, I would have expected
rows
to be empty?
Given
numDocsScanned
= 0
@Jackie?
j

Jonathan Meyer

05/24/2021, 8:03 PM
Yeah, sounds more logical to me too I can confirm that querying without the aggregation really yields 0 documents
j

Jackie

05/24/2021, 8:05 PM
I assume this is a
max()
aggregation?
j

Jonathan Meyer

05/24/2021, 8:05 PM
@Jackie Nope, it is
AVG
j

Jackie

05/24/2021, 8:05 PM
For aggregation, when there is no record selected, Pinot returns the default aggregation result
m

Mayank

05/24/2021, 8:05 PM
Why not empty?
j

Jonathan Meyer

05/24/2021, 8:06 PM
(And
SUM
returns
0.0
)
j

Jackie

05/24/2021, 8:07 PM
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

Mayank

05/24/2021, 8:07 PM
In group-by though, woud we have empty results?
j

Jackie

05/24/2021, 8:08 PM
Yes, because there is no group exists
m

Mayank

05/24/2021, 8:08 PM
If you think of output as a table, then we should return empty row for aggr only
j

Jonathan Meyer

05/24/2021, 8:08 PM
@Jackie Is there any way to influence this default aggregation result ?
j

Jackie

05/24/2021, 8:10 PM
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

Jonathan Meyer

05/24/2021, 8:12 PM
Would this change be desirable for Pinot ?
j

Jackie

05/24/2021, 8:16 PM
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

Jonathan Meyer

05/24/2021, 8:18 PM
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

Jackie

05/24/2021, 8:19 PM
True, currently we only support explicit filtering on null values
✔️ 1
We don't support null values in the query responses yet
j

Jonathan Meyer

05/24/2021, 8:20 PM
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

Jackie

05/24/2021, 8:20 PM
Yes
j

Jonathan Meyer

05/24/2021, 8:21 PM
Thanks @Jackie 🙂
And @Mayank
👍 1
j

Jackie

05/24/2021, 8:21 PM
The default default null values is documented here: https://docs.pinot.apache.org/basics/components/schema
👌 1
j

Jonathan Meyer

05/24/2021, 8:22 PM
@Jackie And empty group aggregation results ?