yangzhg opened a new pull request #2957: implement the planner for set operation
URL: https://github.com/apache/incubator-doris/pull/2957
 
 
   implemnet intersect and except planner,
   examples:
   ```
   mysql> explain select k1,k2 from t where k1='a' intersect select k1,k2 from 
t where k1='b' except select k1,k2 from t where k1='c' union all select k1,k2 
from t where k1='d';
   +----------------------------------------------------+
   | Explain String                                     |
   +----------------------------------------------------+
   | PLAN FRAGMENT 0                                    |
   |  OUTPUT EXPRS:<slot 8> | <slot 9>                  |
   |   PARTITION: UNPARTITIONED                         |
   |                                                    |
   |   RESULT SINK                                      |
   |                                                    |
   |   19:EXCHANGE                                      |
   |      tuple ids: 4                                  |
   |                                                    |
   | PLAN FRAGMENT 1                                    |
   |  OUTPUT EXPRS:                                     |
   |   PARTITION: RANDOM                                |
   |                                                    |
   |   STREAM DATA SINK                                 |
   |     EXCHANGE ID: 19                                |
   |     UNPARTITIONED                                  |
   |                                                    |
   |   7:UNION                                          |
   |   |  07:UNION                                      |
   |   |  pass-through-operands: all                    |
   |   |  tuple ids: 4                                  |
   |   |                                                |
   |   |----18:EXCHANGE                                 |
   |   |       tuple ids: 3                             |
   |   |                                                |
   |   17:EXCHANGE                                      |
   |      tuple ids: 4                                  |
   |                                                    |
   | PLAN FRAGMENT 2                                    |
   |  OUTPUT EXPRS:                                     |
   |   PARTITION: RANDOM                                |
   |                                                    |
   |   STREAM DATA SINK                                 |
   |     EXCHANGE ID: 18                                |
   |     RANDOM                                         |
   |                                                    |
   |   8:OlapScanNode                                   |
   |      TABLE: t                                      |
   |      PREAGGREGATION: OFF. Reason: No AggregateInfo |
   |      PREDICATES: `k1` = 'd'                        |
   |      partitions=1/1                                |
   |      rollup: t                                     |
   |      tabletRatio=1/10                              |
   |      tabletList=10019                              |
   |      cardinality=-1                                |
   |      avgRowSize=0.0                                |
   |      numNodes=0                                    |
   |      tuple ids: 3                                  |
   |                                                    |
   | PLAN FRAGMENT 3                                    |
   |  OUTPUT EXPRS:                                     |
   |   PARTITION: HASH_PARTITIONED: <slot 8>, <slot 9>  |
   |                                                    |
   |   STREAM DATA SINK                                 |
   |     EXCHANGE ID: 17                                |
   |     RANDOM                                         |
   |                                                    |
   |   16:AGGREGATE (merge finalize)                    |
   |   |  group by: <slot 8>, <slot 9>                  |
   |   |  tuple ids: 4                                  |
   |   |                                                |
   |   15:EXCHANGE                                      |
   |      tuple ids: 4                                  |
   |                                                    |
   | PLAN FRAGMENT 4                                    |
   |  OUTPUT EXPRS:                                     |
   |   PARTITION: RANDOM                                |
   |                                                    |
   |   STREAM DATA SINK                                 |
   |     EXCHANGE ID: 15                                |
   |     HASH_PARTITIONED: <slot 8>, <slot 9>           |
   |                                                    |
   |   6:AGGREGATE (update serialize)                   |
   |   |  STREAMING                                     |
   |   |  group by: <slot 8>, <slot 9>                  |
   |   |  tuple ids: 4                                  |
   |   |                                                |
   |   4:EXCEPT                                         |
   |   |  04:EXCEPT                                     |
   |   |  pass-through-operands: all                    |
   |   |  tuple ids: 4                                  |
   |   |                                                |
   |   |----14:EXCHANGE                                 |
   |   |       tuple ids: 2                             |
   |   |                                                |
   |   13:EXCHANGE                                      |
   |      tuple ids: 4                                  |
   |                                                    |
   | PLAN FRAGMENT 5                                    |
   |  OUTPUT EXPRS:                                     |
   |   PARTITION: RANDOM                                |
   |                                                    |
   |   STREAM DATA SINK                                 |
   |     EXCHANGE ID: 14                                |
   |     RANDOM                                         |
   |                                                    |
   |   5:OlapScanNode                                   |
   |      TABLE: t                                      |
   |      PREAGGREGATION: OFF. Reason: No AggregateInfo |
   |      PREDICATES: `k1` = 'c'                        |
   |      partitions=1/1                                |
   |      rollup: t                                     |
   |      tabletRatio=1/10                              |
   |      tabletList=10017                              |
   |      cardinality=-1                                |
   |      avgRowSize=0.0                                |
   |      numNodes=0                                    |
   |      tuple ids: 2                                  |
   |                                                    |
   | PLAN FRAGMENT 6                                    |
   |  OUTPUT EXPRS:                                     |
   |   PARTITION: HASH_PARTITIONED: <slot 8>, <slot 9>  |
   |                                                    |
   |   STREAM DATA SINK                                 |
   |     EXCHANGE ID: 13                                |
   |     RANDOM                                         |
   |                                                    |
   |   12:AGGREGATE (merge finalize)                    |
   |   |  group by: <slot 8>, <slot 9>                  |
   |   |  tuple ids: 4                                  |
   |   |                                                |
   |   11:EXCHANGE                                      |
   |      tuple ids: 4                                  |
   |                                                    |
   | PLAN FRAGMENT 7                                    |
   |  OUTPUT EXPRS:                                     |
   |   PARTITION: RANDOM                                |
   |                                                    |
   |   STREAM DATA SINK                                 |
   |     EXCHANGE ID: 11                                |
   |     HASH_PARTITIONED: <slot 8>, <slot 9>           |
   |                                                    |
   |   3:AGGREGATE (update serialize)                   |
   |   |  STREAMING                                     |
   |   |  group by: <slot 8>, <slot 9>                  |
   |   |  tuple ids: 4                                  |
   |   |                                                |
   |   0:INTERSECT                                      |
   |   |  00:INTERSECT                                  |
   |   |  pass-through-operands: all                    |
   |   |  tuple ids: 4                                  |
   |   |                                                |
   |   |----10:EXCHANGE                                 |
   |   |       tuple ids: 1                             |
   |   |                                                |
   |   9:EXCHANGE                                       |
   |      tuple ids: 0                                  |
   |                                                    |
   | PLAN FRAGMENT 8                                    |
   |  OUTPUT EXPRS:                                     |
   |   PARTITION: RANDOM                                |
   |                                                    |
   |   STREAM DATA SINK                                 |
   |     EXCHANGE ID: 10                                |
   |     RANDOM                                         |
   |                                                    |
   |   2:OlapScanNode                                   |
   |      TABLE: t                                      |
   |      PREAGGREGATION: OFF. Reason: No AggregateInfo |
   |      PREDICATES: `k1` = 'b'                        |
   |      partitions=1/1                                |
   |      rollup: t                                     |
   |      tabletRatio=1/10                              |
   |      tabletList=10009                              |
   |      cardinality=-1                                |
   |      avgRowSize=0.0                                |
   |      numNodes=0                                    |
   |      tuple ids: 1                                  |
   |                                                    |
   | PLAN FRAGMENT 9                                    |
   |  OUTPUT EXPRS:                                     |
   |   PARTITION: RANDOM                                |
   |                                                    |
   |   STREAM DATA SINK                                 |
   |     EXCHANGE ID: 09                                |
   |     RANDOM                                         |
   |                                                    |
   |   1:OlapScanNode                                   |
   |      TABLE: t                                      |
   |      PREAGGREGATION: OFF. Reason: No AggregateInfo |
   |      PREDICATES: `k1` = 'a'                        |
   |      partitions=1/1                                |
   |      rollup: t                                     |
   |      tabletRatio=1/10                              |
   |      tabletList=10021                              |
   |      cardinality=-1                                |
   |      avgRowSize=0.0                                |
   |      numNodes=0                                    |
   |      tuple ids: 0                                  |
   +----------------------------------------------------+
   189 rows in set (0.04 sec)
   
   ```

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to