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

Julian Hyde commented on CALCITE-4633:
--------------------------------------

Can you rewrite that query such that it reads fewer columns in the scan and 
returns the same results? I don't think you can.

Possibly you could remove {{unit_sales}} (because it might be functionally 
dependent on {{customer_id}} and {{store_id}} in that particular data set).

You could change {{count\(customer_id)}} to {{count\(*)}} and it will return 
the same result - because customer_id is not null. (In fact {{RelBuilder}} will 
do that rewrite for you.) But you'll still need to keep {{customer_id}} in the 
{{union}}.

> Enable RelFieldTrimmer to trim fields on a distinct UNION
> ---------------------------------------------------------
>
>                 Key: CALCITE-4633
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4633
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.26.0
>            Reporter: Sean Broeder
>            Assignee: Sean Broeder
>            Priority: Major
>             Fix For: 1.28.0
>
>
> Should be able to push a project to trim fields on top of distinct union 
> without changing results.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to