You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Luis Fernando Kauer (JIRA)" <ji...@apache.org> on 2017/11/07 19:44:00 UTC

[jira] [Commented] (CALCITE-1876) Create a rule to push the projections used in aggregate functions

    [ https://issues.apache.org/jira/browse/CALCITE-1876?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16242744#comment-16242744 ] 

Luis Fernando Kauer commented on CALCITE-1876:
----------------------------------------------

Pull Request:
https://github.com/apache/calcite/pull/562

I realized that the correct plan was being generated but it was not being selected.
Solved the problem by computing the cost of CsvTableScan using the number of projects used.

> Create a rule to push the projections used in aggregate functions
> -----------------------------------------------------------------
>
>                 Key: CALCITE-1876
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1876
>             Project: Calcite
>          Issue Type: Improvement
>          Components: csv-adapter
>            Reporter: Luis Fernando Kauer
>            Assignee: Julian Hyde
>            Priority: Minor
>
> From Julian Hyde;
> "Calcite should realize that Aggregate has an implied Project (because it only uses a few columns) and push that projection into the CsvTableScan, but it doesn’t."
> A query scans only the used projection when no aggregation is used:
> sql->explain plan for select name from emps;
> CsvTableScan(table=[[SALES, EMPS]], fields=[[1]])
> But it scans all the projections when an aggregation is used:
> sql->explain plan for select max(name) from emps;
> EnumerableAggregate(group=[{}], EXPR$0=[MAX($1)])
> CsvTableScan(table=[[SALES, EMPS]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]])



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)