【详述】
【背景】我们在执行sql过程中,通过分析发现分区裁剪失效
【业务影响】
【是否存算分离】是
【StarRocks版本】例如:3.3.3
【集群规模】例如:3fe(1 follower+2observer)+5be(fe与be混部)
【机器信息】CPU虚拟核/内存/网卡,例如:48C/64G/万兆
【联系方式】
【附件】
SQL:explain select count() from collect.collect_orc_user_tag_info where yyyymmdd>= days_sub(‘2024-10-08 00:00:00’, dayofweek(‘2024-10-08 00:00:00’));
这种情况发生在用dayofweek时
explain结果:
±--------------------------------------------------------------------------------------------------------------------------------------+
| Explain String |
±--------------------------------------------------------------------------------------------------------------------------------------+
| PLAN FRAGMENT 0 |
| OUTPUT EXPRS:8: count |
| PARTITION: UNPARTITIONED |
| |
| RESULT SINK |
| |
| 4:AGGREGATE (merge finalize) |
| | output: count(8: count) |
| | group by: |
| | |
| 3:EXCHANGE |
| |
| PLAN FRAGMENT 1 |
| OUTPUT EXPRS: |
| PARTITION: RANDOM |
| |
| STREAM DATA SINK |
| EXCHANGE ID: 03 |
| UNPARTITIONED |
| |
| 2:AGGREGATE (update serialize) |
| | output: count() |
| | group by: |
| | |
| 1:Project |
| | <slot 10> : 1 |
| | |
| 0:HdfsScanNode |
| TABLE: collect_orc_user_tag_info |
| PARTITION PREDICATES: CAST(6: yyyymmdd AS DATETIME) >= days_sub(‘2024-10-08 00:00:00’, dayofweek(‘2024-10-08 00:00:00’)) |
| NO EVAL-PARTITION PREDICATES: CAST(6: yyyymmdd AS DATETIME) >= days_sub(‘2024-10-08 00:00:00’, dayofweek(‘2024-10-08 00:00:00’)) |
| partitions=384/384 |
| cardinality=3648 |
| avgRowSize=3.0 |
±--------------------------------------------------------------------------------------------------------------------------------------+
34 rows in set (5.33 sec)
期望效果:能够正常进行分区裁剪,避免全部扫描