<@UDQU92KBK> <@UDRJ7G85T> I am looking to support ...
# pinot-dev
a
@User @User I am looking to support nulls in aggregates (a common use case for us). Is there a place where I can get prior thoughts and research, and potential starting ideas?
m
@User there has been some work done with null support in the past, perhaps we can start from where that discussion ended cc @User @User
j
@User Does putting a null filter work for your use case? E.g.
SELECT SUM(col) FROM table WHERE col IS NOT NULL
?
The main reason why we didn't directly support nulls in aggregates is because of the performance overhead of per-value null check, and forcing us to use
Object[]
instead of primitive array
a
Could we use a Sentinel value to represent NULL, per data type?
j
That is doable, but can introduce some backward incompatibility. Also, the per-value if check is not avoided. A better solution could be applying the null value bitmap for each aggregate before scanning the values. Currently we can only apply null value bitmap on query level, not on aggregate level
k
Jackie, you mean we can apply bitmap at filter phase not aggregation phase?
a
I think we can apply it inside the aggregation operator itself?
Should be a simple matter of maintaining a per aggregation bitmap (maybe within the AggregationFunction?)
k
we need to think about that a bit
its better to have the block return that
projection block should have nullvector
j
I mean we need to apply bitmap at aggregation phase in order to support multiple aggregations with different null bitmap
a
@User You mean add a bitmap to ProjectionBlock? That would be sweet
It would come in handy if we ever decided to support joins, too
k
yes, it should be a bitmap from the projectionblock
a
OK, this makes sense. Let me investigate this