You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2019/11/29 08:06:37 UTC

[GitHub] [incubator-doris] EmmyMiao87 commented on issue #2270: Where stmt中支持结果为非 Scalar 类型的子查询

EmmyMiao87 commented on issue #2270: Where stmt中支持结果为非 Scalar 类型的子查询
URL: https://github.com/apache/incubator-doris/issues/2270#issuecomment-559698155
 
 
   # 改进设计
   经讨论,由于之后查询层会重构,所以本次支持 TPC-DS 的语句原则为简单快速,而非通用。
   
   所以将 assert node 功能改为 assert row count node。此节点仅支持判断下层节点返回行数是否为指定行数。如果超过指定函数,则查询失败
   
   比如对于查询:
   
   ```
   select k2 from nullable_table where k1=(select k2 from nullable_table);
   ```
   
   查询规划:assert row count node 是 1,也就是下层最多有一行结果,否则查询失败。
   
   ```
   +---------------------------------------------------+
   | Explain String                                    |
   +---------------------------------------------------+
   | PLAN FRAGMENT 0                                   |
   |  OUTPUT EXPRS:`k2` |                              |
   |   PARTITION: UNPARTITIONED                        |
   |                                                   |
   |   RESULT SINK                                     |
   |                                                   |
   |   6:EXCHANGE                                      |
   |      tuple ids: 0 1                               |
   |                                                   |
   | PLAN FRAGMENT 1                                   |
   |  OUTPUT EXPRS:                                    |
   |   PARTITION: RANDOM                               |
   |                                                   |
   |   STREAM DATA SINK                                |
   |     EXCHANGE ID: 06                               |
   |     UNPARTITIONED                                 |
   |                                                   |
   |   3:HASH JOIN                                     |
   |   |  join op: LEFT SEMI JOIN (BROADCAST)          |
   |   |  hash predicates:                             |
   |   |  colocate: false, reason: Node type not match |
   | `k1` = `k2`                                       |
   |   |  tuple ids: 0 1                               |
   |   |                                               |
   |   |----5:EXCHANGE                                 |
   |   |       tuple ids: 1                            |
   |   |                                               |
   |   0:OlapScanNode                                  |
   |      TABLE: nullable_table                        |
   |      PREAGGREGATION: ON                           |
   |      partitions=1/1                               |
   |      rollup: nullable_table                       |
   |      buckets=10/10                                |
   |      cardinality=3                                |
   |      avgRowSize=1977.6666                         |
   |      numNodes=1                                   |
   |      tuple ids: 0                                 |
   |                                                   |
   | PLAN FRAGMENT 2                                   |
   |  OUTPUT EXPRS:                                    |
   |   PARTITION: UNPARTITIONED                        |
   |                                                   |
   |   STREAM DATA SINK                                |
   |     EXCHANGE ID: 05                               |
   |     UNPARTITIONED                                 |
   |                                                   |
   |   2:ASSERT ROW COUNT                              |
   |   |  assert row count: 1                          |
   |   |  tuple ids: 1                                 |
   |   |                                               |
   |   4:EXCHANGE                                      |
   |      tuple ids: 1                                 |
   |                                                   |
   | PLAN FRAGMENT 3                                   |
   |  OUTPUT EXPRS:                                    |
   |   PARTITION: RANDOM                               |
   |                                                   |
   |   STREAM DATA SINK                                |
   |     EXCHANGE ID: 04                               |
   |     UNPARTITIONED                                 |
   |                                                   |
   |   1:OlapScanNode                                  |
   |      TABLE: nullable_table                        |
   |      PREAGGREGATION: ON                           |
   |      partitions=1/1                               |
   |      rollup: nullable_table                       |
   |      buckets=10/10                                |
   |      cardinality=3                                |
   |      avgRowSize=1977.6666                         |
   |      numNodes=1                                   |
   |      tuple ids: 1                                 |
   +---------------------------------------------------+
   ```

----------------------------------------------------------------
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

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org