

Hi, in calcite, has the concept of sum0, here I quote the definition of sum0:
Sum0 is an aggregator which returns the sum of the values which
go into it like Sum. It differs in that when no non null values
are applied zero is returned instead of null..
One scenario is that we can use sum0 to implement precalculation count(precalculation system like Apache Kylin).
It is very easy in Spark to implement sum0, if community consider this is necessary, I would like to open a JIRA and implement this.

Regards!
Aron Tao


That's a horrible name. This is just a fold.
Hi, in calcite, has the concept of sum0, here I quote the definition of sum0:
Sum0 is an aggregator which returns the sum of the values which
go into it like Sum. It differs in that when no non null values
are applied zero is returned instead of null..
One scenario is that we can use sum0 to implement precalculation count(precalculation system like Apache Kylin).
It is very easy in Spark to implement sum0, if community consider this is necessary, I would like to open a JIRA and implement this.

Regards!
Aron Tao


The name is from Apache Calcite, And it doesn’t matter, we can introduce our own.
That's a horrible name. This is just a fold.
Hi, in calcite, has the concept of sum0, here I quote the definition of sum0:
Sum0 is an aggregator which returns the sum of the values which
go into it like Sum. It differs in that when no non null values
are applied zero is returned instead of null..
One scenario is that we can use sum0 to implement precalculation count(precalculation system like Apache Kylin).
It is very easy in Spark to implement sum0, if community consider this is necessary, I would like to open a JIRA and implement
this.

Regards!
Aron Tao


This is logically `sum( if(isnull(col), 0, col) )` right?
The name is from Apache Calcite, And it doesn’t matter, we can introduce our own.
That's a horrible name. This is just a fold.
Hi, in calcite, has the concept of sum0, here I quote the definition of sum0:
Sum0 is an aggregator which returns the sum of the values which
go into it like Sum. It differs in that when no non null values
are applied zero is returned instead of null..
One scenario is that we can use sum0 to implement precalculation count(precalculation system like Apache Kylin).
It is very easy in Spark to implement sum0, if community consider this is necessary, I would like to open a JIRA and implement
this.

Regards!
Aron Tao


Yes, as long as you are only talking about summing numeric values. Part of my point, though, is that this is just a special case of folding or aggregating with an initial or 'zero' value. It doesn't need to be limited to just numeric sums with zero = 0. This is logically `sum( if(isnull(col), 0, col) )` right?
The name is from Apache Calcite, And it doesn’t matter, we can introduce our own.
That's a horrible name. This is just a fold.
Hi, in calcite, has the concept of sum0, here I quote the definition of sum0:
Sum0 is an aggregator which returns the sum of the values which
go into it like Sum. It differs in that when no non null values
are applied zero is returned instead of null..
One scenario is that we can use sum0 to implement precalculation count(precalculation system like Apache Kylin).
It is very easy in Spark to implement sum0, if community consider this is necessary, I would like to open a JIRA and implement
this.

Regards!
Aron Tao

