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

Sean Broeder edited comment on CALCITE-4633 at 6/4/21, 8:20 PM:
----------------------------------------------------------------

I think this is the query you are proposing

select count ( * ) from
    (select "sales1"."customer_id", "sales1"."store_id", "store1"."store_name"
        from "sales_fact_1997" as "sales1"
    inner join "store" as "store1" on "sales1"."store_id" = "store1"."store_id"
    union
    select "sales2"."customer_id", "sales2"."store_id", "store2"."store_name"
        from "sales_fact_1998" as "sales2"
    inner join "store" as "store2" on "sales2"."store_id" = "store2"."store_id")

Without any changes from me it returns a different result than the first query. 
 I think more important is the changes I am proposing return the same result as 
the existing code.


was (Author: sbroeder):
I think this is the query you are proposing

select count (*) from
    (select "sales1"."customer_id", "sales1"."store_id", "store1"."store_name"
        from "sales_fact_1997" as "sales1"
    inner join "store" as "store1" on "sales1"."store_id" = "store1"."store_id"
    union
    select "sales2"."customer_id", "sales2"."store_id", "store2"."store_name"
        from "sales_fact_1998" as "sales2"
    inner join "store" as "store2" on "sales2"."store_id" = "store2"."store_id")

Without any changes from me it returns a different result than the first query. 
 I think more important is the changes I am proposing return the same result as 
the existing code.

> 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