You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/10/11 05:33:45 UTC

[GitHub] [calcite] jinxing64 opened a new pull request #1495: [CALCITE-3399] RelFieldTrimmer trim fields for UNION, INTERSECT, INTE…

jinxing64 opened a new pull request #1495: [CALCITE-3399] RelFieldTrimmer trim fields for UNION, INTERSECT, INTE…
URL: https://github.com/apache/calcite/pull/1495
 
 
   …RSECT ALL, EXCEPT, EXCEPT ALL (Jin Xing)
   
   `RelFieldTrimmer#trimFields` provides functionality to trim fields for  `UNION, UNION ALL, INTERSECT, INTERSECT ALL, EXCEPT, EXCEPT ALL`;
   
   But `UNION ALL, INTERSECT, INTERSECT ALL, EXCEPT, EXCEPT ALL` works by checking duplication. Column pruning on inputs of `SetOp` might lead to different semantics.
   
   Take below example for illustration
   ```
   emp0:
   name, deptno
    "A",       0
    "B",       1
   
   emp1:
   name, deptno
    "C",      0
    "D",      2
   
   select deptno from
   (select name, deptno from emp0
   intersect
   select name, deptno from emp1)
   ```
   
   Run above Sql on `emp0` and `emp1`, result is not empty if trim fields on inputs of `INTERSECT`, but result is empty if DO NOT trim fields on inputs of `INTERSECT`
   
   This PR proposes to trim fields only for `UNION ALL`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services