How to pushdown aggregates to JDBC datasources

2017-06-01 Thread Muhammad Gelbana
​​ The following query *SELECT COUNT(**CNTRn**) FROM incorta.SLS.CNTR* Is translated to the following *SELECT COUNT("**CNTRn**") AS "EXPR$0"* *FROM (SELECT "**CNTRn**" FROM "**SLS**"."**CNTR**") AS "t"* But I want to pushdown the whole aggregation so the output query would be *SELECT COUNT("**CNT

Re: How to pushdown aggregates to JDBC datasources

2017-06-01 Thread Julian Hyde
There is already a rule that does this: JdbcRules.JdbcAggregateRule. I don’t know what DrillCalciteSqlAggFunctionWrapper is; it seems Drill-specific. > On Jun 1, 2017, at 4:20 AM, Muhammad Gelbana wrote: > > ​​ > The following query > *SELECT COUNT(**CNTRn**) FROM incorta.SLS.CNTR* > > Is tran

Re: How to pushdown aggregates to JDBC datasources

2017-06-02 Thread Muhammad Gelbana
You're correct, my mistake. Now I unwrapped this drill-specific class and converted the *LogicalAggregate* to *JdbcAggregate* my self. But the unparsed SQL is still using a subquery. Drill seems to use a custom build of Calcite v.1.4. The difference between the *implement* method of JdbcAggregate