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

Julian Hyde commented on CALCITE-5717:
--------------------------------------

In my dev branch for CALCITE-4334 I have created a commit that adds this 
functionality to {{RelBuilder.project}}. The summary is "RelBuilder.project of 
literals on a single-row Aggregate should create a Values". Please take a look.

> Prune Project's input if project has no InputRef and the input has 1 row
> ------------------------------------------------------------------------
>
>                 Key: CALCITE-5717
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5717
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Benchao Li
>            Assignee: Benchao Li
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.35.0
>
>
> Prune {{Project}}'s input if project has no {{RexInputRef}} and the input has 
> 1 row. The idea is to improve SQL
> {code:sql}
> select 1 from emps group by ()
> {code}
> In this case, we can safely prune the Aggregate. To be more specifically, I'm 
> proposing to match a Project -> Aggregate, and the Project has not field 
> reference from the Aggregate, and the Aggregate's grouping list is empty 
> (which means it will produce 1 row exactly), in this case, we can optimize it 
> to Project -> Values(1) to eliminate the Aggregate.
> This idea is brought up in the discussion of CALCITE-5506
> We can add this improvement to {{ProjectAggregateMergeRule}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to