calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Hyde <>
Subject Re: Adding new drill functions to optiq syntax
Date Mon, 22 Sep 2014 20:45:33 GMT
Of course it would be nice if you provided an implementation of the aggregate functions, and
reducing aggregates to a simpler form is one of the easier ways of implementing them. But
I’m happy to accept a patch that just parses and validates them. Implementing them can wait.

Reducing aggregate functions has another benefit, even if, like Drill, you have your own implementation.
When you reduce AVG to SUM / COUNT, you have two aggregate functions that can be rolled up.
Therefore you can roll up AVG from partial results or materialized views. I believe some other
aggregate functions have similar properties when they are rewritten in terms of simpler aggregate


On Sep 22, 2014, at 1:35 PM, Yash Sharma <> wrote:

> Thanks Julian. Have created OPTIQ-421 and will submit the patch for review.
> Also wanted to ask - is the reduce aggregation required? Since its already
> being done at Drill's end?
> ReduceAggregatesRule: reduceStddev()
> Thanks
> On Tue, Sep 23, 2014 at 12:58 AM, Julian Hyde <> wrote:
>> On Sep 22, 2014, at 11:07 AM, Yash Sharma <> wrote:
>>> Am debugging Optiqand DrillOperatorTable.
>>> Strangely this works with backticks - as pointed out by Kryatal in
>>> DRILL-1441
>>> select `covar_pop`(employee_id, employee_id) FROM cp.`employee.json`
>> limit
>>> 10;
>> See my comments on REPLACE in
>> The problems relate to
>> using a non-reserved keyword as an identifier.
>> Regarding COVAR_POP. Probably something similar happening regarding
>> reserved words being. You should probably add it to ReservedFunctionName(),
>> just like VAR_POP and STDEV_POP. That is probably tricky to do in Drill —
>> so I suggest you contribute an Optiq patch. Be sure to add tests to
>> SqlOperatorBaseTest along the lines of testVarPopFunc.
>> Julian

View raw message