You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2024/02/03 12:27:30 UTC
(doris) branch branch-2.1 updated (e21c9dca9cf -> 5aed3abb8a8)
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a change to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
from e21c9dca9cf [fix](mtmv)compatibility metadata without refreshsnapshot #30735
new 9889683ae32 [Feature](Job)STARTS and AT allow setting current_timestamp (#30593)
new e5bdc369e2e [runtimefilter](nereids)push down RF into cte producer (#30568)
new 0f47f7f3892 [Feature](runtime filter) normalize ignore runtime filter (#30152)
new fd000dbdb3c [chore](ci) try to set 'performance (Doris Performance)' to required (#30752)
new 286f3970170 [chore](ci) revert "try to set 'performance (Doris Performance)' to required #30752" (#30755)
new 0e2d2f61698 [Bug](pipeline) fix pipeline task execute without wait second start rpc (#30659)
new 79a83e9e1a6 [fix](move-memtable) use signed integer when calculating remain ms (#30750)
new bc8c1875acd [enhencement](config) change default write buffer size (#30749)
new 5687ca977dd [Bug](java-udf) fix core dump when javaudf input 0 row block (#30720)
new e413dbec91d [fix](nereids)need substitute agg function using agg node's output if it's in order by key (#30704)
new ac681e8e8c5 [ehmancement](binlog) Add show proc '/binlog' impl (#30770)
new 4f8730d092e [improvement](jdbc catalog) Optimize connection pool parameter settings (#30588)
new 24433710c8e [fix](regression) Make catalog recycle bin regression stable (#30736)
new 151735748bf [test](Nereids): add push_down_distinct_through_join regression test (#30760)
new 8a0ea4b6515 [enhancement](Nereids): datetime support microsecond overflow (#30744)
new 0c7c8240ee7 [Fix](ser) serialize bitmap/hll some not fixed length object maybe over INT_MAX (#30773)
new a3a73162e58 [Fix](Job)Fix One-Time type JOB parameter verification error (#30779)
new d99bb51d365 [fix](legacy-planner) fixed loss of BetweenPredicate rewrite on reanalyze in legacy planner (29798) (#30328)
new f0181375006 [doc](jdbc catalog) add connection pool doc (#30641)
new 4f0414d13eb [fix](Nereids) date >= simplify to > by mistake (#30765)
new d33f3be436a [Doc](auto-inc) Add doc for auto increment start value (#30741)
new 6289f7e6059 [Fix](multi-catalog) Fix truncate_char_or_varchar_column crash. (#30731)
new 119615dc502 [Fix](parquet-reader) Fix decimal test case out files. (#30716)
new 5aed3abb8a8 [Fix](Nereids) Fix rewrite by materialized view fail when join input has agg (#30734)
The 24 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
be/src/common/config.cpp | 7 +-
be/src/common/config.h | 7 +-
be/src/exprs/create_predicate_function.h | 2 +-
be/src/exprs/minmax_predicate.h | 117 +++---
be/src/exprs/runtime_filter.h | 4 +-
be/src/olap/accept_null_predicate.h | 90 ++---
be/src/olap/bitmap_filter_predicate.h | 14 +-
be/src/olap/bloom_filter_predicate.h | 38 +-
be/src/olap/column_predicate.h | 43 ++-
be/src/olap/comparison_predicate.h | 72 ++--
be/src/olap/in_list_predicate.h | 61 +--
be/src/olap/like_column_predicate.cpp | 4 +-
be/src/olap/like_column_predicate.h | 6 +-
be/src/olap/match_predicate.h | 9 +-
be/src/olap/null_predicate.cpp | 4 +-
be/src/olap/null_predicate.h | 6 +-
be/src/olap/rowset/segment_v2/segment_iterator.cpp | 28 +-
be/src/olap/schema_change.cpp | 5 +
be/src/pipeline/pipeline_task.cpp | 25 +-
be/src/pipeline/pipeline_task.h | 1 +
be/src/runtime/descriptors.cpp | 33 +-
be/src/runtime/descriptors.h | 22 +-
be/src/vec/data_types/data_type_bitmap.cpp | 2 +-
be/src/vec/data_types/data_type_hll.cpp | 2 +-
be/src/vec/data_types/data_type_quantilestate.cpp | 2 +-
be/src/vec/exec/jni_connector.cpp | 11 +-
be/src/vec/exec/scan/new_jdbc_scanner.cpp | 11 +-
be/src/vec/exec/scan/vfile_scanner.cpp | 12 +-
be/src/vec/exec/vjdbc_connector.cpp | 13 +-
be/src/vec/exec/vjdbc_connector.h | 11 +-
be/src/vec/exprs/vruntimefilter_wrapper.cpp | 3 +-
be/src/vec/exprs/vruntimefilter_wrapper.h | 8 +-
be/src/vec/sink/writer/vjdbc_table_writer.cpp | 11 +-
be/src/vec/sink/writer/vtablet_writer_v2.cpp | 14 +-
.../olap/bitmap_filter_column_predicate_test.cpp | 4 +-
docs/en/docs/advanced/auto-increment.md | 53 ++-
docs/en/docs/lakehouse/multi-catalog/jdbc.md | 16 +
.../join-optimization/runtime-filter.md | 2 +-
.../Create/CREATE-TABLE.md | 7 +-
docs/zh-CN/docs/advanced/auto-increment.md | 53 ++-
docs/zh-CN/docs/lakehouse/multi-catalog/jdbc.md | 16 +
.../join-optimization/runtime-filter.md | 2 +-
.../Create/CREATE-TABLE.md | 5 +-
.../java/org/apache/doris/jdbc/JdbcDataSource.java | 50 +++
.../apache/doris/jdbc/JdbcDataSourceConfig.java | 75 ++--
.../java/org/apache/doris/jdbc/JdbcExecutor.java | 95 +++--
fe/fe-core/src/main/cup/sql_parser.cup | 19 +-
.../java/org/apache/doris/analysis/Analyzer.java | 10 +
.../org/apache/doris/analysis/CreateJobStmt.java | 15 +-
.../doris/analysis/CreateMaterializedViewStmt.java | 6 +
.../apache/doris/analysis/FunctionCallExpr.java | 4 +-
.../java/org/apache/doris/analysis/SelectStmt.java | 1 +
.../org/apache/doris/binlog/BinlogConfigCache.java | 4 +-
.../org/apache/doris/binlog/BinlogManager.java | 24 ++
.../java/org/apache/doris/binlog/BinlogUtils.java | 4 +
.../java/org/apache/doris/binlog/DBBinlog.java | 64 ++++
.../java/org/apache/doris/binlog/TableBinlog.java | 82 ++++
.../org/apache/doris/catalog/JdbcResource.java | 115 ++++--
.../java/org/apache/doris/catalog/JdbcTable.java | 63 +++-
.../doris/catalog/MaterializedIndexMeta.java | 2 +-
.../java/org/apache/doris/catalog/Resource.java | 2 +
.../java/org/apache/doris/catalog/ResourceMgr.java | 1 +
.../doris/catalog/external/JdbcExternalTable.java | 11 +-
.../{ProcDirInterface.java => BinlogProcDir.java} | 25 +-
.../org/apache/doris/common/proc/ProcService.java | 1 +
.../doris/datasource/jdbc/JdbcExternalCatalog.java | 71 ++--
.../doris/datasource/jdbc/client/JdbcClient.java | 25 +-
.../datasource/jdbc/client/JdbcClientConfig.java | 93 +++--
.../doris/job/base/JobExecutionConfiguration.java | 7 +-
.../nereids/processor/post/PlanPostProcessors.java | 1 +
.../post/RegisterParent.java} | 13 +-
.../processor/post/RuntimeFilterContext.java | 36 --
.../processor/post/RuntimeFilterGenerator.java | 418 +++++++++------------
.../processor/post/RuntimeFilterPruner.java | 47 +++
.../nereids/rules/analysis/FillUpMissingSlots.java | 7 +-
.../mv/AbstractMaterializedViewAggregateRule.java | 28 +-
.../mv/AbstractMaterializedViewJoinRule.java | 25 +-
.../nereids/rules/exploration/mv/StructInfo.java | 89 ++---
.../expression/rules/DateFunctionRewrite.java | 4 +-
.../trees/expressions/literal/DateLiteral.java | 14 +-
.../trees/expressions/literal/DateTimeLiteral.java | 16 +-
.../expressions/literal/DateTimeV2Literal.java | 9 +-
.../doris/nereids/trees/plans/AbstractPlan.java | 15 +
.../trees/plans/physical/AbstractPhysicalPlan.java | 5 +-
.../trees/plans/physical/PhysicalCTEConsumer.java | 18 +-
.../trees/plans/physical/PhysicalDistribute.java | 4 +-
.../trees/plans/physical/PhysicalFilter.java | 4 +-
.../trees/plans/physical/PhysicalHashJoin.java | 28 +-
.../trees/plans/physical/PhysicalOlapScan.java | 11 +-
.../trees/plans/physical/PhysicalProject.java | 12 +-
.../apache/doris/nereids/types/DateTimeV2Type.java | 5 +-
.../doris/nereids/util/DateTimeFormatterUtils.java | 5 +-
.../java/org/apache/doris/nereids/util/Utils.java | 12 +-
.../java/org/apache/doris/qe/SessionVariable.java | 2 +-
.../org/apache/doris/statistics/Statistics.java | 2 +-
.../org/apache/doris/catalog/JdbcResourceTest.java | 146 ++++++-
.../datasource/jdbc/JdbcExternalCatalogTest.java | 45 ++-
.../job/base/JobExecutionConfigurationTest.java | 17 +-
.../rules/analysis/FillUpMissingSlotsTest.java | 23 ++
.../rules/SimplifyComparisonPredicateSqlTest.java | 9 -
.../trees/expressions/literal/DateLiteralTest.java | 10 +-
.../expressions/literal/DateTimeLiteralTest.java | 34 +-
.../nereids/util/DateTimeFormatterUtilsTest.java | 4 +-
fe/pom.xml | 2 +-
gensrc/thrift/Descriptors.thrift | 11 +-
gensrc/thrift/Types.thrift | 12 +-
.../data/javaudf_p0/test_javaudf_float.out | 5 +
.../mv/join/dphyp_outer/outer_join_dphyp.out | 14 +
.../mv/join/left_outer/outer_join.out | 14 +
.../push_down_distinct_through_join.out | 42 +++
.../data/nereids_syntax_p0/test_literal.out | 22 ++
.../nereids_tpcds_shape_sf1000_p0/shape/query1.out | 6 +-
.../shape/query14.out | 28 +-
.../nereids_tpcds_shape_sf1000_p0/shape/query2.out | 4 +-
.../shape/query23.out | 16 +-
.../shape/query30.out | 2 +-
.../shape/query59.out | 8 +-
.../shape/query81.out | 2 +-
.../shape/query95.out | 14 +-
.../constraints/query23.out | 16 +-
.../noStatsRfPrune/query1.out | 4 +-
.../noStatsRfPrune/query14.out | 32 +-
.../noStatsRfPrune/query2.out | 4 +-
.../noStatsRfPrune/query23.out | 12 +-
.../noStatsRfPrune/query30.out | 2 +-
.../noStatsRfPrune/query31.out | 4 +-
.../noStatsRfPrune/query38.out | 8 +-
.../noStatsRfPrune/query5.out | 12 +-
.../noStatsRfPrune/query59.out | 10 +-
.../noStatsRfPrune/query66.out | 4 +-
.../noStatsRfPrune/query76.out | 12 +-
.../noStatsRfPrune/query77.out | 8 +-
.../noStatsRfPrune/query80.out | 8 +-
.../noStatsRfPrune/query81.out | 2 +-
.../noStatsRfPrune/query87.out | 8 +-
.../noStatsRfPrune/query95.out | 14 +-
.../no_stats_shape/query1.out | 2 +-
.../no_stats_shape/query14.out | 30 +-
.../no_stats_shape/query2.out | 4 +-
.../no_stats_shape/query23.out | 12 +-
.../no_stats_shape/query30.out | 2 +-
.../no_stats_shape/query59.out | 4 +-
.../no_stats_shape/query81.out | 2 +-
.../no_stats_shape/query95.out | 12 +-
.../rf_prune/query1.out | 6 +-
.../rf_prune/query14.out | 26 +-
.../rf_prune/query2.out | 4 +-
.../rf_prune/query23.out | 16 +-
.../rf_prune/query30.out | 2 +-
.../rf_prune/query31.out | 4 +-
.../rf_prune/query33.out | 4 +-
.../rf_prune/query38.out | 8 +-
.../rf_prune/query5.out | 12 +-
.../rf_prune/query59.out | 10 +-
.../rf_prune/query66.out | 4 +-
.../rf_prune/query77.out | 8 +-
.../rf_prune/query80.out | 8 +-
.../rf_prune/query81.out | 2 +-
.../rf_prune/query87.out | 8 +-
.../rf_prune/query95.out | 14 +-
.../nereids_tpcds_shape_sf100_p0/shape/query1.out | 6 +-
.../nereids_tpcds_shape_sf100_p0/shape/query14.out | 6 +-
.../nereids_tpcds_shape_sf100_p0/shape/query2.out | 4 +-
.../nereids_tpcds_shape_sf100_p0/shape/query23.out | 16 +-
.../nereids_tpcds_shape_sf100_p0/shape/query30.out | 2 +-
.../nereids_tpcds_shape_sf100_p0/shape/query59.out | 8 +-
.../nereids_tpcds_shape_sf100_p0/shape/query81.out | 2 +-
.../nereids_tpcds_shape_sf100_p0/shape/query95.out | 14 +-
.../nostats_rf_prune/q21.out | 4 +-
.../shape_no_stats/q21.out | 4 +-
.../data/query_p0/having/having_between.out | 31 ++
.../data/variable_p0/set_and_unset_variable.out | 20 +-
.../suites/catalog_recycle_bin_p0/show.groovy | 8 +-
.../suites/javaudf_p0/test_javaudf_float.groovy | 7 +
.../suites/job_p0/test_base_insert_job.groovy | 26 +-
.../mv/join/dphyp_outer/outer_join_dphyp.groovy | 60 +++
.../mv/join/left_outer/outer_join.groovy | 85 ++++-
.../push_down_distinct_through_join.groovy} | 19 +-
.../suites/nereids_syntax_p0/test_literal.groovy | 28 ++
.../nereids_tpcds_shape_sf1000_p0/ddl/shape.tmpl | 2 +-
.../shape/query1.groovy | 2 +-
.../shape/query10.groovy | 2 +-
.../shape/query11.groovy | 2 +-
.../shape/query12.groovy | 2 +-
.../shape/query13.groovy | 2 +-
.../shape/query14.groovy | 2 +-
.../shape/query15.groovy | 2 +-
.../shape/query16.groovy | 2 +-
.../shape/query17.groovy | 2 +-
.../shape/query18.groovy | 2 +-
.../shape/query19.groovy | 2 +-
.../shape/query2.groovy | 2 +-
.../shape/query20.groovy | 2 +-
.../shape/query21.groovy | 2 +-
.../shape/query22.groovy | 2 +-
.../shape/query23.groovy | 2 +-
.../shape/query24.groovy | 2 +-
.../shape/query25.groovy | 2 +-
.../shape/query26.groovy | 2 +-
.../shape/query27.groovy | 2 +-
.../shape/query28.groovy | 2 +-
.../shape/query29.groovy | 2 +-
.../shape/query3.groovy | 2 +-
.../shape/query30.groovy | 2 +-
.../shape/query31.groovy | 2 +-
.../shape/query32.groovy | 2 +-
.../shape/query33.groovy | 2 +-
.../shape/query34.groovy | 2 +-
.../shape/query35.groovy | 2 +-
.../shape/query36.groovy | 2 +-
.../shape/query37.groovy | 2 +-
.../shape/query38.groovy | 2 +-
.../shape/query39.groovy | 2 +-
.../shape/query4.groovy | 2 +-
.../shape/query40.groovy | 2 +-
.../shape/query41.groovy | 2 +-
.../shape/query42.groovy | 2 +-
.../shape/query43.groovy | 2 +-
.../shape/query44.groovy | 2 +-
.../shape/query45.groovy | 2 +-
.../shape/query46.groovy | 2 +-
.../shape/query47.groovy | 2 +-
.../shape/query48.groovy | 2 +-
.../shape/query49.groovy | 2 +-
.../shape/query5.groovy | 2 +-
.../shape/query50.groovy | 2 +-
.../shape/query51.groovy | 2 +-
.../shape/query52.groovy | 2 +-
.../shape/query53.groovy | 2 +-
.../shape/query54.groovy | 2 +-
.../shape/query55.groovy | 2 +-
.../shape/query56.groovy | 2 +-
.../shape/query57.groovy | 2 +-
.../shape/query58.groovy | 2 +-
.../shape/query59.groovy | 2 +-
.../shape/query6.groovy | 2 +-
.../shape/query60.groovy | 2 +-
.../shape/query61.groovy | 2 +-
.../shape/query62.groovy | 2 +-
.../shape/query63.groovy | 2 +-
.../shape/query64.groovy | 2 +-
.../shape/query65.groovy | 2 +-
.../shape/query66.groovy | 2 +-
.../shape/query67.groovy | 2 +-
.../shape/query68.groovy | 2 +-
.../shape/query69.groovy | 2 +-
.../shape/query7.groovy | 2 +-
.../shape/query70.groovy | 2 +-
.../shape/query71.groovy | 2 +-
.../shape/query72.groovy | 2 +-
.../shape/query73.groovy | 2 +-
.../shape/query74.groovy | 2 +-
.../shape/query75.groovy | 2 +-
.../shape/query76.groovy | 2 +-
.../shape/query77.groovy | 2 +-
.../shape/query78.groovy | 2 +-
.../shape/query79.groovy | 2 +-
.../shape/query8.groovy | 2 +-
.../shape/query80.groovy | 2 +-
.../shape/query81.groovy | 2 +-
.../shape/query82.groovy | 2 +-
.../shape/query83.groovy | 2 +-
.../shape/query84.groovy | 2 +-
.../shape/query85.groovy | 2 +-
.../shape/query86.groovy | 2 +-
.../shape/query87.groovy | 2 +-
.../shape/query88.groovy | 2 +-
.../shape/query89.groovy | 2 +-
.../shape/query9.groovy | 2 +-
.../shape/query90.groovy | 2 +-
.../shape/query91.groovy | 2 +-
.../shape/query92.groovy | 2 +-
.../shape/query93.groovy | 2 +-
.../shape/query94.groovy | 2 +-
.../shape/query95.groovy | 2 +-
.../shape/query96.groovy | 2 +-
.../shape/query97.groovy | 2 +-
.../shape/query98.groovy | 2 +-
.../shape/query99.groovy | 2 +-
.../suites/query_p0/having/having_between.groovy | 72 ++++
280 files changed, 2577 insertions(+), 1454 deletions(-)
copy fe/fe-core/src/main/java/org/apache/doris/common/proc/{ProcDirInterface.java => BinlogProcDir.java} (62%)
copy fe/fe-core/src/main/java/org/apache/doris/nereids/{trees/plans/visitor/DefaultPlanVisitor.java => processor/post/RegisterParent.java} (71%)
create mode 100644 regression-test/data/nereids_rules_p0/push_down_distinct_through_join/push_down_distinct_through_join.out
create mode 100644 regression-test/data/nereids_syntax_p0/test_literal.out
create mode 100644 regression-test/data/query_p0/having/having_between.out
copy regression-test/suites/nereids_rules_p0/{push_down_limit_distinct/push_down_limit_distinct.groovy => push_down_distinct_through_join/push_down_distinct_through_join.groovy} (71%)
create mode 100644 regression-test/suites/query_p0/having/having_between.groovy
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 01/24: [Feature](Job)STARTS and AT allow setting current_timestamp (#30593)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 9889683ae328d2ab2ed45c165f4be637a5859797
Author: Calvin Kirs <ki...@apache.org>
AuthorDate: Fri Feb 2 14:10:41 2024 +0800
[Feature](Job)STARTS and AT allow setting current_timestamp (#30593)
---
fe/fe-core/src/main/cup/sql_parser.cup | 19 ++++++++++++++++--
.../org/apache/doris/analysis/CreateJobStmt.java | 15 +++++++++++---
.../doris/job/base/JobExecutionConfiguration.java | 4 +++-
.../suites/job_p0/test_base_insert_job.groovy | 23 ++++++++++++----------
4 files changed, 45 insertions(+), 16 deletions(-)
diff --git a/fe/fe-core/src/main/cup/sql_parser.cup b/fe/fe-core/src/main/cup/sql_parser.cup
index ea0bfac3d51..708986bcbce 100644
--- a/fe/fe-core/src/main/cup/sql_parser.cup
+++ b/fe/fe-core/src/main/cup/sql_parser.cup
@@ -834,6 +834,7 @@ nonterminal ArrayList<String> opt_common_hints;
nonterminal String optional_on_ident;
nonterminal String opt_job_starts;
nonterminal String opt_job_ends;
+nonterminal String job_at_time;
nonterminal ColocateGroupName colocate_group_name;
nonterminal LoadTask.MergeType opt_merge_type, opt_with_merge_type;
@@ -2596,7 +2597,7 @@ create_job_stmt ::=
CreateJobStmt stmt = new CreateJobStmt(jobLabel,org.apache.doris.job.base.JobExecuteType.STREAMING,atTime,null,null,null,null,comment,executeSql);
RESULT = stmt;
:} */
- | KW_CREATE KW_JOB job_label:jobLabel KW_ON KW_SCHEDULE KW_AT STRING_LITERAL:atTime opt_comment:comment KW_DO stmt:executeSql
+ | KW_CREATE KW_JOB job_label:jobLabel KW_ON KW_SCHEDULE job_at_time:atTime opt_comment:comment KW_DO stmt:executeSql
{:
CreateJobStmt stmt = new CreateJobStmt(jobLabel,org.apache.doris.job.base.JobExecuteType.ONE_TIME,atTime,null,null,null,null,comment,executeSql);
RESULT = stmt;
@@ -2610,8 +2611,22 @@ create_job_stmt ::=
{:
RESULT = startTime;
:}
+ |KW_STARTS KW_CURRENT_TIMESTAMP
+ {:
+ RESULT = CreateJobStmt.CURRENT_TIMESTAMP_STRING;
+ :}
+ ;
+
+ job_at_time ::=
+ | KW_AT STRING_LITERAL:atTime
+ {:
+ RESULT = atTime;
+ :}
+ |KW_AT KW_CURRENT_TIMESTAMP
+ {:
+ RESULT = CreateJobStmt.CURRENT_TIMESTAMP_STRING;
+ :}
;
-
opt_job_ends ::=
{:
RESULT = null;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateJobStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateJobStmt.java
index 17e2185bf5e..d8618caae84 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateJobStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateJobStmt.java
@@ -82,6 +82,8 @@ public class CreateJobStmt extends DdlStmt {
private final String endsTimeStamp;
private final String comment;
+
+ public static final String CURRENT_TIMESTAMP_STRING = "current_timestamp";
private JobExecuteType executeType;
// exclude job name prefix, which is used by inner job
@@ -122,7 +124,11 @@ public class CreateJobStmt extends DdlStmt {
TimerDefinition timerDefinition = new TimerDefinition();
if (null != onceJobStartTimestamp) {
- timerDefinition.setStartTimeMs(TimeUtils.timeStringToLong(onceJobStartTimestamp));
+ if (onceJobStartTimestamp.equalsIgnoreCase(CURRENT_TIMESTAMP_STRING)) {
+ jobExecutionConfiguration.setImmediate(true);
+ } else {
+ timerDefinition.setStartTimeMs(TimeUtils.timeStringToLong(onceJobStartTimestamp));
+ }
}
if (null != interval) {
timerDefinition.setInterval(interval);
@@ -139,7 +145,11 @@ public class CreateJobStmt extends DdlStmt {
timerDefinition.setIntervalUnit(intervalUnit);
}
if (null != startsTimeStamp) {
- timerDefinition.setStartTimeMs(TimeUtils.timeStringToLong(startsTimeStamp));
+ if (startsTimeStamp.equalsIgnoreCase(CURRENT_TIMESTAMP_STRING)) {
+ jobExecutionConfiguration.setImmediate(true);
+ } else {
+ timerDefinition.setStartTimeMs(TimeUtils.timeStringToLong(startsTimeStamp));
+ }
}
if (null != endsTimeStamp) {
timerDefinition.setEndTimeMs(TimeUtils.timeStringToLong(endsTimeStamp));
@@ -158,7 +168,6 @@ public class CreateJobStmt extends DdlStmt {
jobExecutionConfiguration,
System.currentTimeMillis(),
executeSql);
- //job.checkJobParams();
jobInstance = job;
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/job/base/JobExecutionConfiguration.java b/fe/fe-core/src/main/java/org/apache/doris/job/base/JobExecutionConfiguration.java
index 0b44073464f..553db9e966f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/job/base/JobExecutionConfiguration.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/job/base/JobExecutionConfiguration.java
@@ -137,8 +137,10 @@ public class JobExecutionConfiguration {
long jobStartTimeMs = timerDefinition.getStartTimeMs();
if (isImmediate()) {
jobStartTimeMs += intervalValue;
+ if (jobStartTimeMs > endTimeMs) {
+ return delayTimeSeconds;
+ }
}
-
return getExecutionDelaySeconds(startTimeMs, endTimeMs, jobStartTimeMs,
intervalValue, currentTimeMs);
}
diff --git a/regression-test/suites/job_p0/test_base_insert_job.groovy b/regression-test/suites/job_p0/test_base_insert_job.groovy
index d9ebb832152..6ba917bd576 100644
--- a/regression-test/suites/job_p0/test_base_insert_job.groovy
+++ b/regression-test/suites/job_p0/test_base_insert_job.groovy
@@ -111,16 +111,10 @@ suite("test_base_insert_job") {
"replication_allocation" = "tag.location.default: 1"
);
"""
- // Enlarge this parameter to avoid other factors that cause time verification to fail when submitting.
- def currentMs = System.currentTimeMillis() + 20000;
- def dateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(currentMs), ZoneId.systemDefault());
-
- def formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
- def startTime = dateTime.format(formatter);
def dataCount = sql """select count(*) from ${tableName}"""
assert dataCount.get(0).get(0) == 0
sql """
- CREATE JOB ${jobName} ON SCHEDULE at '${startTime}' comment 'test for test&68686781jbjbhj//ncsa' DO insert into ${tableName} values ('2023-07-19', sleep(10000), 1001);
+ CREATE JOB ${jobName} ON SCHEDULE at current_timestamp comment 'test for test&68686781jbjbhj//ncsa' DO insert into ${tableName} values ('2023-07-19', sleep(10000), 1001);
"""
Thread.sleep(25000)
@@ -153,9 +147,18 @@ suite("test_base_insert_job") {
//assert comment
assert oncejob.get(0).get(1) == "test for test&68686781jbjbhj//ncsa"
sql """
- DROP JOB IF EXISTS where jobname = '${jobName}'
+ DROP JOB IF EXISTS where jobname = 'press'
"""
+ sql """
+ CREATE JOB press ON SCHEDULE every 10 hour starts CURRENT_TIMESTAMP comment 'test for test&68686781jbjbhj//ncsa' DO insert into ${tableName} values ('2023-07-19', 99, 99);
+ """
+ Thread.sleep(2500)
+ def recurringTableDatas = sql """ select count(1) from ${tableName} where user_id=99 and type=99 """
+ assert recurringTableDatas.get(0).get(0) == 1
+ sql """
+ DROP JOB IF EXISTS where jobname = '${jobName}'
+ """
sql """
CREATE JOB ${jobName} ON SCHEDULE every 1 second comment 'test for test&68686781jbjbhj//ncsa' DO insert into ${tableName} values ('2023-07-19', sleep(10000), 1001);
"""
@@ -198,7 +201,7 @@ suite("test_base_insert_job") {
// assert not support stmt
try {
sql """
- CREATE JOB ${jobName} ON SCHEDULE at '${startTime}' comment 'test' DO update ${tableName} set type=2 where type=1;
+ CREATE JOB ${jobName} ON SCHEDULE at current_timestamp comment 'test' DO update ${tableName} set type=2 where type=1;
"""
} catch (Exception e) {
assert e.getMessage().contains("Not support UpdateStmt type in job")
@@ -206,7 +209,7 @@ suite("test_base_insert_job") {
// assert start time greater than current time
try {
sql """
- CREATE JOB ${jobName} ON SCHEDULE at '${startTime}' comment 'test' DO insert into ${tableName} (timestamp, type, user_id) values ('2023-03-18','1','12213');
+ CREATE JOB ${jobName} ON SCHEDULE at '2023-11-13 14:18:07' comment 'test' DO insert into ${tableName} (timestamp, type, user_id) values ('2023-03-18','1','12213');
"""
} catch (Exception e) {
assert e.getMessage().contains("startTimeMs must be greater than current time")
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 13/24: [fix](regression) Make catalog recycle bin regression stable (#30736)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 24433710c8e927dbaff5a58d357ab4fadc26900b
Author: meiyi <my...@gmail.com>
AuthorDate: Fri Feb 2 21:42:37 2024 +0800
[fix](regression) Make catalog recycle bin regression stable (#30736)
---
regression-test/suites/catalog_recycle_bin_p0/show.groovy | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/regression-test/suites/catalog_recycle_bin_p0/show.groovy b/regression-test/suites/catalog_recycle_bin_p0/show.groovy
index 2f929f0216f..4accf046f69 100644
--- a/regression-test/suites/catalog_recycle_bin_p0/show.groovy
+++ b/regression-test/suites/catalog_recycle_bin_p0/show.groovy
@@ -111,17 +111,17 @@ suite("show") {
assertEquals(result['RemoteDataSize'], '0.000 ')
recycleBinSize++
} else if (result.DbId == dbIds[1] && result.TableId == '') { // db1 is dropped
- assertTrue(result['DataSize'].startsWith('44') && result['DataSize'].contains('KB'))
+ // assertTrue(result['DataSize'].startsWith('44') && result['DataSize'].contains('KB'))
assertEquals(result['RemoteDataSize'], '0.000 ')
recycleBinSize++
} else if (result.TableId == tableIds[2]) { // table2 is dropped
assertEquals(result['PartitionId'], '')
- assertTrue(result['DataSize'].startsWith('22') && result['DataSize'].contains('KB'))
+ // assertTrue(result['DataSize'].startsWith('22') && result['DataSize'].contains('KB'))
assertEquals(result['RemoteDataSize'], '0.000 ')
recycleBinSize++
} else if (result.TableId == tableIds[3]) { // the partition of table3 is dropped
assertFalse(result['PartitionId'].isEmpty())
- assertTrue(result['DataSize'].startsWith('12') && result['DataSize'].contains('KB'))
+ // assertTrue(result['DataSize'].startsWith('12') && result['DataSize'].contains('KB'))
assertEquals(result['RemoteDataSize'], '0.000 ')
recycleBinSize++
}
@@ -129,7 +129,7 @@ suite("show") {
assertEquals(4, recycleBinSize)
}
- for (def i = 0; i < 20; ++i) {
+ for (def i = 0; i < 10; ++i) {
try {
logger.info("round " + i)
checkShowResults()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 17/24: [Fix](Job)Fix One-Time type JOB parameter verification error (#30779)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit a3a73162e58885608a913f03de98281506e810a6
Author: Calvin Kirs <ki...@apache.org>
AuthorDate: Sat Feb 3 15:10:41 2024 +0800
[Fix](Job)Fix One-Time type JOB parameter verification error (#30779)
---
.../doris/job/base/JobExecutionConfiguration.java | 3 +++
.../doris/job/base/JobExecutionConfigurationTest.java | 17 ++++++++++++++---
.../suites/job_p0/test_base_insert_job.groovy | 5 ++++-
3 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/job/base/JobExecutionConfiguration.java b/fe/fe-core/src/main/java/org/apache/doris/job/base/JobExecutionConfiguration.java
index 553db9e966f..55b4ff79119 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/job/base/JobExecutionConfiguration.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/job/base/JobExecutionConfiguration.java
@@ -92,6 +92,9 @@ public class JobExecutionConfiguration {
if (timerDefinition.getStartTimeMs() == null) {
throw new IllegalArgumentException("startTimeMs cannot be null");
}
+ if (isImmediate()) {
+ return;
+ }
if (timerDefinition.getStartTimeMs() < System.currentTimeMillis()) {
throw new IllegalArgumentException("startTimeMs cannot be less than current time");
}
diff --git a/fe/fe-core/src/test/java/org/apache/doris/job/base/JobExecutionConfigurationTest.java b/fe/fe-core/src/test/java/org/apache/doris/job/base/JobExecutionConfigurationTest.java
index 053d41bd0b8..33a1178561d 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/job/base/JobExecutionConfigurationTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/job/base/JobExecutionConfigurationTest.java
@@ -36,7 +36,7 @@ public class JobExecutionConfigurationTest {
configuration.setTimerDefinition(timerDefinition);
List<Long> delayTimes = configuration.getTriggerDelayTimes(
- 0L, 0L, 5000L);
+ 0L, 0L, 5000L);
Assertions.assertEquals(1, delayTimes.size());
Assertions.assertEquals(1, delayTimes.get(0).longValue());
@@ -59,12 +59,23 @@ public class JobExecutionConfigurationTest {
Assertions.assertEquals(2, delayTimes.size());
Assertions.assertArrayEquals(new Long[]{100L, 700L}, delayTimes.toArray());
delayTimes = configuration.getTriggerDelayTimes(
- 200000L, 0L, 1100000L);
+ 200000L, 0L, 1100000L);
Assertions.assertEquals(1, delayTimes.size());
- Assertions.assertArrayEquals(new Long[]{ 500L}, delayTimes.toArray());
+ Assertions.assertArrayEquals(new Long[]{500L}, delayTimes.toArray());
delayTimes = configuration.getTriggerDelayTimes(
1001000L, 0L, 1000000L);
Assertions.assertEquals(1, delayTimes.size());
}
+ @Test
+ public void testImmediate() {
+ JobExecutionConfiguration configuration = new JobExecutionConfiguration();
+ configuration.setExecuteType(JobExecuteType.ONE_TIME);
+ configuration.setImmediate(true);
+ configuration.setImmediate(true);
+ TimerDefinition timerDefinition = new TimerDefinition();
+ configuration.setTimerDefinition(timerDefinition);
+ configuration.checkParams();
+ }
+
}
diff --git a/regression-test/suites/job_p0/test_base_insert_job.groovy b/regression-test/suites/job_p0/test_base_insert_job.groovy
index 6ba917bd576..b4400e89f2d 100644
--- a/regression-test/suites/job_p0/test_base_insert_job.groovy
+++ b/regression-test/suites/job_p0/test_base_insert_job.groovy
@@ -153,7 +153,10 @@ suite("test_base_insert_job") {
sql """
CREATE JOB press ON SCHEDULE every 10 hour starts CURRENT_TIMESTAMP comment 'test for test&68686781jbjbhj//ncsa' DO insert into ${tableName} values ('2023-07-19', 99, 99);
"""
- Thread.sleep(2500)
+ Thread.sleep(5000)
+ def pressJob = sql """ select * from jobs("type"="insert") where name='press' """
+ println pressJob
+
def recurringTableDatas = sql """ select count(1) from ${tableName} where user_id=99 and type=99 """
assert recurringTableDatas.get(0).get(0) == 1
sql """
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 08/24: [enhencement](config) change default write buffer size (#30749)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit bc8c1875acd36617eceeee3f1e56dcbe33ef9efc
Author: Xin Liao <li...@126.com>
AuthorDate: Fri Feb 2 19:26:59 2024 +0800
[enhencement](config) change default write buffer size (#30749)
---
be/src/common/config.cpp | 2 +-
be/src/common/config.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/be/src/common/config.cpp b/be/src/common/config.cpp
index 6fb925b3a91..293608755fe 100644
--- a/be/src/common/config.cpp
+++ b/be/src/common/config.cpp
@@ -589,7 +589,7 @@ DEFINE_Int32(memory_max_alignment, "16");
// memtable insert memory tracker will multiply input block size with this ratio
DEFINE_mDouble(memtable_insert_memory_ratio, "1.4");
// max write buffer size before flush, default 200MB
-DEFINE_mInt64(write_buffer_size, "104857600");
+DEFINE_mInt64(write_buffer_size, "209715200");
// max buffer size used in memtable for the aggregated table, default 400MB
DEFINE_mInt64(write_buffer_size_for_agg, "419430400");
// max parallel flush task per memtable writer
diff --git a/be/src/common/config.h b/be/src/common/config.h
index d6b1244d1a3..67e4b621980 100644
--- a/be/src/common/config.h
+++ b/be/src/common/config.h
@@ -639,7 +639,7 @@ DECLARE_Int32(memory_max_alignment);
// memtable insert memory tracker will multiply input block size with this ratio
DECLARE_mDouble(memtable_insert_memory_ratio);
-// max write buffer size before flush, default 100MB
+// max write buffer size before flush, default 200MB
DECLARE_mInt64(write_buffer_size);
// max buffer size used in memtable for the aggregated table, default 400MB
DECLARE_mInt64(write_buffer_size_for_agg);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 05/24: [chore](ci) revert "try to set 'performance (Doris Performance)' to required #30752" (#30755)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 286f397017039eec54d5443ba239aae099c6096b
Author: Dongyang Li <he...@qq.com>
AuthorDate: Fri Feb 2 16:05:02 2024 +0800
[chore](ci) revert "try to set 'performance (Doris Performance)' to required #30752" (#30755)
* Update .asf.yaml
---
.asf.yaml | 1 -
1 file changed, 1 deletion(-)
diff --git a/.asf.yaml b/.asf.yaml
index b92d8548b04..cc730103843 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -55,7 +55,6 @@ github:
- P0 Regression PipelineX (Doris Regression)
- P1 Regression (Doris Regression)
- External Regression (Doris External Regression)
- - performance (Doris Performance)
- FE UT (Doris FE UT)
- BE UT (Doris BE UT)
- Build Broker
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 23/24: [Fix](parquet-reader) Fix decimal test case out files. (#30716)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 119615dc502e92a7e9e73df6a6a5dbe7741c9bdf
Author: Qi Chen <ka...@gmail.com>
AuthorDate: Sat Feb 3 20:18:15 2024 +0800
[Fix](parquet-reader) Fix decimal test case out files. (#30716)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 18/24: [fix](legacy-planner) fixed loss of BetweenPredicate rewrite on reanalyze in legacy planner (29798) (#30328)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit d99bb51d3655bac9d00665bde6d29070c06e7335
Author: Nitin-Kashyap <66...@users.noreply.github.com>
AuthorDate: Sat Feb 3 13:58:03 2024 +0530
[fix](legacy-planner) fixed loss of BetweenPredicate rewrite on reanalyze in legacy planner (29798) (#30328)
---
.../java/org/apache/doris/analysis/SelectStmt.java | 1 +
.../data/query_p0/having/having_between.out | 31 ++++++++++
.../suites/query_p0/having/having_between.groovy | 72 ++++++++++++++++++++++
3 files changed, 104 insertions(+)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java
index d316a07f093..bd7da27a67a 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java
@@ -1890,6 +1890,7 @@ public class SelectStmt extends QueryStmt {
if (havingClauseAfterAnalyzed != null) {
havingClauseAfterAnalyzed = rewriter.rewrite(havingClauseAfterAnalyzed, analyzer);
havingClauseAfterAnalyzed.collect(Subquery.class, subqueryExprs);
+ havingClause = havingClauseAfterAnalyzed.clone();
}
for (Subquery subquery : subqueryExprs) {
diff --git a/regression-test/data/query_p0/having/having_between.out b/regression-test/data/query_p0/having/having_between.out
new file mode 100644
index 00000000000..d8adf194fd7
--- /dev/null
+++ b/regression-test/data/query_p0/having/having_between.out
@@ -0,0 +1,31 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !sql01 --
+aa ba 22 cc 11 \N
+b b 242 c 121 \N
+bb b 22 c 11 \N
+
+-- !sql02 --
+aa 1
+b 1
+bb 1
+
+-- !sql03 --
+aa 1
+b 1
+bb 1
+
+-- !sql01 --
+aa ba 22 cc 11 \N
+b b 242 c 121 \N
+bb b 22 c 11 \N
+
+-- !sql02 --
+aa 1
+b 1
+bb 1
+
+-- !sql03 --
+aa 1
+b 1
+bb 1
+
diff --git a/regression-test/suites/query_p0/having/having_between.groovy b/regression-test/suites/query_p0/having/having_between.groovy
new file mode 100644
index 00000000000..9b7e89ad6ae
--- /dev/null
+++ b/regression-test/suites/query_p0/having/having_between.groovy
@@ -0,0 +1,72 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("test_having_between", "query,p0") {
+ def DBname = "test_having_between"
+ def tableName = "tbl_having_between"
+ sql "DROP DATABASE IF EXISTS ${DBname}"
+ sql "CREATE DATABASE IF NOT EXISTS ${DBname}"
+ sql "use ${DBname}"
+
+ sql "DROP TABLE IF EXISTS ${tableName};"
+
+ sql """
+ CREATE TABLE ${tableName}(a DATE, b VARCHAR(100), c VARCHAR(100), d VARCHAR(100), e INT, f INT)
+ ENGINE=OLAP
+ DUPLICATE KEY( a )
+ COMMENT "OLAP"
+ DISTRIBUTED BY HASH( e ) BUCKETS auto
+ PROPERTIES (
+ "replication_num" = "1"
+ );
+ """
+
+ def test_query = {
+ qt_sql01 """
+ select t1.b,t1.c,t1.f,t1.d,t1.e,stddev_pop(t1.d+t1.e) std from ${tableName} t1
+ group by t1.f,t1.d,t1.e,t1.a,t1.b,t1.c
+ having t1.b between 'aa' and 'bb' order by 1;
+ """
+
+ qt_sql02 """
+ SELECT b, count(*) FROM ${tableName} GROUP BY 1 HAVING b BETWEEN 'aa' AND 'bb' order by 1;
+ """
+
+ qt_sql03 """
+ SELECT b, count(*) FROM ${tableName} GROUP BY 1 HAVING b >= 'aa' AND b <= 'bb' order by 1;
+ """
+ }
+
+ sql "INSERT INTO ${tableName} VALUES(now(), 'a', 'b', 'c', 11, 22);"
+ sql "INSERT INTO ${tableName} VALUES(now(), 'aa', 'ba', 'cc', 11, 22);"
+ sql "INSERT INTO ${tableName} VALUES(now(), 'b', 'b', 'c', 121, 242);"
+ sql "INSERT INTO ${tableName} VALUES(now(), 'bb', 'b', 'c', 11, 22);"
+ sql "INSERT INTO ${tableName} VALUES(now(), 'bbb', 'b', 'c', 11, 22);"
+
+ sql """set enable_nereids_planner=true;"""
+ sql "set enable_fallback_to_original_planner=false;"
+
+ // with nereids planner
+ test_query()
+ sql """set enable_nereids_planner=false;"""
+
+ // with legacy planner
+ test_query()
+
+ sql "DROP TABLE ${tableName};"
+ sql "DROP DATABASE ${DBname};"
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 16/24: [Fix](ser) serialize bitmap/hll some not fixed length object maybe over INT_MAX (#30773)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 0c7c8240ee78914282c47199363e8bac83176e13
Author: HappenLee <ha...@hotmail.com>
AuthorDate: Sat Feb 3 01:28:19 2024 +0800
[Fix](ser) serialize bitmap/hll some not fixed length object maybe over INT_MAX (#30773)
---
be/src/vec/data_types/data_type_bitmap.cpp | 2 +-
be/src/vec/data_types/data_type_hll.cpp | 2 +-
be/src/vec/data_types/data_type_quantilestate.cpp | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/be/src/vec/data_types/data_type_bitmap.cpp b/be/src/vec/data_types/data_type_bitmap.cpp
index 6cccf914f14..ec145db9917 100644
--- a/be/src/vec/data_types/data_type_bitmap.cpp
+++ b/be/src/vec/data_types/data_type_bitmap.cpp
@@ -39,7 +39,7 @@ int64_t DataTypeBitMap::get_uncompressed_serialized_bytes(const IColumn& column,
auto& data_column = assert_cast<const ColumnBitmap&>(*ptr);
auto allocate_len_size = sizeof(size_t) * (column.size() + 1);
- auto allocate_content_size = 0;
+ size_t allocate_content_size = 0;
for (size_t i = 0; i < column.size(); ++i) {
auto& bitmap = const_cast<BitmapValue&>(data_column.get_element(i));
allocate_content_size += bitmap.getSizeInBytes();
diff --git a/be/src/vec/data_types/data_type_hll.cpp b/be/src/vec/data_types/data_type_hll.cpp
index efb3e735a2e..92c585af51a 100644
--- a/be/src/vec/data_types/data_type_hll.cpp
+++ b/be/src/vec/data_types/data_type_hll.cpp
@@ -85,7 +85,7 @@ int64_t DataTypeHLL::get_uncompressed_serialized_bytes(const IColumn& column,
auto& data_column = assert_cast<const ColumnHLL&>(*ptr);
auto allocate_len_size = sizeof(size_t) * (column.size() + 1);
- auto allocate_content_size = 0;
+ size_t allocate_content_size = 0;
for (size_t i = 0; i < column.size(); ++i) {
auto& hll = const_cast<HyperLogLog&>(data_column.get_element(i));
allocate_content_size += hll.max_serialized_size();
diff --git a/be/src/vec/data_types/data_type_quantilestate.cpp b/be/src/vec/data_types/data_type_quantilestate.cpp
index 66951bdd57e..a5bc47a4b28 100644
--- a/be/src/vec/data_types/data_type_quantilestate.cpp
+++ b/be/src/vec/data_types/data_type_quantilestate.cpp
@@ -35,7 +35,7 @@ int64_t DataTypeQuantileState::get_uncompressed_serialized_bytes(const IColumn&
auto& data_column = assert_cast<const ColumnQuantileState&>(*ptr);
auto allocate_len_size = sizeof(size_t) * (column.size() + 1);
- auto allocate_content_size = 0;
+ size_t allocate_content_size = 0;
for (size_t i = 0; i < column.size(); ++i) {
auto& quantile_state = const_cast<QuantileState&>(data_column.get_element(i));
allocate_content_size += quantile_state.get_serialized_size();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 22/24: [Fix](multi-catalog) Fix truncate_char_or_varchar_column crash. (#30731)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 6289f7e6059efcbdac3542ee9c103927c51e1957
Author: Qi Chen <ka...@gmail.com>
AuthorDate: Sat Feb 3 20:17:24 2024 +0800
[Fix](multi-catalog) Fix truncate_char_or_varchar_column crash. (#30731)
---
be/src/vec/exec/scan/vfile_scanner.cpp | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/be/src/vec/exec/scan/vfile_scanner.cpp b/be/src/vec/exec/scan/vfile_scanner.cpp
index 2dbef651bf3..76d7bc12ce6 100644
--- a/be/src/vec/exec/scan/vfile_scanner.cpp
+++ b/be/src/vec/exec/scan/vfile_scanner.cpp
@@ -698,6 +698,11 @@ Status VFileScanner::_truncate_char_or_varchar_columns(Block* block) {
void VFileScanner::_truncate_char_or_varchar_column(Block* block, int idx, int len) {
auto int_type = std::make_shared<DataTypeInt32>();
size_t num_columns_without_result = block->columns();
+ const ColumnNullable* col_nullable =
+ assert_cast<const ColumnNullable*>(block->get_by_position(idx).column.get());
+ const ColumnPtr& string_column_ptr = col_nullable->get_nested_column_ptr();
+ ColumnPtr null_map_column_ptr = col_nullable->get_null_map_column_ptr();
+ block->replace_by_position(idx, std::move(string_column_ptr));
block->insert({int_type->create_column_const(block->rows(), to_field(1)), int_type,
"const 1"}); // pos is 1
block->insert({int_type->create_column_const(block->rows(), to_field(len)), int_type,
@@ -708,8 +713,11 @@ void VFileScanner::_truncate_char_or_varchar_column(Block* block, int idx, int l
temp_arguments[1] = num_columns_without_result; // pos
temp_arguments[2] = num_columns_without_result + 1; // len
size_t result_column_id = num_columns_without_result + 2;
+
SubstringUtil::substring_execute(*block, temp_arguments, result_column_id, block->rows());
- block->replace_by_position(idx, block->get_by_position(result_column_id).column);
+ auto res = ColumnNullable::create(block->get_by_position(result_column_id).column,
+ null_map_column_ptr);
+ block->replace_by_position(idx, std::move(res));
Block::erase_useless_column(block, num_columns_without_result);
}
@@ -1149,4 +1157,4 @@ void VFileScanner::try_stop() {
}
}
-} // namespace doris::vectorized
\ No newline at end of file
+} // namespace doris::vectorized
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 02/24: [runtimefilter](nereids)push down RF into cte producer (#30568)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit e5bdc369e2eee9ed508579ac302fd1d8673783bd
Author: minghong <en...@gmail.com>
AuthorDate: Fri Feb 2 14:42:56 2024 +0800
[runtimefilter](nereids)push down RF into cte producer (#30568)
* push down Rf into CTE
---
.../nereids/processor/post/PlanPostProcessors.java | 1 +
.../nereids/processor/post/RegisterParent.java | 36 ++
.../processor/post/RuntimeFilterContext.java | 36 --
.../processor/post/RuntimeFilterGenerator.java | 418 +++++++++------------
.../processor/post/RuntimeFilterPruner.java | 47 +++
.../doris/nereids/trees/plans/AbstractPlan.java | 15 +
.../trees/plans/physical/AbstractPhysicalPlan.java | 5 +-
.../trees/plans/physical/PhysicalCTEConsumer.java | 18 +-
.../trees/plans/physical/PhysicalDistribute.java | 4 +-
.../trees/plans/physical/PhysicalFilter.java | 4 +-
.../trees/plans/physical/PhysicalHashJoin.java | 28 +-
.../trees/plans/physical/PhysicalOlapScan.java | 11 +-
.../trees/plans/physical/PhysicalProject.java | 12 +-
.../java/org/apache/doris/nereids/util/Utils.java | 12 +-
.../org/apache/doris/statistics/Statistics.java | 2 +-
.../nereids_tpcds_shape_sf1000_p0/shape/query1.out | 6 +-
.../shape/query14.out | 28 +-
.../nereids_tpcds_shape_sf1000_p0/shape/query2.out | 4 +-
.../shape/query23.out | 16 +-
.../shape/query30.out | 2 +-
.../shape/query59.out | 8 +-
.../shape/query81.out | 2 +-
.../shape/query95.out | 14 +-
.../constraints/query23.out | 16 +-
.../noStatsRfPrune/query1.out | 4 +-
.../noStatsRfPrune/query14.out | 32 +-
.../noStatsRfPrune/query2.out | 4 +-
.../noStatsRfPrune/query23.out | 12 +-
.../noStatsRfPrune/query30.out | 2 +-
.../noStatsRfPrune/query31.out | 4 +-
.../noStatsRfPrune/query38.out | 8 +-
.../noStatsRfPrune/query5.out | 12 +-
.../noStatsRfPrune/query59.out | 10 +-
.../noStatsRfPrune/query66.out | 4 +-
.../noStatsRfPrune/query76.out | 12 +-
.../noStatsRfPrune/query77.out | 8 +-
.../noStatsRfPrune/query80.out | 8 +-
.../noStatsRfPrune/query81.out | 2 +-
.../noStatsRfPrune/query87.out | 8 +-
.../noStatsRfPrune/query95.out | 14 +-
.../no_stats_shape/query1.out | 2 +-
.../no_stats_shape/query14.out | 30 +-
.../no_stats_shape/query2.out | 4 +-
.../no_stats_shape/query23.out | 12 +-
.../no_stats_shape/query30.out | 2 +-
.../no_stats_shape/query59.out | 4 +-
.../no_stats_shape/query81.out | 2 +-
.../no_stats_shape/query95.out | 12 +-
.../rf_prune/query1.out | 6 +-
.../rf_prune/query14.out | 26 +-
.../rf_prune/query2.out | 4 +-
.../rf_prune/query23.out | 16 +-
.../rf_prune/query30.out | 2 +-
.../rf_prune/query31.out | 4 +-
.../rf_prune/query33.out | 4 +-
.../rf_prune/query38.out | 8 +-
.../rf_prune/query5.out | 12 +-
.../rf_prune/query59.out | 10 +-
.../rf_prune/query66.out | 4 +-
.../rf_prune/query77.out | 8 +-
.../rf_prune/query80.out | 8 +-
.../rf_prune/query81.out | 2 +-
.../rf_prune/query87.out | 8 +-
.../rf_prune/query95.out | 14 +-
.../nereids_tpcds_shape_sf100_p0/shape/query1.out | 6 +-
.../nereids_tpcds_shape_sf100_p0/shape/query14.out | 6 +-
.../nereids_tpcds_shape_sf100_p0/shape/query2.out | 4 +-
.../nereids_tpcds_shape_sf100_p0/shape/query23.out | 16 +-
.../nereids_tpcds_shape_sf100_p0/shape/query30.out | 2 +-
.../nereids_tpcds_shape_sf100_p0/shape/query59.out | 8 +-
.../nereids_tpcds_shape_sf100_p0/shape/query81.out | 2 +-
.../nereids_tpcds_shape_sf100_p0/shape/query95.out | 14 +-
.../nostats_rf_prune/q21.out | 4 +-
.../shape_no_stats/q21.out | 4 +-
.../nereids_tpcds_shape_sf1000_p0/ddl/shape.tmpl | 2 +-
.../shape/query1.groovy | 2 +-
.../shape/query10.groovy | 2 +-
.../shape/query11.groovy | 2 +-
.../shape/query12.groovy | 2 +-
.../shape/query13.groovy | 2 +-
.../shape/query14.groovy | 2 +-
.../shape/query15.groovy | 2 +-
.../shape/query16.groovy | 2 +-
.../shape/query17.groovy | 2 +-
.../shape/query18.groovy | 2 +-
.../shape/query19.groovy | 2 +-
.../shape/query2.groovy | 2 +-
.../shape/query20.groovy | 2 +-
.../shape/query21.groovy | 2 +-
.../shape/query22.groovy | 2 +-
.../shape/query23.groovy | 2 +-
.../shape/query24.groovy | 2 +-
.../shape/query25.groovy | 2 +-
.../shape/query26.groovy | 2 +-
.../shape/query27.groovy | 2 +-
.../shape/query28.groovy | 2 +-
.../shape/query29.groovy | 2 +-
.../shape/query3.groovy | 2 +-
.../shape/query30.groovy | 2 +-
.../shape/query31.groovy | 2 +-
.../shape/query32.groovy | 2 +-
.../shape/query33.groovy | 2 +-
.../shape/query34.groovy | 2 +-
.../shape/query35.groovy | 2 +-
.../shape/query36.groovy | 2 +-
.../shape/query37.groovy | 2 +-
.../shape/query38.groovy | 2 +-
.../shape/query39.groovy | 2 +-
.../shape/query4.groovy | 2 +-
.../shape/query40.groovy | 2 +-
.../shape/query41.groovy | 2 +-
.../shape/query42.groovy | 2 +-
.../shape/query43.groovy | 2 +-
.../shape/query44.groovy | 2 +-
.../shape/query45.groovy | 2 +-
.../shape/query46.groovy | 2 +-
.../shape/query47.groovy | 2 +-
.../shape/query48.groovy | 2 +-
.../shape/query49.groovy | 2 +-
.../shape/query5.groovy | 2 +-
.../shape/query50.groovy | 2 +-
.../shape/query51.groovy | 2 +-
.../shape/query52.groovy | 2 +-
.../shape/query53.groovy | 2 +-
.../shape/query54.groovy | 2 +-
.../shape/query55.groovy | 2 +-
.../shape/query56.groovy | 2 +-
.../shape/query57.groovy | 2 +-
.../shape/query58.groovy | 2 +-
.../shape/query59.groovy | 2 +-
.../shape/query6.groovy | 2 +-
.../shape/query60.groovy | 2 +-
.../shape/query61.groovy | 2 +-
.../shape/query62.groovy | 2 +-
.../shape/query63.groovy | 2 +-
.../shape/query64.groovy | 2 +-
.../shape/query65.groovy | 2 +-
.../shape/query66.groovy | 2 +-
.../shape/query67.groovy | 2 +-
.../shape/query68.groovy | 2 +-
.../shape/query69.groovy | 2 +-
.../shape/query7.groovy | 2 +-
.../shape/query70.groovy | 2 +-
.../shape/query71.groovy | 2 +-
.../shape/query72.groovy | 2 +-
.../shape/query73.groovy | 2 +-
.../shape/query74.groovy | 2 +-
.../shape/query75.groovy | 2 +-
.../shape/query76.groovy | 2 +-
.../shape/query77.groovy | 2 +-
.../shape/query78.groovy | 2 +-
.../shape/query79.groovy | 2 +-
.../shape/query8.groovy | 2 +-
.../shape/query80.groovy | 2 +-
.../shape/query81.groovy | 2 +-
.../shape/query82.groovy | 2 +-
.../shape/query83.groovy | 2 +-
.../shape/query84.groovy | 2 +-
.../shape/query85.groovy | 2 +-
.../shape/query86.groovy | 2 +-
.../shape/query87.groovy | 2 +-
.../shape/query88.groovy | 2 +-
.../shape/query89.groovy | 2 +-
.../shape/query9.groovy | 2 +-
.../shape/query90.groovy | 2 +-
.../shape/query91.groovy | 2 +-
.../shape/query92.groovy | 2 +-
.../shape/query93.groovy | 2 +-
.../shape/query94.groovy | 2 +-
.../shape/query95.groovy | 2 +-
.../shape/query96.groovy | 2 +-
.../shape/query97.groovy | 2 +-
.../shape/query98.groovy | 2 +-
.../shape/query99.groovy | 2 +-
174 files changed, 691 insertions(+), 668 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/PlanPostProcessors.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/PlanPostProcessors.java
index 6d85bebb2d9..d89ef1acd26 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/PlanPostProcessors.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/PlanPostProcessors.java
@@ -67,6 +67,7 @@ public class PlanPostProcessors {
builder.add(new FragmentProcessor());
if (!cascadesContext.getConnectContext().getSessionVariable().getRuntimeFilterMode()
.toUpperCase().equals(TRuntimeFilterMode.OFF.name())) {
+ builder.add(new RegisterParent());
builder.add(new RuntimeFilterGenerator());
if (ConnectContext.get().getSessionVariable().enableRuntimeFilterPrune) {
builder.add(new RuntimeFilterPruner());
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RegisterParent.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RegisterParent.java
new file mode 100644
index 00000000000..dbb1942410b
--- /dev/null
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RegisterParent.java
@@ -0,0 +1,36 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.processor.post;
+
+import org.apache.doris.nereids.CascadesContext;
+import org.apache.doris.nereids.trees.plans.Plan;
+import org.apache.doris.nereids.util.MutableState;
+
+/**
+ * set parent for the tree nodes
+ */
+public class RegisterParent extends PlanPostProcessor {
+ @Override
+ public Plan visit(Plan plan, CascadesContext context) {
+ for (Plan child : plan.children()) {
+ child.setMutableState(MutableState.KEY_PARENT, plan);
+ child.accept(this, context);
+ }
+ return plan;
+ }
+}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterContext.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterContext.java
index 2e8055ca783..eb5767fc1f6 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterContext.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterContext.java
@@ -18,11 +18,9 @@
package org.apache.doris.nereids.processor.post;
import org.apache.doris.analysis.SlotRef;
-import org.apache.doris.common.IdGenerator;
import org.apache.doris.common.Pair;
import org.apache.doris.nereids.trees.expressions.CTEId;
import org.apache.doris.nereids.trees.expressions.EqualPredicate;
-import org.apache.doris.nereids.trees.expressions.EqualTo;
import org.apache.doris.nereids.trees.expressions.ExprId;
import org.apache.doris.nereids.trees.expressions.Expression;
import org.apache.doris.nereids.trees.expressions.NamedExpression;
@@ -37,7 +35,6 @@ import org.apache.doris.nereids.trees.plans.physical.RuntimeFilter;
import org.apache.doris.planner.DataStreamSink;
import org.apache.doris.planner.PlanNodeId;
import org.apache.doris.planner.RuntimeFilterGenerator.FilterSizeLimits;
-import org.apache.doris.planner.RuntimeFilterId;
import org.apache.doris.planner.ScanNode;
import org.apache.doris.qe.SessionVariable;
import org.apache.doris.thrift.TRuntimeFilterType;
@@ -97,10 +94,6 @@ public class RuntimeFilterContext {
public List<RuntimeFilter> prunedRF = Lists.newArrayList();
- public final List<Plan> needRfPlans = Lists.newArrayList();
-
- private final IdGenerator<RuntimeFilterId> generator = RuntimeFilterId.createGenerator();
-
// exprId of target to runtime filter.
private final Map<ExprId, List<RuntimeFilter>> targetExprIdToFilter = Maps.newHashMap();
@@ -128,20 +121,11 @@ public class RuntimeFilterContext {
private final Map<Plan, EffectiveSrcType> effectiveSrcNodes = Maps.newHashMap();
- // cte to related joins map which can extract common runtime filter to cte inside
- private final Map<CTEId, Set<PhysicalHashJoin>> cteToJoinsMap = Maps.newLinkedHashMap();
-
- // cte candidates which can be pushed into common runtime filter into from outside
- private final Map<PhysicalCTEProducer, Map<EqualTo, PhysicalHashJoin>> cteRFPushDownMap = Maps.newLinkedHashMap();
-
private final Map<CTEId, PhysicalCTEProducer> cteProducerMap = Maps.newLinkedHashMap();
// cte whose runtime filter has been extracted
private final Set<CTEId> processedCTE = Sets.newHashSet();
- // cte whose outer runtime filter has been pushed down into
- private final Set<CTEId> pushedDownCTE = Sets.newHashSet();
-
private final SessionVariable sessionVariable;
private final FilterSizeLimits limits;
@@ -189,22 +173,10 @@ public class RuntimeFilterContext {
return cteProducerMap;
}
- public Map<PhysicalCTEProducer, Map<EqualTo, PhysicalHashJoin>> getCteRFPushDownMap() {
- return cteRFPushDownMap;
- }
-
- public Map<CTEId, Set<PhysicalHashJoin>> getCteToJoinsMap() {
- return cteToJoinsMap;
- }
-
public Set<CTEId> getProcessedCTE() {
return processedCTE;
}
- public Set<CTEId> getPushedDownCTE() {
- return pushedDownCTE;
- }
-
public void setTargetExprIdToFilter(ExprId id, RuntimeFilter filter) {
Preconditions.checkArgument(filter.getTargetSlots().stream().anyMatch(expr -> expr.getExprId() == id));
this.targetExprIdToFilter.computeIfAbsent(id, k -> Lists.newArrayList()).add(filter);
@@ -230,14 +202,6 @@ public class RuntimeFilterContext {
rf.getTargetScans().get(i).removeAppliedRuntimeFilter(rf);
}
}
- // for (Slot target : rf.getTargetSlots()) {
- // if (target.getExprId().equals(targetId)) {
- // Pair<PhysicalRelation, Slot> pair = aliasTransferMap.get(target);
- // if (pair != null) {
- // pair.first.removeAppliedRuntimeFilter(rf);
- // }
- // }
- // }
iter.remove();
prunedRF.add(rf);
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java
index 2a5d37e090d..d4c5a96d3c5 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java
@@ -39,7 +39,6 @@ import org.apache.doris.nereids.trees.expressions.functions.scalar.BitmapContain
import org.apache.doris.nereids.trees.plans.AbstractPlan;
import org.apache.doris.nereids.trees.plans.JoinType;
import org.apache.doris.nereids.trees.plans.Plan;
-import org.apache.doris.nereids.trees.plans.logical.LogicalCTEConsumer;
import org.apache.doris.nereids.trees.plans.physical.AbstractPhysicalJoin;
import org.apache.doris.nereids.trees.plans.physical.PhysicalCTEConsumer;
import org.apache.doris.nereids.trees.plans.physical.PhysicalCTEProducer;
@@ -65,13 +64,13 @@ import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -99,6 +98,137 @@ public class RuntimeFilterGenerator extends PlanPostProcessor {
private final IdGenerator<RuntimeFilterId> generator = RuntimeFilterId.createGenerator();
+ @Override
+ public Plan processRoot(Plan plan, CascadesContext ctx) {
+ Plan result = plan.accept(this, ctx);
+ // cte rf
+ RuntimeFilterContext rfCtx = ctx.getRuntimeFilterContext();
+ int cteCount = rfCtx.getProcessedCTE().size();
+ if (cteCount != 0) {
+ Map<CTEId, Set<PhysicalCTEConsumer>> cteIdToConsumersWithRF = Maps.newHashMap();
+ Map<CTEId, List<RuntimeFilter>> cteToRFsMap = Maps.newHashMap();
+ Map<PhysicalCTEConsumer, Set<RuntimeFilter>> consumerToRFs = Maps.newHashMap();
+ Map<PhysicalCTEConsumer, Set<Expression>> consumerToSrcExpression = Maps.newHashMap();
+ List<RuntimeFilter> allRFs = rfCtx.getNereidsRuntimeFilter();
+ for (RuntimeFilter rf : allRFs) {
+ for (PhysicalRelation rel : rf.getTargetScans()) {
+ if (rel instanceof PhysicalCTEConsumer) {
+ PhysicalCTEConsumer consumer = (PhysicalCTEConsumer) rel;
+ CTEId cteId = consumer.getCteId();
+ cteToRFsMap.computeIfAbsent(cteId, key -> Lists.newArrayList()).add(rf);
+ cteIdToConsumersWithRF.computeIfAbsent(cteId, key -> Sets.newHashSet()).add(consumer);
+ consumerToRFs.computeIfAbsent(consumer, key -> Sets.newHashSet()).add(rf);
+ consumerToSrcExpression.computeIfAbsent(consumer, key -> Sets.newHashSet())
+ .add(rf.getSrcExpr());
+ }
+ }
+ }
+ for (CTEId cteId : rfCtx.getCteProduceMap().keySet()) {
+ // if any consumer does not have RF, RF cannot be pushed down.
+ // cteIdToConsumersWithRF.get(cteId).size() can not be 1, o.w. this cte will be inlined.
+ if (cteIdToConsumersWithRF.get(cteId) != null
+ && ctx.getCteIdToConsumers().get(cteId).size() == cteIdToConsumersWithRF.get(cteId).size()
+ && cteIdToConsumersWithRF.get(cteId).size() >= 2) {
+ // check if there is a common srcExpr among all the consumers
+ Set<PhysicalCTEConsumer> consumers = cteIdToConsumersWithRF.get(cteId);
+ PhysicalCTEConsumer consumer0 = consumers.iterator().next();
+ Set<Expression> candidateSrcExpressions = consumerToSrcExpression.get(consumer0);
+ for (PhysicalCTEConsumer currentConsumer : consumers) {
+ Set<Expression> srcExpressionsOnCurrentConsumer = consumerToSrcExpression.get(currentConsumer);
+ candidateSrcExpressions.retainAll(srcExpressionsOnCurrentConsumer);
+ if (candidateSrcExpressions.isEmpty()) {
+ break;
+ }
+ }
+ if (!candidateSrcExpressions.isEmpty()) {
+ // find RFs to push down
+ for (Expression srcExpr : candidateSrcExpressions) {
+ List<RuntimeFilter> rfsToPushDown = Lists.newArrayList();
+ for (PhysicalCTEConsumer consumer : cteIdToConsumersWithRF.get(cteId)) {
+ for (RuntimeFilter rf : consumerToRFs.get(consumer)) {
+ if (rf.getSrcExpr().equals(srcExpr)) {
+ rfsToPushDown.add(rf);
+ }
+ }
+ }
+ if (rfsToPushDown.isEmpty()) {
+ break;
+ }
+
+ // the most right deep buildNode from rfsToPushDown is used as buildNode for pushDown rf
+ // since the srcExpr are the same, all buildNodes of rfToPushDown are in the same tree path
+ // the longest ancestors means its corresponding rf build node is the most right deep one.
+ RuntimeFilter rightDeep = rfsToPushDown.get(0);
+ List<Plan> rightDeepAncestors = rfsToPushDown.get(0).getBuilderNode().getAncestors();
+ int rightDeepAncestorsSize = rightDeepAncestors.size();
+ RuntimeFilter leftTop = rfsToPushDown.get(0);
+ int leftTopAncestorsSize = rightDeepAncestorsSize;
+ for (RuntimeFilter rf : rfsToPushDown) {
+ List<Plan> ancestors = rf.getBuilderNode().getAncestors();
+ int currentAncestorsSize = ancestors.size();
+ if (currentAncestorsSize > rightDeepAncestorsSize) {
+ rightDeep = rf;
+ rightDeepAncestorsSize = currentAncestorsSize;
+ rightDeepAncestors = ancestors;
+ }
+ if (currentAncestorsSize < leftTopAncestorsSize) {
+ leftTopAncestorsSize = currentAncestorsSize;
+ leftTop = rf;
+ }
+ }
+ Preconditions.checkArgument(rightDeepAncestors.contains(leftTop.getBuilderNode()));
+ // check nodes between right deep and left top are SPJ and not denied join and not mark join
+ boolean valid = true;
+ for (Plan cursor : rightDeepAncestors) {
+ if (cursor.equals(leftTop.getBuilderNode())) {
+ break;
+ }
+ // valid = valid && SPJ_PLAN.contains(cursor.getClass());
+ if (cursor instanceof AbstractPhysicalJoin) {
+ AbstractPhysicalJoin cursorJoin = (AbstractPhysicalJoin) cursor;
+ valid = (!RuntimeFilterGenerator.DENIED_JOIN_TYPES
+ .contains(cursorJoin.getJoinType())
+ || cursorJoin.isMarkJoin()) && valid;
+ }
+ if (!valid) {
+ break;
+ }
+ }
+
+ if (!valid) {
+ break;
+ }
+
+ Expression rightDeepTargetExpressionOnCTE = null;
+ int targetCount = rightDeep.getTargetExpressions().size();
+ for (int i = 0; i < targetCount; i++) {
+ PhysicalRelation rel = rightDeep.getTargetScans().get(i);
+ if (rel instanceof PhysicalCTEConsumer
+ && ((PhysicalCTEConsumer) rel).getCteId().equals(cteId)) {
+ rightDeepTargetExpressionOnCTE = rightDeep.getTargetExpressions().get(i);
+ break;
+ }
+ }
+
+ boolean pushedDown = doPushDownIntoCTEProducerInternal(
+ rightDeep,
+ rightDeepTargetExpressionOnCTE,
+ rfCtx,
+ rfCtx.getCteProduceMap().get(cteId)
+ );
+ if (pushedDown) {
+ rfCtx.removeFilter(
+ rightDeepTargetExpressionOnCTE.getInputSlotExprIds().iterator().next(),
+ (PhysicalHashJoin) rightDeep.getBuilderNode());
+ }
+ }
+ }
+ }
+ }
+ }
+ return result;
+ }
+
/**
* the runtime filter generator run at the phase of post process and plan translation of nereids planner.
* post process:
@@ -117,18 +247,40 @@ public class RuntimeFilterGenerator extends PlanPostProcessor {
@Override
public PhysicalPlan visitPhysicalHashJoin(PhysicalHashJoin<? extends Plan, ? extends Plan> join,
CascadesContext context) {
- RuntimeFilterContext ctx = context.getRuntimeFilterContext();
join.right().accept(this, context);
join.left().accept(this, context);
if (RuntimeFilterGenerator.DENIED_JOIN_TYPES.contains(join.getJoinType()) || join.isMarkJoin()) {
join.right().getOutput().forEach(slot ->
context.getRuntimeFilterContext().aliasTransferMapRemove(slot));
}
- collectPushDownCTEInfos(join, context);
- if (!getPushDownCTECandidates(ctx).isEmpty()) {
- pushDownRuntimeFilterIntoCTE(ctx);
- } else {
- pushDownRuntimeFilterCommon(join, context);
+ RuntimeFilterContext ctx = context.getRuntimeFilterContext();
+ List<TRuntimeFilterType> legalTypes = Arrays.stream(TRuntimeFilterType.values())
+ .filter(type -> (type.getValue() & ctx.getSessionVariable().getRuntimeFilterType()) > 0)
+ .collect(Collectors.toList());
+
+ List<Expression> hashJoinConjuncts = join.getHashJoinConjuncts().stream().collect(Collectors.toList());
+ boolean buildSideContainsConsumer = hasCTEConsumerDescendant((PhysicalPlan) join.right());
+ for (int i = 0; i < hashJoinConjuncts.size(); i++) {
+ // BE do not support RF generated from NullSafeEqual, skip them
+ if (hashJoinConjuncts.get(i) instanceof EqualTo) {
+ EqualTo equalTo = ((EqualTo) JoinUtils.swapEqualToForChildrenOrder(
+ (EqualTo) hashJoinConjuncts.get(i), join.left().getOutputSet()));
+ for (TRuntimeFilterType type : legalTypes) {
+ //bitmap rf is generated by nested loop join.
+ if (type == TRuntimeFilterType.BITMAP) {
+ continue;
+ }
+ long buildSideNdv = getBuildSideNdv(join, equalTo);
+ Pair<PhysicalRelation, Slot> pair = ctx.getAliasTransferMap().get(equalTo.right());
+ // CteConsumer is not allowed to generate RF in order to avoid RF cycle.
+ if ((pair == null && buildSideContainsConsumer)
+ || (pair != null && pair.first instanceof PhysicalCTEConsumer)) {
+ continue;
+ }
+ join.pushDownRuntimeFilter(context, generator, join, equalTo.right(),
+ equalTo.left(), type, buildSideNdv, i);
+ }
+ }
}
return join;
}
@@ -362,235 +514,18 @@ public class RuntimeFilterGenerator extends PlanPostProcessor {
return expression instanceof Slot ? ((Slot) expression) : null;
}
- private void pushDownRuntimeFilterCommon(PhysicalHashJoin<? extends Plan, ? extends Plan> join,
- CascadesContext context) {
- RuntimeFilterContext ctx = context.getRuntimeFilterContext();
- List<TRuntimeFilterType> legalTypes = Arrays.stream(TRuntimeFilterType.values())
- .filter(type -> (type.getValue() & ctx.getSessionVariable().getRuntimeFilterType()) > 0)
- .collect(Collectors.toList());
-
- List<Expression> hashJoinConjuncts = join.getHashJoinConjuncts().stream().collect(Collectors.toList());
- for (int i = 0; i < hashJoinConjuncts.size(); i++) {
- // BE do not support RF generated from NullSafeEqual, skip them
- if (hashJoinConjuncts.get(i) instanceof EqualTo) {
- EqualTo equalTo = ((EqualTo) JoinUtils.swapEqualToForChildrenOrder(
- (EqualTo) hashJoinConjuncts.get(i), join.left().getOutputSet()));
- for (TRuntimeFilterType type : legalTypes) {
- //bitmap rf is generated by nested loop join.
- if (type == TRuntimeFilterType.BITMAP) {
- continue;
- }
- long buildSideNdv = getBuildSideNdv(join, equalTo);
- join.pushDownRuntimeFilter(context, generator, join, equalTo.right(),
- equalTo.left(), type, buildSideNdv, i);
- }
- }
- }
- }
-
- private void collectPushDownCTEInfos(PhysicalHashJoin<? extends Plan, ? extends Plan> join,
- CascadesContext context) {
- RuntimeFilterContext ctx = context.getRuntimeFilterContext();
- Set<CTEId> cteIds = new LinkedHashSet<>(); // use LinkedHashSet to make runtime filter order stable
- PhysicalPlan leftChild = (PhysicalPlan) join.left();
- PhysicalPlan rightChild = (PhysicalPlan) join.right();
-
- Preconditions.checkState(leftChild != null && rightChild != null);
-
- boolean leftHasCTE = hasCTEConsumerUnderJoin(leftChild, cteIds);
- boolean rightHasCTE = hasCTEConsumerUnderJoin(rightChild, cteIds);
- // only support single cte in join currently
- if ((leftHasCTE && !rightHasCTE) || (!leftHasCTE && rightHasCTE)) {
- for (CTEId id : cteIds) {
- if (ctx.getCteToJoinsMap().get(id) == null) {
- // use LinkedHashSet to make runtime filter order stable
- Set<PhysicalHashJoin> newJoin = new LinkedHashSet<>();
- newJoin.add(join);
- ctx.getCteToJoinsMap().put(id, newJoin);
- } else {
- ctx.getCteToJoinsMap().get(id).add(join);
- }
- }
- }
- if (!ctx.getCteToJoinsMap().isEmpty()) {
- analyzeRuntimeFilterPushDownIntoCTEInfos(join, context);
- }
- }
-
- private List<CTEId> getPushDownCTECandidates(RuntimeFilterContext ctx) {
- List<CTEId> candidates = new ArrayList<>();
- Map<PhysicalCTEProducer, Map<EqualTo, PhysicalHashJoin>> cteRFPushDownMap = ctx.getCteRFPushDownMap();
- for (Map.Entry<PhysicalCTEProducer, Map<EqualTo, PhysicalHashJoin>> entry : cteRFPushDownMap.entrySet()) {
- CTEId cteId = entry.getKey().getCteId();
- if (ctx.getPushedDownCTE().contains(cteId)) {
- continue;
- }
- candidates.add(cteId);
- }
- return candidates;
- }
-
- private boolean hasCTEConsumerUnderJoin(PhysicalPlan root, Set<CTEId> cteIds) {
- if (root instanceof PhysicalCTEConsumer) {
- cteIds.add(((PhysicalCTEConsumer) root).getCteId());
- return true;
- } else if (root.children().size() != 1) {
- // only collect cte in one side
- return false;
- } else if (root instanceof PhysicalDistribute
- || root instanceof PhysicalFilter
- || root instanceof PhysicalProject) {
- // only collect cte as single child node under join
- return hasCTEConsumerUnderJoin((PhysicalPlan) root.child(0), cteIds);
- } else {
- return false;
- }
- }
-
- private void analyzeRuntimeFilterPushDownIntoCTEInfos(PhysicalHashJoin<? extends Plan, ? extends Plan> curJoin,
- CascadesContext context) {
- RuntimeFilterContext ctx = context.getRuntimeFilterContext();
- Map<CTEId, Set<PhysicalHashJoin>> cteToJoinsMap = ctx.getCteToJoinsMap();
- for (Map.Entry<CTEId, Set<PhysicalHashJoin>> entry : cteToJoinsMap.entrySet()) {
- CTEId cteId = entry.getKey();
- Set<PhysicalHashJoin> joinSet = entry.getValue();
- if (joinSet.contains(curJoin)) {
- // skip current join
- continue;
- }
- Set<LogicalCTEConsumer> cteSet = context.getCteIdToConsumers().get(cteId);
- Preconditions.checkState(!cteSet.isEmpty());
- String cteName = cteSet.iterator().next().getName();
- // preconditions for rf pushing into cte producer:
- // multiple joins whose join condition is on the same cte's column of the same cte
- // the other side of these join conditions are the same column of the same table, or
- // they in the same equal sets, such as under an equal join condition
- // case 1: two joins with t1.c1 = cte1_consumer1.c1 and t1.c1 = cte1_consumer2.c1 conditions
- // rf of t1.c1 can be pushed down into cte1 producer.
- // ----------------------hashJoin(t1.c1 = cte2_consumer1.c1)
- // ----------------------------CteConsumer[cteId= ( CTEId#1=] )
- // ----------------------------PhysicalOlapScan[t1]
- // ----------------------hashJoin(t1.c1 = cte2_consumer2.c1)
- // ----------------------------CteConsumer[cteId= ( CTEId#1=] )
- // ----------------------------PhysicalOlapScan[t1]
- // case 2: two joins with t1.c1 = cte2_consumer1.c1 and t2.c2 = cte2_consumer2.c1 and another equal join
- // condition t1.c1 = t2.c2, which means t1.c1 and t2.c2 are in the same equal set.
- // rf of t1.c1 and t2.c2 can be pushed down into cte2 producer.
- // --------------------hashJoin(t1.c1 = t2.c2)
- // ----------------------hashJoin(t2.c2 = cte2_consumer1.c1)
- // ----------------------------CteConsumer[cteId= ( CTEId#1=] )
- // ----------------------------PhysicalOlapScan[t2]
- // ----------------------hashJoin(t1.c1 = cte2_consumer2.c1)
- // ----------------------------CteConsumer[cteId= ( CTEId#1=] )
- // ----------------------------PhysicalOlapScan[t1]
- if (joinSet.size() != cteSet.size()) {
- continue;
- }
- List<EqualTo> equalTos = new ArrayList<>();
- Map<EqualTo, PhysicalHashJoin> equalCondToJoinMap = new LinkedHashMap<>();
- for (PhysicalHashJoin join : joinSet) {
- // precondition:
- // 1. no non-equal join condition
- // 2. only equalTo and slotReference both sides
- // 3. only support one join condition (will be refined further)
- if (join.getOtherJoinConjuncts().size() > 1
- || join.getHashJoinConjuncts().size() != 1
- || !(join.getHashJoinConjuncts().get(0) instanceof EqualTo)) {
- break;
- } else {
- EqualTo equalTo = join.getEqualToConjuncts().get(0);
- equalTos.add(equalTo);
- equalCondToJoinMap.put(equalTo, join);
- }
- }
- if (joinSet.size() == equalTos.size()) {
- int matchNum = 0;
- Set<String> cteNameSet = new HashSet<>();
- Set<SlotReference> anotherSideSlotSet = new HashSet<>();
- for (EqualTo equalTo : equalTos) {
- SlotReference left = (SlotReference) equalTo.left();
- SlotReference right = (SlotReference) equalTo.right();
- if (left.getQualifier().size() == 1 && left.getQualifier().get(0).equals(cteName)) {
- matchNum += 1;
- anotherSideSlotSet.add(right);
- cteNameSet.add(left.getQualifiedName());
- } else if (right.getQualifier().size() == 1 && right.getQualifier().get(0).equals(cteName)) {
- matchNum += 1;
- anotherSideSlotSet.add(left);
- cteNameSet.add(right.getQualifiedName());
- }
- }
- if (matchNum == equalTos.size() && cteNameSet.size() == 1) {
- // means all join condition points to the same cte on the same cte column.
- // collect the other side columns besides cte column side.
- Preconditions.checkState(equalTos.size() == equalCondToJoinMap.size(),
- "equalTos.size() != equalCondToJoinMap.size()");
-
- PhysicalCTEProducer cteProducer = context.getRuntimeFilterContext().getCteProduceMap().get(cteId);
- if (anotherSideSlotSet.size() == 1) {
- // meet requirement for pushing down into cte producer
- ctx.getCteRFPushDownMap().put(cteProducer, equalCondToJoinMap);
- } else {
- // check further whether the join upper side can bring equal set, which
- // indicating actually the same runtime filter build side
- // see above case 2 for reference
- boolean inSameEqualSet = false;
- for (EqualTo e : curJoin.getEqualToConjuncts()) {
- if (e instanceof EqualTo) {
- SlotReference oneSide = (SlotReference) e.left();
- SlotReference anotherSide = (SlotReference) e.right();
- if (anotherSideSlotSet.contains(oneSide) && anotherSideSlotSet.contains(anotherSide)) {
- inSameEqualSet = true;
- break;
- }
- }
- }
- if (inSameEqualSet) {
- ctx.getCteRFPushDownMap().put(cteProducer, equalCondToJoinMap);
- }
- }
- }
- }
- }
- }
-
- private void pushDownRuntimeFilterIntoCTE(RuntimeFilterContext ctx) {
- Map<PhysicalCTEProducer, Map<EqualTo, PhysicalHashJoin>> cteRFPushDownMap = ctx.getCteRFPushDownMap();
- for (Map.Entry<PhysicalCTEProducer, Map<EqualTo, PhysicalHashJoin>> entry : cteRFPushDownMap.entrySet()) {
- PhysicalCTEProducer cteProducer = entry.getKey();
- Preconditions.checkState(cteProducer != null);
- if (ctx.getPushedDownCTE().contains(cteProducer.getCteId())) {
- continue;
- }
- Map<EqualTo, PhysicalHashJoin> equalCondToJoinMap = entry.getValue();
- for (Map.Entry<EqualTo, PhysicalHashJoin> innerEntry : equalCondToJoinMap.entrySet()) {
- EqualTo equalTo = innerEntry.getKey();
- PhysicalHashJoin<? extends Plan, ? extends Plan> join = innerEntry.getValue();
- Preconditions.checkState(join != null);
- TRuntimeFilterType type = TRuntimeFilterType.IN_OR_BLOOM;
- if (ctx.getSessionVariable().getEnablePipelineEngine() && !join.isBroadCastJoin()) {
- type = TRuntimeFilterType.BLOOM;
- }
- EqualTo newEqualTo = ((EqualTo) JoinUtils.swapEqualToForChildrenOrder(
- equalTo, join.child(0).getOutputSet()));
- doPushDownIntoCTEProducerInternal(join, ctx, newEqualTo, type, cteProducer);
- }
- ctx.getPushedDownCTE().add(cteProducer.getCteId());
- }
- }
-
- private void doPushDownIntoCTEProducerInternal(PhysicalHashJoin<? extends Plan, ? extends Plan> join,
- RuntimeFilterContext ctx, EqualTo equalTo, TRuntimeFilterType type, PhysicalCTEProducer cteProducer) {
+ private boolean doPushDownIntoCTEProducerInternal(RuntimeFilter rf, Expression targetExpression,
+ RuntimeFilterContext ctx, PhysicalCTEProducer cteProducer) {
PhysicalPlan inputPlanNode = (PhysicalPlan) cteProducer.child(0);
- Slot unwrappedSlot = checkTargetChild(equalTo.left());
+ Slot unwrappedSlot = checkTargetChild(targetExpression);
// aliasTransMap doesn't contain the key, means that the path from the scan to the join
// contains join with denied join type. for example: a left join b on a.id = b.id
- if (!checkPushDownPreconditionsForJoin(join, ctx, unwrappedSlot)) {
- return;
+ if (!checkPushDownPreconditionsForJoin(rf.getBuilderNode(), ctx, unwrappedSlot)) {
+ return false;
}
Slot cteSlot = ctx.getAliasTransferPair(unwrappedSlot).second;
PhysicalRelation cteNode = ctx.getAliasTransferPair(unwrappedSlot).first;
- long buildSideNdv = getBuildSideNdv(join, equalTo);
+ long buildSideNdv = rf.getBuildSideNdv();
if (cteNode instanceof PhysicalCTEConsumer && inputPlanNode instanceof PhysicalProject) {
PhysicalProject project = (PhysicalProject) inputPlanNode;
NamedExpression targetExpr = null;
@@ -602,12 +537,7 @@ public class RuntimeFilterGenerator extends PlanPostProcessor {
}
}
Preconditions.checkState(targetExpr != null);
- if (!(targetExpr instanceof SlotReference)) {
- // if not SlotReference, skip the push down
- return;
- } else if (!checkCanPushDownIntoBasicTable(project)) {
- return;
- } else {
+ if (targetExpr instanceof SlotReference && checkCanPushDownIntoBasicTable(project)) {
Map<Slot, PhysicalRelation> pushDownBasicTableInfos = getPushDownBasicTablesInfos(project,
(SlotReference) targetExpr, ctx);
if (!pushDownBasicTableInfos.isEmpty()) {
@@ -623,22 +553,24 @@ public class RuntimeFilterGenerator extends PlanPostProcessor {
targetList.add(targetSlot);
targetExpressions.add(targetSlot);
targetNodes.add(scan);
- ctx.addJoinToTargetMap(join, targetSlot.getExprId());
+ ctx.addJoinToTargetMap(rf.getBuilderNode(), targetSlot.getExprId());
ctx.setTargetsOnScanNode(scan, targetSlot);
}
- // build multi-target runtime filter
- // since always on different join, set the expr_order as 0
+
RuntimeFilter filter = new RuntimeFilter(generator.getNextId(),
- equalTo.right(), targetList, targetExpressions, type, 0, join, buildSideNdv, true,
+ rf.getSrcExpr(), targetList, targetExpressions, rf.getType(), rf.getExprOrder(),
+ rf.getBuilderNode(), buildSideNdv, rf.isBloomFilterSizeCalculatedByNdv(),
cteNode);
targetNodes.forEach(node -> node.addAppliedRuntimeFilter(filter));
for (Slot slot : targetList) {
ctx.setTargetExprIdToFilter(slot.getExprId(), filter);
}
- ctx.setRuntimeFilterIdentityToFilter(equalTo.right(), type, join, filter);
+ ctx.setRuntimeFilterIdentityToFilter(rf.getSrcExpr(), rf.getType(), rf.getBuilderNode(), filter);
+ return true;
}
}
}
+ return false;
}
@Override
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPruner.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPruner.java
index 5005da2a1cf..3d5c9752ad9 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPruner.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPruner.java
@@ -26,16 +26,21 @@ import org.apache.doris.nereids.trees.expressions.SlotReference;
import org.apache.doris.nereids.trees.plans.AbstractPlan;
import org.apache.doris.nereids.trees.plans.Plan;
import org.apache.doris.nereids.trees.plans.physical.PhysicalAssertNumRows;
+import org.apache.doris.nereids.trees.plans.physical.PhysicalCTEAnchor;
import org.apache.doris.nereids.trees.plans.physical.PhysicalFilter;
import org.apache.doris.nereids.trees.plans.physical.PhysicalHashAggregate;
import org.apache.doris.nereids.trees.plans.physical.PhysicalHashJoin;
+import org.apache.doris.nereids.trees.plans.physical.PhysicalIntersect;
import org.apache.doris.nereids.trees.plans.physical.PhysicalLimit;
+import org.apache.doris.nereids.trees.plans.physical.PhysicalNestedLoopJoin;
import org.apache.doris.nereids.trees.plans.physical.PhysicalRelation;
+import org.apache.doris.nereids.trees.plans.physical.PhysicalSetOperation;
import org.apache.doris.nereids.trees.plans.physical.PhysicalTopN;
import org.apache.doris.qe.ConnectContext;
import org.apache.doris.statistics.ColumnStatistic;
import org.apache.doris.statistics.Statistics;
+import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
import java.util.List;
@@ -58,6 +63,9 @@ public class RuntimeFilterPruner extends PlanPostProcessor {
@Override
public Plan visit(Plan plan, CascadesContext context) {
if (!plan.children().isEmpty()) {
+ Preconditions.checkArgument(plan.children().size() == 1,
+ plan.getClass().getSimpleName()
+ + " has more than one child, needs its own visitor implementation");
plan.child(0).accept(this, context);
if (context.getRuntimeFilterContext().isEffectiveSrcNode(plan.child(0))) {
RuntimeFilterContext.EffectiveSrcType childType = context.getRuntimeFilterContext()
@@ -68,6 +76,45 @@ public class RuntimeFilterPruner extends PlanPostProcessor {
return plan;
}
+ @Override
+ public PhysicalSetOperation visitPhysicalSetOperation(PhysicalSetOperation setOperation, CascadesContext context) {
+ for (Plan child : setOperation.children()) {
+ child.accept(this, context);
+ }
+ return setOperation;
+ }
+
+ @Override
+ public PhysicalIntersect visitPhysicalIntersect(PhysicalIntersect intersect, CascadesContext context) {
+ for (Plan child : intersect.children()) {
+ child.accept(this, context);
+ }
+ context.getRuntimeFilterContext().addEffectiveSrcNode(intersect, RuntimeFilterContext.EffectiveSrcType.NATIVE);
+ return intersect;
+ }
+
+ @Override
+ public PhysicalNestedLoopJoin visitPhysicalNestedLoopJoin(
+ PhysicalNestedLoopJoin<? extends Plan, ? extends Plan> join,
+ CascadesContext context) {
+ join.right().accept(this, context);
+ join.left().accept(this, context);
+ if (context.getRuntimeFilterContext().isEffectiveSrcNode(join.child(0))) {
+ RuntimeFilterContext.EffectiveSrcType childType = context.getRuntimeFilterContext()
+ .getEffectiveSrcType(join.child(0));
+ context.getRuntimeFilterContext().addEffectiveSrcNode(join, childType);
+ }
+ return join;
+ }
+
+ @Override
+ public PhysicalCTEAnchor visitPhysicalCTEAnchor(PhysicalCTEAnchor<? extends Plan, ? extends Plan> cteAnchor,
+ CascadesContext context) {
+ cteAnchor.child(0).accept(this, context);
+ cteAnchor.child(1).accept(this, context);
+ return cteAnchor;
+ }
+
@Override
public PhysicalTopN visitPhysicalTopN(PhysicalTopN<? extends Plan> topN, CascadesContext context) {
topN.child().accept(this, context);
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/AbstractPlan.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/AbstractPlan.java
index 48ec363aa57..cd0cfb54291 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/AbstractPlan.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/AbstractPlan.java
@@ -35,6 +35,7 @@ import org.apache.doris.statistics.Statistics;
import com.google.common.base.Preconditions;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
+import com.google.common.collect.Lists;
import org.json.JSONArray;
import org.json.JSONObject;
@@ -191,4 +192,18 @@ public abstract class AbstractPlan extends AbstractTreeNode<Plan> implements Pla
public int getId() {
return id.asInt();
}
+
+ /**
+ * ancestors in the tree
+ */
+ public List<Plan> getAncestors() {
+ List<Plan> ancestors = Lists.newArrayList();
+ ancestors.add(this);
+ Optional<Object> parent = this.getMutableState(MutableState.KEY_PARENT);
+ while (parent.isPresent()) {
+ ancestors.add((Plan) parent.get());
+ parent = ((Plan) parent.get()).getMutableState(MutableState.KEY_PARENT);
+ }
+ return ancestors;
+ }
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/AbstractPhysicalPlan.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/AbstractPhysicalPlan.java
index 5d8d4046f57..1e9135d600e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/AbstractPhysicalPlan.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/AbstractPhysicalPlan.java
@@ -25,7 +25,6 @@ import org.apache.doris.nereids.processor.post.RuntimeFilterGenerator;
import org.apache.doris.nereids.properties.LogicalProperties;
import org.apache.doris.nereids.properties.PhysicalProperties;
import org.apache.doris.nereids.trees.expressions.Expression;
-import org.apache.doris.nereids.trees.expressions.NamedExpression;
import org.apache.doris.nereids.trees.expressions.Slot;
import org.apache.doris.nereids.trees.plans.AbstractPlan;
import org.apache.doris.nereids.trees.plans.Explainable;
@@ -129,7 +128,7 @@ public abstract class AbstractPhysicalPlan extends AbstractPlan implements Physi
filter.addTargetSlot(scanSlot, probeExpr, scan);
ctx.addJoinToTargetMap(builderNode, scanSlot.getExprId());
ctx.setTargetExprIdToFilter(scanSlot.getExprId(), filter);
- ctx.setTargetsOnScanNode(ctx.getAliasTransferPair((NamedExpression) probeExpr).first, scanSlot);
+ ctx.setTargetsOnScanNode(ctx.getAliasTransferPair(probeSlot).first, scanSlot);
}
} else {
filter = new RuntimeFilter(generator.getNextId(),
@@ -139,7 +138,7 @@ public abstract class AbstractPhysicalPlan extends AbstractPlan implements Physi
this.addAppliedRuntimeFilter(filter);
ctx.addJoinToTargetMap(builderNode, scanSlot.getExprId());
ctx.setTargetExprIdToFilter(scanSlot.getExprId(), filter);
- ctx.setTargetsOnScanNode(ctx.getAliasTransferPair((NamedExpression) probeSlot).first, scanSlot);
+ ctx.setTargetsOnScanNode(ctx.getAliasTransferPair(probeSlot).first, scanSlot);
ctx.setRuntimeFilterIdentityToFilter(src, type, builderNode, filter);
}
return true;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalCTEConsumer.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalCTEConsumer.java
index 38259e155e0..97714a4a485 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalCTEConsumer.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalCTEConsumer.java
@@ -102,8 +102,13 @@ public class PhysicalCTEConsumer extends PhysicalRelation {
@Override
public String toString() {
+ StringBuilder builder = new StringBuilder();
+ if (!getAppliedRuntimeFilters().isEmpty()) {
+ getAppliedRuntimeFilters()
+ .stream().forEach(rf -> builder.append(" RF").append(rf.getId().asInt()));
+ }
return Utils.toSqlString("PhysicalCTEConsumer[" + id.asInt() + "]",
- "cteId", cteId);
+ "stats", getStats(), "cteId", cteId, "RFs", builder);
}
@Override
@@ -136,8 +141,15 @@ public class PhysicalCTEConsumer extends PhysicalRelation {
@Override
public String shapeInfo() {
- return Utils.toSqlString("PhysicalCteConsumer",
- "cteId", cteId);
+ StringBuilder shapeBuilder = new StringBuilder();
+ shapeBuilder.append(Utils.toSqlString("PhysicalCteConsumer",
+ "cteId", cteId));
+ if (!getAppliedRuntimeFilters().isEmpty()) {
+ shapeBuilder.append(" apply RFs:");
+ getAppliedRuntimeFilters()
+ .stream().forEach(rf -> shapeBuilder.append(" RF").append(rf.getId().asInt()));
+ }
+ return shapeBuilder.toString();
}
@Override
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalDistribute.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalDistribute.java
index 8f30b503453..3891da6c1a1 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalDistribute.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalDistribute.java
@@ -70,8 +70,8 @@ public class PhysicalDistribute<CHILD_TYPE extends Plan> extends PhysicalUnary<C
@Override
public String toString() {
return Utils.toSqlString("PhysicalDistribute[" + id.asInt() + "]" + getGroupIdWithPrefix(),
- "distributionSpec", distributionSpec,
- "stats", statistics
+ "stats", statistics,
+ "distributionSpec", distributionSpec
);
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalFilter.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalFilter.java
index 4f2f5427d5b..42327e7b925 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalFilter.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalFilter.java
@@ -76,8 +76,8 @@ public class PhysicalFilter<CHILD_TYPE extends Plan> extends PhysicalUnary<CHILD
@Override
public String toString() {
return Utils.toSqlString("PhysicalFilter[" + id.asInt() + "]" + getGroupIdWithPrefix(),
- "predicates", getPredicate(),
- "stats", statistics
+ "stats", statistics,
+ "predicates", getPredicate()
);
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalHashJoin.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalHashJoin.java
index 43b82dcc20f..c96faed90b4 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalHashJoin.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalHashJoin.java
@@ -223,10 +223,10 @@ public class PhysicalHashJoin<
AbstractPhysicalPlan builderRightNode = (AbstractPhysicalPlan) builderNode.child(1);
Preconditions.checkState(builderLeftNode != null && builderRightNode != null,
"builder join node child node is null");
- if (RuntimeFilterGenerator.hasCTEConsumerDescendant(builderLeftNode)
- && RuntimeFilterGenerator.hasCTEConsumerDescendant(builderRightNode)) {
- return false;
- }
+ // if (RuntimeFilterGenerator.hasCTEConsumerDescendant(builderLeftNode)
+ // && RuntimeFilterGenerator.hasCTEConsumerDescendant(builderRightNode)) {
+ // return false;
+ // }
boolean pushedDown = false;
AbstractPhysicalPlan leftNode = (AbstractPhysicalPlan) child(0);
@@ -235,23 +235,25 @@ public class PhysicalHashJoin<
"join child node is null");
Set<Expression> probExprList = Sets.newHashSet(probeExpr);
- Pair<PhysicalRelation, Slot> pair = ctx.getAliasTransferMap().get(probeExpr);
- PhysicalRelation target1 = (pair == null) ? null : pair.first;
+ Pair<PhysicalRelation, Slot> srcPair = ctx.getAliasTransferMap().get(srcExpr);
+ PhysicalRelation srcNode = (srcPair == null) ? null : srcPair.first;
+ Pair<PhysicalRelation, Slot> targetPair = ctx.getAliasTransferMap().get(probeExpr);
+ // when probeExpr is output slot of setOperator, targetPair is null
+ PhysicalRelation target1 = (targetPair == null) ? null : targetPair.first;
PhysicalRelation target2 = null;
- pair = ctx.getAliasTransferMap().get(srcExpr);
- PhysicalRelation srcNode = (pair == null) ? null : pair.first;
if (ConnectContext.get() != null && ConnectContext.get().getSessionVariable().expandRuntimeFilterByInnerJoin) {
- if (!this.equals(builderNode) && this.getJoinType() == JoinType.INNER_JOIN) {
+ if (!this.equals(builderNode)
+ && (this.getJoinType() == JoinType.INNER_JOIN || this.getJoinType().isSemiJoin())) {
for (Expression expr : this.getHashJoinConjuncts()) {
EqualPredicate equalTo = (EqualPredicate) expr;
if (probeExpr.equals(equalTo.left())) {
probExprList.add(equalTo.right());
- pair = ctx.getAliasTransferMap().get(equalTo.right());
- target2 = (pair == null) ? null : pair.first;
+ targetPair = ctx.getAliasTransferMap().get(equalTo.right());
+ target2 = (targetPair == null) ? null : targetPair.first;
} else if (probeExpr.equals(equalTo.right())) {
probExprList.add(equalTo.left());
- pair = ctx.getAliasTransferMap().get(equalTo.left());
- target2 = (pair == null) ? null : pair.first;
+ targetPair = ctx.getAliasTransferMap().get(equalTo.left());
+ target2 = (targetPair == null) ? null : targetPair.first;
}
if (target2 != null) {
ctx.getExpandedRF().add(
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalOlapScan.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalOlapScan.java
index 8f461bc4488..14629e52818 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalOlapScan.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalOlapScan.java
@@ -24,7 +24,6 @@ import org.apache.doris.nereids.properties.LogicalProperties;
import org.apache.doris.nereids.properties.PhysicalProperties;
import org.apache.doris.nereids.trees.TableSample;
import org.apache.doris.nereids.trees.expressions.Slot;
-import org.apache.doris.nereids.trees.plans.AbstractPlan;
import org.apache.doris.nereids.trees.plans.Plan;
import org.apache.doris.nereids.trees.plans.PlanType;
import org.apache.doris.nereids.trees.plans.PreAggStatus;
@@ -120,9 +119,13 @@ public class PhysicalOlapScan extends PhysicalCatalogRelation implements OlapSca
@Override
public String toString() {
- return Utils.toSqlString("PhysicalOlapScan[" + relationId.asInt() + "]" + getGroupIdWithPrefix(),
- "qualified", Utils.qualifiedName(qualifier, table.getName()),
- "stats", statistics, "fr", getMutableState(AbstractPlan.FRAGMENT_ID)
+ StringBuilder builder = new StringBuilder();
+ if (!getAppliedRuntimeFilters().isEmpty()) {
+ getAppliedRuntimeFilters()
+ .stream().forEach(rf -> builder.append(" RF").append(rf.getId().asInt()));
+ }
+ return Utils.toSqlString("PhysicalOlapScan[" + table.getName() + "]" + getGroupIdWithPrefix(),
+ "stats", statistics, "RFs", builder
);
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalProject.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalProject.java
index 8cdfedbfdd3..af7bb950a97 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalProject.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalProject.java
@@ -33,6 +33,7 @@ import org.apache.doris.nereids.trees.plans.Plan;
import org.apache.doris.nereids.trees.plans.PlanType;
import org.apache.doris.nereids.trees.plans.algebra.Project;
import org.apache.doris.nereids.trees.plans.visitor.PlanVisitor;
+import org.apache.doris.nereids.util.ExpressionUtils;
import org.apache.doris.nereids.util.Utils;
import org.apache.doris.planner.RuntimeFilterId;
import org.apache.doris.statistics.Statistics;
@@ -77,8 +78,8 @@ public class PhysicalProject<CHILD_TYPE extends Plan> extends PhysicalUnary<CHIL
@Override
public String toString() {
return Utils.toSqlString("PhysicalProject[" + id.asInt() + "]" + getGroupIdWithPrefix(),
- "projects", projects,
- "stats", statistics
+ "stats", statistics, "projects", projects
+
);
}
@@ -187,7 +188,12 @@ public class PhysicalProject<CHILD_TYPE extends Plan> extends PhysicalUnary<CHIL
}
NamedExpression newProbeExpr = this.getProjects().get(projIndex);
if (newProbeExpr instanceof Alias) {
- newProbeExpr = (NamedExpression) newProbeExpr.child(0);
+ Expression child = ExpressionUtils.getExpressionCoveredByCast(newProbeExpr.child(0));
+ if (child instanceof NamedExpression) {
+ newProbeExpr = (NamedExpression) child;
+ } else {
+ return false;
+ }
}
Slot newProbeSlot = RuntimeFilterGenerator.checkTargetChild(newProbeExpr);
if (!RuntimeFilterGenerator.checkPushDownPreconditionsForJoin(builderNode, ctx, newProbeSlot)) {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/util/Utils.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/util/Utils.java
index 186a3e4529d..31b29eb3259 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/util/Utils.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/util/Utils.java
@@ -141,15 +141,21 @@ public class Utils {
}
for (int i = 0; i < variables.length - 1; i += 2) {
- stringBuilder.append(variables[i]).append("=").append(variables[i + 1]);
- if (i < variables.length - 2) {
- stringBuilder.append(", ");
+ if (! "".equals(toStringOrNull(variables[i + 1]))) {
+ if (i != 0) {
+ stringBuilder.append(", ");
+ }
+ stringBuilder.append(toStringOrNull(variables[i])).append("=").append(toStringOrNull(variables[i + 1]));
}
}
return stringBuilder.append(" )").toString();
}
+ private static String toStringOrNull(Object obj) {
+ return obj == null ? "null" : obj.toString();
+ }
+
/**
* Get the correlated columns that belong to the subquery,
* that is, the correlated columns that can be resolved within the subquery.
diff --git a/fe/fe-core/src/main/java/org/apache/doris/statistics/Statistics.java b/fe/fe-core/src/main/java/org/apache/doris/statistics/Statistics.java
index 00a32f64356..1eb94dcb777 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/statistics/Statistics.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/statistics/Statistics.java
@@ -147,7 +147,7 @@ public class Statistics {
return "-Infinite";
}
DecimalFormat format = new DecimalFormat("#,###.##");
- return format.format(rowCount) + " " + widthInJoinCluster;
+ return format.format(rowCount);
}
public int getBENumber() {
diff --git a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query1.out b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query1.out
index 22d0b5963f7..2fabf81b637 100644
--- a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query1.out
+++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query1.out
@@ -19,16 +19,16 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------PhysicalDistribute[DistributionSpecGather]
--------PhysicalTopN[LOCAL_SORT]
----------PhysicalProject
-------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF2 ctr_customer_sk->[c_customer_sk]
+------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=()
--------------PhysicalDistribute[DistributionSpecHash]
----------------PhysicalProject
-------------------PhysicalOlapScan[customer] apply RFs: RF2
+------------------PhysicalOlapScan[customer]
--------------PhysicalDistribute[DistributionSpecHash]
----------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_store_sk = ctr2.ctr_store_sk)) otherCondition=((cast(ctr_total_return as DOUBLE) > cast((avg(cast(ctr_total_return as DECIMALV3(38, 4))) * 1.2) as DOUBLE)))
------------------PhysicalProject
--------------------hashJoin[INNER_JOIN] hashCondition=((store.s_store_sk = ctr1.ctr_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ctr_store_sk]
----------------------PhysicalDistribute[DistributionSpecExecutionAny]
-------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF1
----------------------PhysicalDistribute[DistributionSpecReplicated]
------------------------PhysicalProject
--------------------------filter((store.s_state = 'TN'))
diff --git a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query14.out b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query14.out
index 8fe54c13941..a81fb3e5337 100644
--- a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query14.out
+++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query14.out
@@ -103,18 +103,18 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------------hashAgg[LOCAL]
------------------------------------PhysicalProject
---------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF14 i_item_sk->[ss_item_sk]
-----------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF13 ss_item_sk->[ss_item_sk]
+--------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF13 i_item_sk->[ss_item_sk,ss_item_sk]
+----------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=()
------------------------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF12 d_date_sk->[ss_sold_date_sk]
----------------------------------------------PhysicalProject
-------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF12 RF13 RF14
+------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF12 RF13
----------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
------------------------------------------------PhysicalProject
--------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001))
----------------------------------------------------PhysicalOlapScan[date_dim]
------------------------------------------PhysicalDistribute[DistributionSpecHash]
---------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF13
----------------------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------------------PhysicalProject
--------------------------------------------PhysicalOlapScan[item]
@@ -129,18 +129,18 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------------hashAgg[LOCAL]
------------------------------------PhysicalProject
---------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF17 i_item_sk->[cs_item_sk]
-----------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF16 ss_item_sk->[cs_item_sk]
+--------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF15 i_item_sk->[cs_item_sk,ss_item_sk]
+----------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=()
------------------------------------------PhysicalDistribute[DistributionSpecHash]
---------------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF15 d_date_sk->[cs_sold_date_sk]
+--------------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF14 d_date_sk->[cs_sold_date_sk]
----------------------------------------------PhysicalProject
-------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF15 RF16 RF17
+------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF14 RF15
----------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
------------------------------------------------PhysicalProject
--------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001))
----------------------------------------------------PhysicalOlapScan[date_dim]
------------------------------------------PhysicalDistribute[DistributionSpecHash]
---------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF15
----------------------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------------------PhysicalProject
--------------------------------------------PhysicalOlapScan[item]
@@ -155,18 +155,18 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------------hashAgg[LOCAL]
------------------------------------PhysicalProject
---------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF20 i_item_sk->[ws_item_sk]
-----------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF19 ss_item_sk->[ws_item_sk]
+--------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF17 i_item_sk->[ws_item_sk,ss_item_sk]
+----------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=()
------------------------------------------PhysicalDistribute[DistributionSpecHash]
---------------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF18 d_date_sk->[ws_sold_date_sk]
+--------------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF16 d_date_sk->[ws_sold_date_sk]
----------------------------------------------PhysicalProject
-------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF18 RF19 RF20
+------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF16 RF17
----------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
------------------------------------------------PhysicalProject
--------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2001))
----------------------------------------------------PhysicalOlapScan[date_dim]
------------------------------------------PhysicalDistribute[DistributionSpecHash]
---------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF17
----------------------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------------------PhysicalProject
--------------------------------------------PhysicalOlapScan[item]
diff --git a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query2.out b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query2.out
index 69e7fe08ddc..63360e2ffb3 100644
--- a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query2.out
+++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query2.out
@@ -28,7 +28,7 @@ PhysicalCteAnchor ( cteId=CTEId#1 )
------------------hashJoin[INNER_JOIN] hashCondition=((date_dim.d_week_seq = d_week_seq1)) otherCondition=() build RFs:RF2 d_week_seq->[d_week_seq]
--------------------PhysicalDistribute[DistributionSpecExecutionAny]
----------------------PhysicalProject
-------------------------PhysicalCteConsumer ( cteId=CTEId#1 )
+------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) apply RFs: RF2
--------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------PhysicalProject
------------------------filter((date_dim.d_year = 1998))
@@ -38,7 +38,7 @@ PhysicalCteAnchor ( cteId=CTEId#1 )
------------------hashJoin[INNER_JOIN] hashCondition=((date_dim.d_week_seq = d_week_seq2)) otherCondition=() build RFs:RF1 d_week_seq->[d_week_seq]
--------------------PhysicalDistribute[DistributionSpecExecutionAny]
----------------------PhysicalProject
-------------------------PhysicalCteConsumer ( cteId=CTEId#1 )
+------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) apply RFs: RF1
--------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------PhysicalProject
------------------------filter((date_dim.d_year = 1999))
diff --git a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query23.out b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query23.out
index f2c86958c97..2bb42e2b053 100644
--- a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query23.out
+++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query23.out
@@ -56,17 +56,17 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------hashAgg[LOCAL]
----------------PhysicalUnion
------------------PhysicalProject
---------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = frequent_ss_items.item_sk)) otherCondition=()
+--------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = frequent_ss_items.item_sk)) otherCondition=() build RFs:RF4 cs_item_sk->[item_sk]
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
---------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF4
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
---------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=() build RFs:RF4 c_customer_sk->[cs_bill_customer_sk]
+--------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=()
----------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[cs_sold_date_sk]
--------------------------------PhysicalProject
-----------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF3 RF4
+----------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF3
--------------------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------------------PhysicalProject
------------------------------------filter((date_dim.d_moy = 7) and (date_dim.d_year = 2000))
@@ -75,17 +75,17 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------------------------------PhysicalProject
--------------------------------PhysicalCteConsumer ( cteId=CTEId#2 )
------------------PhysicalProject
---------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = frequent_ss_items.item_sk)) otherCondition=()
+--------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = frequent_ss_items.item_sk)) otherCondition=() build RFs:RF6 ws_item_sk->[item_sk]
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
---------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF6
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
---------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((web_sales.ws_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=() build RFs:RF6 c_customer_sk->[ws_bill_customer_sk]
+--------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((web_sales.ws_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=()
----------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[ws_sold_date_sk]
--------------------------------PhysicalProject
-----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF5 RF6
+----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF5
--------------------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------------------PhysicalProject
------------------------------------filter((date_dim.d_moy = 7) and (date_dim.d_year = 2000))
diff --git a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query30.out b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query30.out
index f738fa63da6..7dcac891ad1 100644
--- a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query30.out
+++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query30.out
@@ -29,7 +29,7 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------PhysicalProject
----------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ctr_customer_sk]
------------------PhysicalDistribute[DistributionSpecHash]
---------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF3
------------------PhysicalDistribute[DistributionSpecHash]
--------------------hashJoin[INNER_JOIN] hashCondition=((customer_address.ca_address_sk = customer.c_current_addr_sk)) otherCondition=() build RFs:RF2 ca_address_sk->[c_current_addr_sk]
----------------------PhysicalProject
diff --git a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query59.out b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query59.out
index df00924922c..d2e06e87063 100644
--- a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query59.out
+++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query59.out
@@ -19,28 +19,28 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------PhysicalDistribute[DistributionSpecGather]
----------PhysicalTopN[LOCAL_SORT]
------------PhysicalProject
---------------hashJoin[INNER_JOIN] hashCondition=((expr_cast(d_week_seq1 as BIGINT) = expr_(d_week_seq2 - 52)) and (y.s_store_id1 = x.s_store_id2)) otherCondition=()
+--------------hashJoin[INNER_JOIN] hashCondition=((expr_cast(d_week_seq1 as BIGINT) = expr_(d_week_seq2 - 52)) and (y.s_store_id1 = x.s_store_id2)) otherCondition=() build RFs:RF5 s_store_id2->[s_store_id]
----------------PhysicalDistribute[DistributionSpecHash]
------------------PhysicalProject
--------------------hashJoin[INNER_JOIN] hashCondition=((wss.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF4 s_store_sk->[ss_store_sk]
----------------------hashJoin[INNER_JOIN] hashCondition=((d.d_week_seq = d_week_seq1)) otherCondition=() build RFs:RF3 d_week_seq->[d_week_seq]
------------------------PhysicalDistribute[DistributionSpecExecutionAny]
--------------------------PhysicalProject
-----------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+----------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF3 RF4
------------------------PhysicalDistribute[DistributionSpecReplicated]
--------------------------PhysicalProject
----------------------------filter((d.d_month_seq <= 1206) and (d.d_month_seq >= 1195))
------------------------------PhysicalOlapScan[date_dim]
----------------------PhysicalDistribute[DistributionSpecReplicated]
------------------------PhysicalProject
---------------------------PhysicalOlapScan[store]
+--------------------------PhysicalOlapScan[store] apply RFs: RF5
----------------PhysicalDistribute[DistributionSpecHash]
------------------PhysicalProject
--------------------hashJoin[INNER_JOIN] hashCondition=((wss.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ss_store_sk]
----------------------hashJoin[INNER_JOIN] hashCondition=((d.d_week_seq = d_week_seq2)) otherCondition=() build RFs:RF1 d_week_seq->[d_week_seq]
------------------------PhysicalDistribute[DistributionSpecExecutionAny]
--------------------------PhysicalProject
-----------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+----------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF1 RF2
------------------------PhysicalDistribute[DistributionSpecReplicated]
--------------------------PhysicalProject
----------------------------filter((d.d_month_seq <= 1218) and (d.d_month_seq >= 1207))
diff --git a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query81.out b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query81.out
index fd5bbc4f401..20a169a0faa 100644
--- a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query81.out
+++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query81.out
@@ -29,7 +29,7 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------PhysicalProject
----------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ctr_customer_sk]
------------------PhysicalDistribute[DistributionSpecHash]
---------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF3
------------------PhysicalDistribute[DistributionSpecHash]
--------------------hashJoin[INNER_JOIN] hashCondition=((customer_address.ca_address_sk = customer.c_current_addr_sk)) otherCondition=() build RFs:RF2 ca_address_sk->[c_current_addr_sk]
----------------------PhysicalDistribute[DistributionSpecHash]
diff --git a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query95.out b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query95.out
index 1a77a97a8be..bb7864faabb 100644
--- a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query95.out
+++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query95.out
@@ -6,10 +6,10 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_order_number = ws2.ws_order_number)) otherCondition=(( not (ws_warehouse_sk = ws_warehouse_sk))) build RFs:RF0 ws_order_number->[ws_order_number]
--------PhysicalDistribute[DistributionSpecHash]
----------PhysicalProject
-------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF6 RF7
+------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF7
--------PhysicalDistribute[DistributionSpecHash]
----------PhysicalProject
-------------PhysicalOlapScan[web_sales] apply RFs: RF6 RF7
+------------PhysicalOlapScan[web_sales] apply RFs: RF7
--PhysicalResultSink
----PhysicalTopN[MERGE_SORT]
------PhysicalTopN[LOCAL_SORT]
@@ -19,16 +19,16 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------hashAgg[GLOBAL]
----------------hashAgg[LOCAL]
------------------PhysicalProject
---------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=()
+--------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=() build RFs:RF6 ws_order_number->[ws_order_number,wr_order_number]
----------------------PhysicalProject
-------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF5 wr_order_number->[ws_order_number];RF7 wr_order_number->[ws_order_number,ws_order_number]
+------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF5 wr_order_number->[ws_order_number]
--------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------PhysicalProject
-------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF5 RF6
--------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------PhysicalProject
-------------------------------PhysicalOlapScan[web_returns]
-----------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF4 ws_order_number->[ws_order_number];RF6 ws_order_number->[ws_order_number,ws_order_number]
+------------------------------PhysicalOlapScan[web_returns] apply RFs: RF6
+----------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF7 ws_order_number->[ws_order_number,ws_order_number]
------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------PhysicalProject
----------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/constraints/query23.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/constraints/query23.out
index 40248cb8300..8491810ebf8 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/constraints/query23.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/constraints/query23.out
@@ -56,17 +56,17 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------hashAgg[LOCAL]
----------------PhysicalUnion
------------------PhysicalProject
---------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = frequent_ss_items.item_sk)) otherCondition=()
+--------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = frequent_ss_items.item_sk)) otherCondition=() build RFs:RF4 cs_item_sk->[item_sk]
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
---------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF4
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
---------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=() build RFs:RF4 c_customer_sk->[cs_bill_customer_sk]
+--------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=()
----------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[cs_sold_date_sk]
--------------------------------PhysicalProject
-----------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF3 RF4
+----------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF3
--------------------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------------------PhysicalProject
------------------------------------filter((date_dim.d_moy = 5) and (date_dim.d_year = 2000))
@@ -75,17 +75,17 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------------------------------PhysicalProject
--------------------------------PhysicalCteConsumer ( cteId=CTEId#2 )
------------------PhysicalProject
---------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = frequent_ss_items.item_sk)) otherCondition=()
+--------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = frequent_ss_items.item_sk)) otherCondition=() build RFs:RF6 ws_item_sk->[item_sk]
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
---------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF6
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
---------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((web_sales.ws_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=() build RFs:RF6 c_customer_sk->[ws_bill_customer_sk]
+--------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((web_sales.ws_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=()
----------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[ws_sold_date_sk]
--------------------------------PhysicalProject
-----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF5 RF6
+----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF5
--------------------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------------------PhysicalProject
------------------------------------filter((date_dim.d_moy = 5) and (date_dim.d_year = 2000))
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query1.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query1.out
index d0f8900a566..65dca9e89f3 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query1.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query1.out
@@ -23,9 +23,9 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------PhysicalProject
----------------hashJoin[INNER_JOIN] hashCondition=((store.s_store_sk = ctr1.ctr_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ctr_store_sk]
------------------PhysicalDistribute[DistributionSpecHash]
---------------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF1 c_customer_sk->[ctr_customer_sk]
+--------------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=()
----------------------PhysicalDistribute[DistributionSpecHash]
-------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF2
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
--------------------------PhysicalOlapScan[customer]
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query14.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query14.out
index 23ded84d53c..3fb78e6cc3c 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query14.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query14.out
@@ -23,9 +23,9 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------------PhysicalProject
--------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = d2.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[cs_sold_date_sk]
----------------PhysicalProject
-------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = ics.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[cs_item_sk]
+------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = ics.i_item_sk)) otherCondition=()
--------------------PhysicalProject
-----------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3
+----------------------PhysicalOlapScan[catalog_sales] apply RFs: RF3
--------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------PhysicalProject
------------------------PhysicalOlapScan[item]
@@ -37,9 +37,9 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------------PhysicalProject
--------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = d3.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[ws_sold_date_sk]
----------------PhysicalProject
-------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = iws.i_item_sk)) otherCondition=() build RFs:RF4 i_item_sk->[ws_item_sk]
+------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = iws.i_item_sk)) otherCondition=()
--------------------PhysicalProject
-----------------------PhysicalOlapScan[web_sales] apply RFs: RF4 RF5
+----------------------PhysicalOlapScan[web_sales] apply RFs: RF5
--------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------PhysicalProject
------------------------PhysicalOlapScan[item]
@@ -100,13 +100,13 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------------hashAgg[LOCAL]
------------------------------------PhysicalProject
---------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF14 d_date_sk->[ss_sold_date_sk]
+--------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF13 d_date_sk->[ss_sold_date_sk]
----------------------------------------PhysicalProject
-------------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF13 i_item_sk->[ss_item_sk]
---------------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF12 ss_item_sk->[ss_item_sk]
+------------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=()
+--------------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=()
----------------------------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------------------------PhysicalProject
---------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF12 RF13 RF14
+--------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF13
----------------------------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
--------------------------------------------PhysicalDistribute[DistributionSpecHash]
@@ -127,13 +127,13 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------------hashAgg[LOCAL]
------------------------------------PhysicalProject
---------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF17 d_date_sk->[cs_sold_date_sk]
+--------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF15 d_date_sk->[cs_sold_date_sk]
----------------------------------------PhysicalProject
-------------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF16 i_item_sk->[cs_item_sk]
---------------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF15 ss_item_sk->[cs_item_sk]
+------------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=()
+--------------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=()
----------------------------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------------------------PhysicalProject
---------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF15 RF16 RF17
+--------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF15
----------------------------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
--------------------------------------------PhysicalDistribute[DistributionSpecHash]
@@ -154,15 +154,15 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------------hashAgg[LOCAL]
------------------------------------PhysicalProject
---------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF20 d_date_sk->[ws_sold_date_sk]
+--------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF18 d_date_sk->[ws_sold_date_sk]
----------------------------------------PhysicalProject
-------------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF19 i_item_sk->[ws_item_sk]
---------------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF18 ws_item_sk->[ss_item_sk]
+------------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=()
+--------------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=()
----------------------------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
----------------------------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------------------------PhysicalProject
---------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF19 RF20
+--------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF18
--------------------------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------------------------PhysicalProject
------------------------------------------------PhysicalOlapScan[item]
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query2.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query2.out
index 2bff71e94aa..d5d35f846a5 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query2.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query2.out
@@ -29,14 +29,14 @@ PhysicalCteAnchor ( cteId=CTEId#1 )
--------------------hashJoin[INNER_JOIN] hashCondition=((date_dim.d_week_seq = d_week_seq1)) otherCondition=() build RFs:RF1 d_week_seq->[d_week_seq]
----------------------PhysicalDistribute[DistributionSpecExecutionAny]
------------------------PhysicalProject
---------------------------PhysicalCteConsumer ( cteId=CTEId#1 )
+--------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) apply RFs: RF1
----------------------PhysicalDistribute[DistributionSpecReplicated]
------------------------PhysicalProject
--------------------------filter((date_dim.d_year = 1998))
----------------------------PhysicalOlapScan[date_dim]
----------------PhysicalDistribute[DistributionSpecHash]
------------------PhysicalProject
---------------------PhysicalCteConsumer ( cteId=CTEId#1 )
+--------------------PhysicalCteConsumer ( cteId=CTEId#1 ) apply RFs: RF2
--------------PhysicalDistribute[DistributionSpecReplicated]
----------------PhysicalProject
------------------filter((date_dim.d_year = 1999))
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query23.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query23.out
index 35b12755dcb..d8aa5338964 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query23.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query23.out
@@ -57,11 +57,11 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------------------PhysicalProject
--------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = frequent_ss_items.item_sk)) otherCondition=()
----------------------PhysicalDistribute[DistributionSpecHash]
-------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[cs_sold_date_sk]
---------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[cs_bill_customer_sk]
+------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[cs_sold_date_sk]
+--------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=()
----------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------PhysicalProject
---------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF3 RF4
+--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF3
----------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------PhysicalProject
--------------------------------PhysicalCteConsumer ( cteId=CTEId#2 )
@@ -75,11 +75,11 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------------------PhysicalProject
--------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = frequent_ss_items.item_sk)) otherCondition=()
----------------------PhysicalDistribute[DistributionSpecHash]
-------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF6 d_date_sk->[ws_sold_date_sk]
---------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((web_sales.ws_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=() build RFs:RF5 c_customer_sk->[ws_bill_customer_sk]
+------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[ws_sold_date_sk]
+--------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((web_sales.ws_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=()
----------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------PhysicalProject
---------------------------------PhysicalOlapScan[web_sales] apply RFs: RF5 RF6
+--------------------------------PhysicalOlapScan[web_sales] apply RFs: RF4
----------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------PhysicalProject
--------------------------------PhysicalCteConsumer ( cteId=CTEId#2 )
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query30.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query30.out
index 72e6cb9e1da..6dd7c6aecc8 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query30.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query30.out
@@ -30,7 +30,7 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------------------PhysicalProject
--------------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF2 c_customer_sk->[ctr_customer_sk]
----------------------PhysicalDistribute[DistributionSpecHash]
-------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF2
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
--------------------------PhysicalOlapScan[customer] apply RFs: RF3
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query31.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query31.out
index 2216a2d3f97..3cacf0ae184 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query31.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query31.out
@@ -26,10 +26,10 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------------hashAgg[LOCAL]
--------------PhysicalProject
----------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ws_sold_date_sk]
-------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_bill_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF2 ca_address_sk->[ws_bill_addr_sk]
+------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_bill_addr_sk = customer_address.ca_address_sk)) otherCondition=()
--------------------PhysicalDistribute[DistributionSpecHash]
----------------------PhysicalProject
-------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3
+------------------------PhysicalOlapScan[web_sales] apply RFs: RF3
--------------------PhysicalDistribute[DistributionSpecHash]
----------------------PhysicalProject
------------------------PhysicalOlapScan[customer_address]
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query38.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query38.out
index e91f44096bd..42730bedeba 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query38.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query38.out
@@ -31,10 +31,10 @@ PhysicalResultSink
----------------------hashAgg[LOCAL]
------------------------PhysicalProject
--------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[cs_sold_date_sk]
-----------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF2 c_customer_sk->[cs_bill_customer_sk]
+----------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_bill_customer_sk = customer.c_customer_sk)) otherCondition=()
------------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------------PhysicalProject
-----------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3
+----------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF3
------------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------------PhysicalProject
----------------------------------PhysicalOlapScan[customer]
@@ -48,10 +48,10 @@ PhysicalResultSink
----------------------hashAgg[LOCAL]
------------------------PhysicalProject
--------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[ws_sold_date_sk]
-----------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF4 c_customer_sk->[ws_bill_customer_sk]
+----------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_bill_customer_sk = customer.c_customer_sk)) otherCondition=()
------------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------------PhysicalProject
-----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF4 RF5
+----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF5
------------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------------PhysicalProject
----------------------------------PhysicalOlapScan[customer]
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query5.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query5.out
index 95091111f23..2498ab153d8 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query5.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query5.out
@@ -37,14 +37,14 @@ PhysicalResultSink
--------------------------hashAgg[LOCAL]
----------------------------PhysicalProject
------------------------------hashJoin[INNER_JOIN] hashCondition=((salesreturns.date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[cs_sold_date_sk,cr_returned_date_sk]
---------------------------------hashJoin[INNER_JOIN] hashCondition=((salesreturns.page_sk = catalog_page.cp_catalog_page_sk)) otherCondition=() build RFs:RF2 cp_catalog_page_sk->[cs_catalog_page_sk,cr_catalog_page_sk]
+--------------------------------hashJoin[INNER_JOIN] hashCondition=((salesreturns.page_sk = catalog_page.cp_catalog_page_sk)) otherCondition=()
----------------------------------PhysicalUnion
------------------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------------------PhysicalProject
-----------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3
+----------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF3
------------------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------------------PhysicalProject
-----------------------------------------PhysicalOlapScan[catalog_returns] apply RFs: RF2 RF3
+----------------------------------------PhysicalOlapScan[catalog_returns] apply RFs: RF3
----------------------------------PhysicalDistribute[DistributionSpecReplicated]
------------------------------------PhysicalProject
--------------------------------------PhysicalOlapScan[catalog_page]
@@ -58,16 +58,16 @@ PhysicalResultSink
--------------------------hashAgg[LOCAL]
----------------------------PhysicalProject
------------------------------hashJoin[INNER_JOIN] hashCondition=((salesreturns.date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF7 d_date_sk->[ws_sold_date_sk,wr_returned_date_sk]
---------------------------------hashJoin[INNER_JOIN] hashCondition=((salesreturns.wsr_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF6 web_site_sk->[ws_web_site_sk,ws_web_site_sk]
+--------------------------------hashJoin[INNER_JOIN] hashCondition=((salesreturns.wsr_web_site_sk = web_site.web_site_sk)) otherCondition=()
----------------------------------PhysicalUnion
------------------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------------------PhysicalProject
-----------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF6 RF7
+----------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF7
------------------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------------------PhysicalProject
----------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_item_sk = web_sales.ws_item_sk) and (web_returns.wr_order_number = web_sales.ws_order_number)) otherCondition=() build RFs:RF4 wr_item_sk->[ws_item_sk];RF5 wr_order_number->[ws_order_number]
------------------------------------------PhysicalProject
---------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF4 RF5 RF6
+--------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF4 RF5
------------------------------------------PhysicalProject
--------------------------------------------PhysicalOlapScan[web_returns] apply RFs: RF7
----------------------------------PhysicalDistribute[DistributionSpecReplicated]
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query59.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query59.out
index 12c4bec36a7..c9d5f568592 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query59.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query59.out
@@ -21,24 +21,24 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------------PhysicalProject
--------------hashJoin[INNER_JOIN] hashCondition=((d.d_week_seq = d_week_seq1)) otherCondition=() build RFs:RF5 d_week_seq->[d_week_seq]
----------------PhysicalProject
-------------------hashJoin[INNER_JOIN] hashCondition=((wss.ss_store_sk = store.s_store_sk) and (y.s_store_id1 = x.s_store_id2)) otherCondition=() build RFs:RF3 s_store_id1->[s_store_id];RF4 s_store_sk->[ss_store_sk]
+------------------hashJoin[INNER_JOIN] hashCondition=((wss.ss_store_sk = store.s_store_sk) and (y.s_store_id1 = x.s_store_id2)) otherCondition=()
--------------------PhysicalProject
-----------------------hashJoin[INNER_JOIN] hashCondition=((wss.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ss_store_sk]
+----------------------hashJoin[INNER_JOIN] hashCondition=((wss.ss_store_sk = store.s_store_sk)) otherCondition=()
------------------------hashJoin[INNER_JOIN] hashCondition=((d.d_week_seq = d_week_seq2)) otherCondition=() build RFs:RF1 d_week_seq->[d_week_seq]
--------------------------hashJoin[INNER_JOIN] hashCondition=((expr_cast(d_week_seq1 as BIGINT) = expr_(d_week_seq2 - 52))) otherCondition=()
----------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------PhysicalProject
---------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF5
----------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------PhysicalProject
---------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF1
--------------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------------PhysicalProject
------------------------------filter((d.d_month_seq <= 1219) and (d.d_month_seq >= 1208))
--------------------------------PhysicalOlapScan[date_dim]
------------------------PhysicalDistribute[DistributionSpecReplicated]
--------------------------PhysicalProject
-----------------------------PhysicalOlapScan[store] apply RFs: RF3
+----------------------------PhysicalOlapScan[store]
--------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------PhysicalProject
------------------------PhysicalOlapScan[store]
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query66.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query66.out
index 5e36cb17058..d43236abf2b 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query66.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query66.out
@@ -45,10 +45,10 @@ PhysicalResultSink
----------------------------PhysicalProject
------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF6 t_time_sk->[cs_sold_time_sk]
--------------------------------PhysicalProject
-----------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_warehouse_sk = warehouse.w_warehouse_sk)) otherCondition=() build RFs:RF5 w_warehouse_sk->[cs_warehouse_sk]
+----------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_warehouse_sk = warehouse.w_warehouse_sk)) otherCondition=()
------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[cs_sold_date_sk]
--------------------------------------PhysicalProject
-----------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF4 RF5 RF6 RF7
+----------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF4 RF6 RF7
--------------------------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------------------------PhysicalProject
------------------------------------------filter((date_dim.d_year = 1998))
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query76.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query76.out
index 95615ccb405..4943199ee55 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query76.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query76.out
@@ -24,12 +24,12 @@ PhysicalResultSink
--------------------------PhysicalOlapScan[date_dim]
----------------PhysicalDistribute[DistributionSpecExecutionAny]
------------------PhysicalProject
---------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ws_sold_date_sk]
+--------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
----------------------PhysicalProject
-------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[ws_item_sk]
+------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=()
--------------------------PhysicalProject
----------------------------filter(ws_bill_addr_sk IS NULL)
-------------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3
+------------------------------PhysicalOlapScan[web_sales]
--------------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------------PhysicalProject
------------------------------PhysicalOlapScan[item]
@@ -38,12 +38,12 @@ PhysicalResultSink
--------------------------PhysicalOlapScan[date_dim]
----------------PhysicalDistribute[DistributionSpecExecutionAny]
------------------PhysicalProject
---------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[cs_sold_date_sk]
+--------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=()
----------------------PhysicalProject
-------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF4 i_item_sk->[cs_item_sk]
+------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=()
--------------------------PhysicalProject
----------------------------filter(cs_warehouse_sk IS NULL)
-------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF4 RF5
+------------------------------PhysicalOlapScan[catalog_sales]
--------------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------------PhysicalProject
------------------------------PhysicalOlapScan[item]
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query77.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query77.out
index 6764e50528c..4c425894c8d 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query77.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query77.out
@@ -77,12 +77,12 @@ PhysicalResultSink
------------------------PhysicalProject
--------------------------hashAgg[LOCAL]
----------------------------PhysicalProject
-------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_web_page_sk = web_page.wp_web_page_sk)) otherCondition=() build RFs:RF9 wp_web_page_sk->[ws_web_page_sk]
+------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_web_page_sk = web_page.wp_web_page_sk)) otherCondition=()
--------------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------------PhysicalProject
------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF8 d_date_sk->[ws_sold_date_sk]
--------------------------------------PhysicalProject
-----------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF8 RF9
+----------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF8
--------------------------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------------------------PhysicalProject
------------------------------------------filter((date_dim.d_date <= '1998-09-04') and (date_dim.d_date >= '1998-08-05'))
@@ -94,12 +94,12 @@ PhysicalResultSink
--------------------------PhysicalProject
----------------------------hashAgg[LOCAL]
------------------------------PhysicalProject
---------------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_web_page_sk = web_page.wp_web_page_sk)) otherCondition=() build RFs:RF7 wp_web_page_sk->[wr_web_page_sk]
+--------------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_web_page_sk = web_page.wp_web_page_sk)) otherCondition=()
----------------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------------PhysicalProject
--------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_returned_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF6 d_date_sk->[wr_returned_date_sk]
----------------------------------------PhysicalProject
-------------------------------------------PhysicalOlapScan[web_returns] apply RFs: RF6 RF7
+------------------------------------------PhysicalOlapScan[web_returns] apply RFs: RF6
----------------------------------------PhysicalDistribute[DistributionSpecReplicated]
------------------------------------------PhysicalProject
--------------------------------------------filter((date_dim.d_date <= '1998-09-04') and (date_dim.d_date >= '1998-08-05'))
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query80.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query80.out
index e7f58efe831..1ea80fef13a 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query80.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query80.out
@@ -52,9 +52,9 @@ PhysicalResultSink
------------------------------------PhysicalProject
--------------------------------------hashJoin[LEFT_OUTER_JOIN] hashCondition=((catalog_sales.cs_item_sk = catalog_returns.cr_item_sk) and (catalog_sales.cs_order_number = catalog_returns.cr_order_number)) otherCondition=()
----------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF5 i_item_sk->[cs_item_sk]
-------------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_catalog_page_sk = catalog_page.cp_catalog_page_sk)) otherCondition=() build RFs:RF4 cp_catalog_page_sk->[cs_catalog_page_sk]
+------------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_catalog_page_sk = catalog_page.cp_catalog_page_sk)) otherCondition=()
--------------------------------------------PhysicalProject
-----------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF4 RF5 RF6 RF7
+----------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF5 RF6 RF7
--------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------------------------------PhysicalProject
------------------------------------------------PhysicalOlapScan[catalog_page]
@@ -79,13 +79,13 @@ PhysicalResultSink
----------------------------PhysicalProject
------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_promo_sk = promotion.p_promo_sk)) otherCondition=() build RFs:RF11 p_promo_sk->[ws_promo_sk]
--------------------------------PhysicalProject
-----------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF10 web_site_sk->[ws_web_site_sk]
+----------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_web_site_sk = web_site.web_site_sk)) otherCondition=()
------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF9 i_item_sk->[ws_item_sk]
--------------------------------------PhysicalProject
----------------------------------------hashJoin[LEFT_OUTER_JOIN] hashCondition=((web_sales.ws_item_sk = web_returns.wr_item_sk) and (web_sales.ws_order_number = web_returns.wr_order_number)) otherCondition=()
------------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF8 d_date_sk->[ws_sold_date_sk]
--------------------------------------------PhysicalProject
-----------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF8 RF9 RF10 RF11
+----------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF8 RF9 RF11
--------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------------------------------PhysicalProject
------------------------------------------------filter((date_dim.d_date <= '1998-09-27') and (date_dim.d_date >= '1998-08-28'))
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query81.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query81.out
index f38223b693a..a2307e48d0f 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query81.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query81.out
@@ -31,7 +31,7 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------------PhysicalProject
----------------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF2 c_customer_sk->[ctr_customer_sk]
------------------------PhysicalDistribute[DistributionSpecHash]
---------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF2
------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------PhysicalProject
----------------------------PhysicalOlapScan[customer] apply RFs: RF3
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query87.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query87.out
index 4014061fc9e..766ce582ad7 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query87.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query87.out
@@ -29,10 +29,10 @@ PhysicalResultSink
------------------hashAgg[LOCAL]
--------------------PhysicalProject
----------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[cs_sold_date_sk]
-------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF2 c_customer_sk->[cs_bill_customer_sk]
+------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_bill_customer_sk = customer.c_customer_sk)) otherCondition=()
--------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------PhysicalProject
-------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3
+------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF3
--------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------PhysicalProject
------------------------------PhysicalOlapScan[customer]
@@ -46,10 +46,10 @@ PhysicalResultSink
------------------hashAgg[LOCAL]
--------------------PhysicalProject
----------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[ws_sold_date_sk]
-------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF4 c_customer_sk->[ws_bill_customer_sk]
+------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_bill_customer_sk = customer.c_customer_sk)) otherCondition=()
--------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------PhysicalProject
-------------------------------PhysicalOlapScan[web_sales] apply RFs: RF4 RF5
+------------------------------PhysicalOlapScan[web_sales] apply RFs: RF5
--------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------PhysicalProject
------------------------------PhysicalOlapScan[customer]
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query95.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query95.out
index ef8fa368e6d..6e12e33b54d 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query95.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/noStatsRfPrune/query95.out
@@ -3,13 +3,13 @@
PhysicalCteAnchor ( cteId=CTEId#0 )
--PhysicalCteProducer ( cteId=CTEId#0 )
----PhysicalProject
-------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_order_number = ws2.ws_order_number)) otherCondition=(( not (ws_warehouse_sk = ws_warehouse_sk)))
+------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_order_number = ws2.ws_order_number)) otherCondition=(( not (ws_warehouse_sk = ws_warehouse_sk))) build RFs:RF0 ws_order_number->[ws_order_number]
--------PhysicalDistribute[DistributionSpecHash]
----------PhysicalProject
-------------PhysicalOlapScan[web_sales]
+------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF7
--------PhysicalDistribute[DistributionSpecHash]
----------PhysicalProject
-------------PhysicalOlapScan[web_sales]
+------------PhysicalOlapScan[web_sales] apply RFs: RF7
--PhysicalResultSink
----PhysicalTopN[MERGE_SORT]
------PhysicalTopN[LOCAL_SORT]
@@ -19,16 +19,16 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------hashAgg[GLOBAL]
----------------hashAgg[LOCAL]
------------------PhysicalProject
---------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=()
+--------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF6 ws_order_number->[ws_order_number]
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
---------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF6
----------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF5 web_site_sk->[ws_web_site_sk]
------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF4 ca_address_sk->[ws_ship_addr_sk]
--------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ws_ship_date_sk]
-----------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=() build RFs:RF2 ws_order_number->[ws_order_number,wr_order_number]
+----------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=() build RFs:RF7 ws_order_number->[ws_order_number,ws_order_number]
------------------------------PhysicalProject
---------------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF1 wr_order_number->[ws_order_number]
+--------------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=()
----------------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------------PhysicalProject
--------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query1.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query1.out
index d0f8900a566..e1300825fc2 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query1.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query1.out
@@ -25,7 +25,7 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------------------PhysicalDistribute[DistributionSpecHash]
--------------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF1 c_customer_sk->[ctr_customer_sk]
----------------------PhysicalDistribute[DistributionSpecHash]
-------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF1 RF2
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
--------------------------PhysicalOlapScan[customer]
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query14.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query14.out
index 82934d6f0b0..1daa8cb5ce1 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query14.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query14.out
@@ -100,15 +100,15 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------------hashAgg[LOCAL]
------------------------------------PhysicalProject
---------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF14 d_date_sk->[ss_sold_date_sk]
+--------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF13 d_date_sk->[ss_sold_date_sk]
----------------------------------------PhysicalProject
-------------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF13 i_item_sk->[ss_item_sk]
---------------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF12 ss_item_sk->[ss_item_sk]
+------------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF12 i_item_sk->[ss_item_sk,ss_item_sk]
+--------------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=()
----------------------------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------------------------PhysicalProject
---------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF12 RF13 RF14
+--------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF12 RF13
----------------------------------------------PhysicalDistribute[DistributionSpecHash]
-------------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+------------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF12
--------------------------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------------------------PhysicalProject
------------------------------------------------PhysicalOlapScan[item]
@@ -127,15 +127,15 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------------hashAgg[LOCAL]
------------------------------------PhysicalProject
---------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF17 d_date_sk->[cs_sold_date_sk]
+--------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF15 d_date_sk->[cs_sold_date_sk]
----------------------------------------PhysicalProject
-------------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF16 i_item_sk->[cs_item_sk]
---------------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF15 ss_item_sk->[cs_item_sk]
+------------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF14 i_item_sk->[cs_item_sk,ss_item_sk]
+--------------------------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=()
----------------------------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------------------------PhysicalProject
---------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF15 RF16 RF17
+--------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF14 RF15
----------------------------------------------PhysicalDistribute[DistributionSpecHash]
-------------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+------------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF14
--------------------------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------------------------PhysicalProject
------------------------------------------------PhysicalOlapScan[item]
@@ -154,15 +154,15 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------------hashAgg[LOCAL]
------------------------------------PhysicalProject
---------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF20 d_date_sk->[ws_sold_date_sk]
+--------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF18 d_date_sk->[ws_sold_date_sk]
----------------------------------------PhysicalProject
-------------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF19 i_item_sk->[ws_item_sk]
---------------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF18 ws_item_sk->[ss_item_sk]
+------------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF17 i_item_sk->[ws_item_sk,ss_item_sk]
+--------------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF16 ws_item_sk->[ss_item_sk]
----------------------------------------------PhysicalDistribute[DistributionSpecHash]
-------------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+------------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF16 RF17
----------------------------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------------------------PhysicalProject
---------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF19 RF20
+--------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF17 RF18
--------------------------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------------------------PhysicalProject
------------------------------------------------PhysicalOlapScan[item]
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query2.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query2.out
index 0d212217184..5d8e996d898 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query2.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query2.out
@@ -29,14 +29,14 @@ PhysicalCteAnchor ( cteId=CTEId#1 )
--------------------hashJoin[INNER_JOIN] hashCondition=((date_dim.d_week_seq = d_week_seq1)) otherCondition=() build RFs:RF1 d_week_seq->[d_week_seq]
----------------------PhysicalDistribute[DistributionSpecExecutionAny]
------------------------PhysicalProject
---------------------------PhysicalCteConsumer ( cteId=CTEId#1 )
+--------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) apply RFs: RF1
----------------------PhysicalDistribute[DistributionSpecReplicated]
------------------------PhysicalProject
--------------------------filter((date_dim.d_year = 1998))
----------------------------PhysicalOlapScan[date_dim]
----------------PhysicalDistribute[DistributionSpecHash]
------------------PhysicalProject
---------------------PhysicalCteConsumer ( cteId=CTEId#1 )
+--------------------PhysicalCteConsumer ( cteId=CTEId#1 ) apply RFs: RF2
--------------PhysicalDistribute[DistributionSpecReplicated]
----------------PhysicalProject
------------------filter((date_dim.d_year = 1999))
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query23.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query23.out
index 24ab3d18bde..6e97a9eafc3 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query23.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query23.out
@@ -57,11 +57,11 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------------------PhysicalProject
--------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = frequent_ss_items.item_sk)) otherCondition=()
----------------------PhysicalDistribute[DistributionSpecHash]
-------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[cs_sold_date_sk]
---------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[cs_bill_customer_sk]
+------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[cs_sold_date_sk]
+--------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=()
----------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------PhysicalProject
---------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF3 RF4
+--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF3
----------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------PhysicalProject
--------------------------------PhysicalCteConsumer ( cteId=CTEId#2 )
@@ -75,11 +75,11 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------------------PhysicalProject
--------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = frequent_ss_items.item_sk)) otherCondition=()
----------------------PhysicalDistribute[DistributionSpecHash]
-------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF6 d_date_sk->[ws_sold_date_sk]
---------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((web_sales.ws_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=() build RFs:RF5 c_customer_sk->[ws_bill_customer_sk]
+------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[ws_sold_date_sk]
+--------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((web_sales.ws_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=()
----------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------PhysicalProject
---------------------------------PhysicalOlapScan[web_sales] apply RFs: RF5 RF6
+--------------------------------PhysicalOlapScan[web_sales] apply RFs: RF4
----------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------PhysicalProject
--------------------------------PhysicalCteConsumer ( cteId=CTEId#2 )
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query30.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query30.out
index 509e53f182d..4190bf7300d 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query30.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query30.out
@@ -30,7 +30,7 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------------------PhysicalProject
--------------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF2 c_customer_sk->[ctr_customer_sk]
----------------------PhysicalDistribute[DistributionSpecHash]
-------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF2
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
--------------------------PhysicalOlapScan[customer] apply RFs: RF3
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query59.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query59.out
index 24bd0aea7b9..c5629b20255 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query59.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query59.out
@@ -28,10 +28,10 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------------------hashJoin[INNER_JOIN] hashCondition=((expr_cast(d_week_seq1 as BIGINT) = expr_(d_week_seq2 - 52))) otherCondition=()
----------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------PhysicalProject
---------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF4 RF5
----------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------PhysicalProject
---------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF1 RF2
--------------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------------PhysicalProject
------------------------------filter((d.d_month_seq <= 1219) and (d.d_month_seq >= 1208))
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query81.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query81.out
index b87814d1566..601cdffde57 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query81.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query81.out
@@ -31,7 +31,7 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------------PhysicalProject
----------------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF2 c_customer_sk->[ctr_customer_sk]
------------------------PhysicalDistribute[DistributionSpecHash]
---------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF2
------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------PhysicalProject
----------------------------PhysicalOlapScan[customer] apply RFs: RF3
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query95.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query95.out
index c977812d0a1..262c9046490 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query95.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/no_stats_shape/query95.out
@@ -6,10 +6,10 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_order_number = ws2.ws_order_number)) otherCondition=(( not (ws_warehouse_sk = ws_warehouse_sk))) build RFs:RF0 ws_order_number->[ws_order_number]
--------PhysicalDistribute[DistributionSpecHash]
----------PhysicalProject
-------------PhysicalOlapScan[web_sales] apply RFs: RF0
+------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF7
--------PhysicalDistribute[DistributionSpecHash]
----------PhysicalProject
-------------PhysicalOlapScan[web_sales]
+------------PhysicalOlapScan[web_sales] apply RFs: RF7
--PhysicalResultSink
----PhysicalTopN[MERGE_SORT]
------PhysicalTopN[LOCAL_SORT]
@@ -19,19 +19,19 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------hashAgg[GLOBAL]
----------------hashAgg[LOCAL]
------------------PhysicalProject
---------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=()
+--------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF6 ws_order_number->[ws_order_number]
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
---------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF6
----------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF5 web_site_sk->[ws_web_site_sk]
------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF4 ca_address_sk->[ws_ship_addr_sk]
--------------------------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ws_ship_date_sk]
-----------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=() build RFs:RF2 ws_order_number->[ws_order_number,wr_order_number]
+----------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=() build RFs:RF7 ws_order_number->[ws_order_number,ws_order_number]
------------------------------PhysicalProject
--------------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF1 wr_order_number->[ws_order_number]
----------------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------------PhysicalProject
---------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF1
----------------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------------PhysicalProject
--------------------------------------PhysicalOlapScan[web_returns] apply RFs: RF2
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query1.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query1.out
index 66550bfccf8..73dea99cdf9 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query1.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query1.out
@@ -19,16 +19,16 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------PhysicalDistribute[DistributionSpecGather]
--------PhysicalTopN[LOCAL_SORT]
----------PhysicalProject
-------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF2 ctr_customer_sk->[c_customer_sk]
+------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=()
--------------PhysicalDistribute[DistributionSpecHash]
----------------PhysicalProject
-------------------PhysicalOlapScan[customer] apply RFs: RF2
+------------------PhysicalOlapScan[customer]
--------------PhysicalDistribute[DistributionSpecHash]
----------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_store_sk = ctr2.ctr_store_sk)) otherCondition=((cast(ctr_total_return as DOUBLE) > cast((avg(cast(ctr_total_return as DECIMALV3(38, 4))) * 1.2) as DOUBLE)))
------------------PhysicalProject
--------------------hashJoin[INNER_JOIN] hashCondition=((store.s_store_sk = ctr1.ctr_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ctr_store_sk]
----------------------PhysicalDistribute[DistributionSpecExecutionAny]
-------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF1
----------------------PhysicalDistribute[DistributionSpecReplicated]
------------------------PhysicalProject
--------------------------filter((store.s_state = 'SD'))
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query14.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query14.out
index 65cafd1d150..a4f70cae0ed 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query14.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query14.out
@@ -27,10 +27,10 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------PhysicalDistribute[DistributionSpecHash]
----------------hashAgg[LOCAL]
------------------PhysicalProject
---------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = ics.i_item_sk)) otherCondition=() build RFs:RF3 i_item_sk->[cs_item_sk]
+--------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = ics.i_item_sk)) otherCondition=()
----------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = d2.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[cs_sold_date_sk]
------------------------PhysicalProject
---------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3
+--------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2
------------------------PhysicalDistribute[DistributionSpecReplicated]
--------------------------PhysicalProject
----------------------------filter((d2.d_year <= 2002) and (d2.d_year >= 2000))
@@ -42,11 +42,11 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------PhysicalDistribute[DistributionSpecHash]
----------------hashAgg[LOCAL]
------------------PhysicalProject
---------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = iws.i_item_sk)) otherCondition=() build RFs:RF5 i_item_sk->[ws_item_sk]
+--------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = iws.i_item_sk)) otherCondition=()
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = d3.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[ws_sold_date_sk]
--------------------------PhysicalProject
-----------------------------PhysicalOlapScan[web_sales] apply RFs: RF4 RF5
+----------------------------PhysicalOlapScan[web_sales] apply RFs: RF4
--------------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------------PhysicalProject
------------------------------filter((d3.d_year <= 2002) and (d3.d_year >= 2000))
@@ -106,12 +106,12 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------------------------------------PhysicalProject
--------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF14 ss_item_sk->[ss_item_sk]
----------------------------------------PhysicalDistribute[DistributionSpecHash]
-------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
-----------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF13 i_item_sk->[ss_item_sk]
+------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF14
+----------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=()
------------------------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF12 d_date_sk->[ss_sold_date_sk]
----------------------------------------------PhysicalProject
-------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF12 RF13
+------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF12
----------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
------------------------------------------------PhysicalProject
--------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002))
@@ -132,12 +132,12 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------------------------------------PhysicalProject
--------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF17 cs_item_sk->[ss_item_sk]
----------------------------------------PhysicalDistribute[DistributionSpecHash]
-------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
-----------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF16 i_item_sk->[cs_item_sk]
+------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF17
+----------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=()
------------------------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF15 d_date_sk->[cs_sold_date_sk]
----------------------------------------------PhysicalProject
-------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF15 RF16
+------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF15
----------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
------------------------------------------------PhysicalProject
--------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002))
@@ -158,12 +158,12 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------------------------------------PhysicalProject
--------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF20 ws_item_sk->[ss_item_sk]
----------------------------------------PhysicalDistribute[DistributionSpecHash]
-------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
-----------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF19 i_item_sk->[ws_item_sk]
+------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF20
+----------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=()
------------------------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF18 d_date_sk->[ws_sold_date_sk]
----------------------------------------------PhysicalProject
-------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF18 RF19
+------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF18
----------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
------------------------------------------------PhysicalProject
--------------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002))
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query2.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query2.out
index 3b3bde6bac4..f38c57d8bac 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query2.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query2.out
@@ -28,7 +28,7 @@ PhysicalCteAnchor ( cteId=CTEId#1 )
------------------hashJoin[INNER_JOIN] hashCondition=((date_dim.d_week_seq = d_week_seq1)) otherCondition=() build RFs:RF2 d_week_seq->[d_week_seq]
--------------------PhysicalDistribute[DistributionSpecExecutionAny]
----------------------PhysicalProject
-------------------------PhysicalCteConsumer ( cteId=CTEId#1 )
+------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) apply RFs: RF2
--------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------PhysicalProject
------------------------filter((date_dim.d_year = 1998))
@@ -38,7 +38,7 @@ PhysicalCteAnchor ( cteId=CTEId#1 )
------------------hashJoin[INNER_JOIN] hashCondition=((date_dim.d_week_seq = d_week_seq2)) otherCondition=() build RFs:RF1 d_week_seq->[d_week_seq]
--------------------PhysicalDistribute[DistributionSpecExecutionAny]
----------------------PhysicalProject
-------------------------PhysicalCteConsumer ( cteId=CTEId#1 )
+------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) apply RFs: RF1
--------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------PhysicalProject
------------------------filter((date_dim.d_year = 1999))
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query23.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query23.out
index 4ae641ee37d..85d3d22b2c3 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query23.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query23.out
@@ -56,17 +56,17 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------hashAgg[LOCAL]
----------------PhysicalUnion
------------------PhysicalProject
---------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = frequent_ss_items.item_sk)) otherCondition=()
+--------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = frequent_ss_items.item_sk)) otherCondition=() build RFs:RF4 cs_item_sk->[item_sk]
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
---------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF4
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
---------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=() build RFs:RF4 c_customer_sk->[cs_bill_customer_sk]
+--------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=()
----------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[cs_sold_date_sk]
--------------------------------PhysicalProject
-----------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF3 RF4
+----------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF3
--------------------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------------------PhysicalProject
------------------------------------filter((date_dim.d_moy = 5) and (date_dim.d_year = 2000))
@@ -75,17 +75,17 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------------------------------PhysicalProject
--------------------------------PhysicalCteConsumer ( cteId=CTEId#2 )
------------------PhysicalProject
---------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = frequent_ss_items.item_sk)) otherCondition=()
+--------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = frequent_ss_items.item_sk)) otherCondition=() build RFs:RF6 ws_item_sk->[item_sk]
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
---------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF6
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
---------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((web_sales.ws_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=() build RFs:RF6 c_customer_sk->[ws_bill_customer_sk]
+--------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((web_sales.ws_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=()
----------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[ws_sold_date_sk]
--------------------------------PhysicalProject
-----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF5 RF6
+----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF5
--------------------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------------------PhysicalProject
------------------------------------filter((date_dim.d_moy = 5) and (date_dim.d_year = 2000))
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query30.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query30.out
index 1455f420517..9f72a79a16e 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query30.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query30.out
@@ -29,7 +29,7 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------PhysicalProject
----------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ctr_customer_sk]
------------------PhysicalDistribute[DistributionSpecHash]
---------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF3
------------------PhysicalDistribute[DistributionSpecHash]
--------------------hashJoin[INNER_JOIN] hashCondition=((customer_address.ca_address_sk = customer.c_current_addr_sk)) otherCondition=() build RFs:RF2 ca_address_sk->[c_current_addr_sk]
----------------------PhysicalProject
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query31.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query31.out
index 3f3b3c5b8e9..835238e3d70 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query31.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query31.out
@@ -27,12 +27,12 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
----------PhysicalDistribute[DistributionSpecHash]
------------hashAgg[LOCAL]
--------------PhysicalProject
-----------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_bill_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF3 ca_address_sk->[ws_bill_addr_sk]
+----------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_bill_addr_sk = customer_address.ca_address_sk)) otherCondition=()
------------------PhysicalDistribute[DistributionSpecHash]
--------------------PhysicalProject
----------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_sold_date_sk]
------------------------PhysicalProject
---------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3
+--------------------------PhysicalOlapScan[web_sales] apply RFs: RF2
------------------------PhysicalDistribute[DistributionSpecReplicated]
--------------------------PhysicalProject
----------------------------filter((ws.d_year = 2000) and d_qoy IN (1, 2, 3))
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query33.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query33.out
index 4f960339fad..b84e41f1c4a 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query33.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query33.out
@@ -48,7 +48,7 @@ PhysicalResultSink
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------hashAgg[LOCAL]
--------------------------PhysicalProject
-----------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF6 i_item_sk->[cs_item_sk]
+----------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=()
------------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------------PhysicalProject
----------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_bill_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF5 ca_address_sk->[cs_bill_addr_sk]
@@ -56,7 +56,7 @@ PhysicalResultSink
--------------------------------------PhysicalProject
----------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[cs_sold_date_sk]
------------------------------------------PhysicalProject
---------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF4 RF5 RF6
+--------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF4 RF5
------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
--------------------------------------------PhysicalProject
----------------------------------------------filter((date_dim.d_moy = 1) and (date_dim.d_year = 2002))
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query38.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query38.out
index d7d71de6f46..2b490866508 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query38.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query38.out
@@ -31,12 +31,12 @@ PhysicalResultSink
--------------------PhysicalDistribute[DistributionSpecHash]
----------------------hashAgg[LOCAL]
------------------------PhysicalProject
---------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[cs_bill_customer_sk]
+--------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_bill_customer_sk = customer.c_customer_sk)) otherCondition=()
----------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------PhysicalProject
--------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[cs_sold_date_sk]
----------------------------------PhysicalProject
-------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3
+------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2
----------------------------------PhysicalDistribute[DistributionSpecReplicated]
------------------------------------PhysicalProject
--------------------------------------filter((date_dim.d_month_seq <= 1194) and (date_dim.d_month_seq >= 1183))
@@ -49,12 +49,12 @@ PhysicalResultSink
--------------------PhysicalDistribute[DistributionSpecHash]
----------------------hashAgg[LOCAL]
------------------------PhysicalProject
---------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF5 c_customer_sk->[ws_bill_customer_sk]
+--------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_bill_customer_sk = customer.c_customer_sk)) otherCondition=()
----------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------PhysicalProject
--------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[ws_sold_date_sk]
----------------------------------PhysicalProject
-------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF4 RF5
+------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF4
----------------------------------PhysicalDistribute[DistributionSpecReplicated]
------------------------------------PhysicalProject
--------------------------------------filter((date_dim.d_month_seq <= 1194) and (date_dim.d_month_seq >= 1183))
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query5.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query5.out
index cfdbc1f258b..9d8fb659c2c 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query5.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query5.out
@@ -37,16 +37,16 @@ PhysicalResultSink
------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------hashAgg[LOCAL]
----------------------------PhysicalProject
-------------------------------hashJoin[INNER_JOIN] hashCondition=((salesreturns.page_sk = catalog_page.cp_catalog_page_sk)) otherCondition=() build RFs:RF3 cp_catalog_page_sk->[cs_catalog_page_sk,cr_catalog_page_sk]
+------------------------------hashJoin[INNER_JOIN] hashCondition=((salesreturns.page_sk = catalog_page.cp_catalog_page_sk)) otherCondition=()
--------------------------------PhysicalProject
----------------------------------hashJoin[INNER_JOIN] hashCondition=((salesreturns.date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[cs_sold_date_sk,cr_returned_date_sk]
------------------------------------PhysicalUnion
--------------------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------------------PhysicalProject
-------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3
+------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2
--------------------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------------------PhysicalProject
-------------------------------------------PhysicalOlapScan[catalog_returns] apply RFs: RF2 RF3
+------------------------------------------PhysicalOlapScan[catalog_returns] apply RFs: RF2
------------------------------------PhysicalDistribute[DistributionSpecReplicated]
--------------------------------------PhysicalProject
----------------------------------------filter((date_dim.d_date <= '2000-09-02') and (date_dim.d_date >= '2000-08-19'))
@@ -59,18 +59,18 @@ PhysicalResultSink
------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------hashAgg[LOCAL]
----------------------------PhysicalProject
-------------------------------hashJoin[INNER_JOIN] hashCondition=((salesreturns.wsr_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF7 web_site_sk->[ws_web_site_sk,ws_web_site_sk]
+------------------------------hashJoin[INNER_JOIN] hashCondition=((salesreturns.wsr_web_site_sk = web_site.web_site_sk)) otherCondition=()
--------------------------------PhysicalProject
----------------------------------hashJoin[INNER_JOIN] hashCondition=((salesreturns.date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF6 d_date_sk->[ws_sold_date_sk,wr_returned_date_sk]
------------------------------------PhysicalUnion
--------------------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------------------PhysicalProject
-------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF6 RF7
+------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF6
--------------------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------------------PhysicalProject
------------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_item_sk = web_sales.ws_item_sk) and (web_returns.wr_order_number = web_sales.ws_order_number)) otherCondition=() build RFs:RF4 wr_item_sk->[ws_item_sk];RF5 wr_order_number->[ws_order_number]
--------------------------------------------PhysicalProject
-----------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF4 RF5 RF7
+----------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF4 RF5
--------------------------------------------PhysicalProject
----------------------------------------------PhysicalOlapScan[web_returns] apply RFs: RF6
------------------------------------PhysicalDistribute[DistributionSpecReplicated]
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query59.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query59.out
index 56c5d519057..43445831c5c 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query59.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query59.out
@@ -19,28 +19,28 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------PhysicalDistribute[DistributionSpecGather]
----------PhysicalTopN[LOCAL_SORT]
------------PhysicalProject
---------------hashJoin[INNER_JOIN] hashCondition=((expr_cast(d_week_seq1 as BIGINT) = expr_(d_week_seq2 - 52)) and (y.s_store_id1 = x.s_store_id2)) otherCondition=()
+--------------hashJoin[INNER_JOIN] hashCondition=((expr_cast(d_week_seq1 as BIGINT) = expr_(d_week_seq2 - 52)) and (y.s_store_id1 = x.s_store_id2)) otherCondition=() build RFs:RF5 s_store_id2->[s_store_id]
----------------PhysicalDistribute[DistributionSpecHash]
------------------PhysicalProject
--------------------hashJoin[INNER_JOIN] hashCondition=((wss.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF4 s_store_sk->[ss_store_sk]
----------------------hashJoin[INNER_JOIN] hashCondition=((d.d_week_seq = d_week_seq1)) otherCondition=() build RFs:RF3 d_week_seq->[d_week_seq]
------------------------PhysicalDistribute[DistributionSpecExecutionAny]
--------------------------PhysicalProject
-----------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+----------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF3 RF4
------------------------PhysicalDistribute[DistributionSpecReplicated]
--------------------------PhysicalProject
----------------------------filter((d.d_month_seq <= 1207) and (d.d_month_seq >= 1196))
------------------------------PhysicalOlapScan[date_dim]
----------------------PhysicalDistribute[DistributionSpecReplicated]
------------------------PhysicalProject
---------------------------PhysicalOlapScan[store]
+--------------------------PhysicalOlapScan[store] apply RFs: RF5
----------------PhysicalDistribute[DistributionSpecHash]
------------------PhysicalProject
---------------------hashJoin[INNER_JOIN] hashCondition=((wss.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ss_store_sk]
+--------------------hashJoin[INNER_JOIN] hashCondition=((wss.ss_store_sk = store.s_store_sk)) otherCondition=()
----------------------hashJoin[INNER_JOIN] hashCondition=((d.d_week_seq = d_week_seq2)) otherCondition=() build RFs:RF1 d_week_seq->[d_week_seq]
------------------------PhysicalDistribute[DistributionSpecExecutionAny]
--------------------------PhysicalProject
-----------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+----------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF1
------------------------PhysicalDistribute[DistributionSpecReplicated]
--------------------------PhysicalProject
----------------------------filter((d.d_month_seq <= 1219) and (d.d_month_seq >= 1208))
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query66.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query66.out
index 22bb067cd53..a5c900ccdc2 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query66.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query66.out
@@ -41,14 +41,14 @@ PhysicalResultSink
--------------------PhysicalDistribute[DistributionSpecHash]
----------------------hashAgg[LOCAL]
------------------------PhysicalProject
---------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_warehouse_sk = warehouse.w_warehouse_sk)) otherCondition=() build RFs:RF7 w_warehouse_sk->[cs_warehouse_sk]
+--------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_warehouse_sk = warehouse.w_warehouse_sk)) otherCondition=()
----------------------------PhysicalProject
------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF6 t_time_sk->[cs_sold_time_sk]
--------------------------------PhysicalProject
----------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[cs_sold_date_sk]
------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_ship_mode_sk = ship_mode.sm_ship_mode_sk)) otherCondition=() build RFs:RF4 sm_ship_mode_sk->[cs_ship_mode_sk]
--------------------------------------PhysicalProject
-----------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF4 RF5 RF6 RF7
+----------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF4 RF5 RF6
--------------------------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------------------------PhysicalProject
------------------------------------------filter(sm_carrier IN ('GREAT EASTERN', 'LATVIAN'))
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query77.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query77.out
index 1ac424b09c4..73ee6191d24 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query77.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query77.out
@@ -80,11 +80,11 @@ PhysicalResultSink
----------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------hashAgg[LOCAL]
--------------------------------PhysicalProject
-----------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_web_page_sk = web_page.wp_web_page_sk)) otherCondition=() build RFs:RF9 wp_web_page_sk->[ws_web_page_sk]
+----------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_web_page_sk = web_page.wp_web_page_sk)) otherCondition=()
------------------------------------PhysicalProject
--------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF8 d_date_sk->[ws_sold_date_sk]
----------------------------------------PhysicalProject
-------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF8 RF9
+------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF8
----------------------------------------PhysicalDistribute[DistributionSpecReplicated]
------------------------------------------PhysicalProject
--------------------------------------------filter((date_dim.d_date <= '1998-09-04') and (date_dim.d_date >= '1998-08-05'))
@@ -95,12 +95,12 @@ PhysicalResultSink
------------------------PhysicalProject
--------------------------hashAgg[LOCAL]
----------------------------PhysicalProject
-------------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_web_page_sk = web_page.wp_web_page_sk)) otherCondition=() build RFs:RF7 wp_web_page_sk->[wr_web_page_sk]
+------------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_web_page_sk = web_page.wp_web_page_sk)) otherCondition=()
--------------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------------PhysicalProject
------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_returned_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF6 d_date_sk->[wr_returned_date_sk]
--------------------------------------PhysicalProject
-----------------------------------------PhysicalOlapScan[web_returns] apply RFs: RF6 RF7
+----------------------------------------PhysicalOlapScan[web_returns] apply RFs: RF6
--------------------------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------------------------PhysicalProject
------------------------------------------filter((date_dim.d_date <= '1998-09-04') and (date_dim.d_date >= '1998-08-05'))
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query80.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query80.out
index 3764d694381..62e6b9716b6 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query80.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query80.out
@@ -46,7 +46,7 @@ PhysicalResultSink
------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------hashAgg[LOCAL]
----------------------------PhysicalProject
-------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_catalog_page_sk = catalog_page.cp_catalog_page_sk)) otherCondition=() build RFs:RF11 cp_catalog_page_sk->[cs_catalog_page_sk]
+------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_catalog_page_sk = catalog_page.cp_catalog_page_sk)) otherCondition=()
--------------------------------PhysicalProject
----------------------------------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((catalog_sales.cs_item_sk = catalog_returns.cr_item_sk) and (catalog_sales.cs_order_number = catalog_returns.cr_order_number)) otherCondition=() build RFs:RF9 cs_item_sk->[cr_item_sk];RF10 cs_order_number->[cr_order_number]
------------------------------------PhysicalProject
@@ -56,7 +56,7 @@ PhysicalResultSink
----------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF7 i_item_sk->[cs_item_sk]
------------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF6 d_date_sk->[cs_sold_date_sk]
--------------------------------------------PhysicalProject
-----------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF6 RF7 RF8 RF11
+----------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF6 RF7 RF8
--------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------------------------------PhysicalProject
------------------------------------------------filter((date_dim.d_date <= '1998-09-27') and (date_dim.d_date >= '1998-08-28'))
@@ -81,13 +81,13 @@ PhysicalResultSink
--------------------------------PhysicalProject
----------------------------------PhysicalOlapScan[web_returns] apply RFs: RF16 RF17
--------------------------------PhysicalProject
-----------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF15 web_site_sk->[ws_web_site_sk]
+----------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_web_site_sk = web_site.web_site_sk)) otherCondition=()
------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_promo_sk = promotion.p_promo_sk)) otherCondition=() build RFs:RF14 p_promo_sk->[ws_promo_sk]
--------------------------------------PhysicalProject
----------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF13 i_item_sk->[ws_item_sk]
------------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF12 d_date_sk->[ws_sold_date_sk]
--------------------------------------------PhysicalProject
-----------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF12 RF13 RF14 RF15
+----------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF12 RF13 RF14
--------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------------------------------PhysicalProject
------------------------------------------------filter((date_dim.d_date <= '1998-09-27') and (date_dim.d_date >= '1998-08-28'))
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query81.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query81.out
index a684a664a3b..9b9a03af8fe 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query81.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query81.out
@@ -29,7 +29,7 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------PhysicalProject
----------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ctr_customer_sk]
------------------PhysicalDistribute[DistributionSpecHash]
---------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF3
------------------PhysicalDistribute[DistributionSpecHash]
--------------------hashJoin[INNER_JOIN] hashCondition=((customer_address.ca_address_sk = customer.c_current_addr_sk)) otherCondition=() build RFs:RF2 ca_address_sk->[c_current_addr_sk]
----------------------PhysicalDistribute[DistributionSpecHash]
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query87.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query87.out
index 4ed67c23320..da9a5d873be 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query87.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query87.out
@@ -29,12 +29,12 @@ PhysicalResultSink
----------------PhysicalDistribute[DistributionSpecHash]
------------------hashAgg[LOCAL]
--------------------PhysicalProject
-----------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[cs_bill_customer_sk]
+----------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_bill_customer_sk = customer.c_customer_sk)) otherCondition=()
------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------PhysicalProject
----------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[cs_sold_date_sk]
------------------------------PhysicalProject
---------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3
+--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2
------------------------------PhysicalDistribute[DistributionSpecReplicated]
--------------------------------PhysicalProject
----------------------------------filter((date_dim.d_month_seq <= 1195) and (date_dim.d_month_seq >= 1184))
@@ -47,12 +47,12 @@ PhysicalResultSink
----------------PhysicalDistribute[DistributionSpecHash]
------------------hashAgg[LOCAL]
--------------------PhysicalProject
-----------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF5 c_customer_sk->[ws_bill_customer_sk]
+----------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_bill_customer_sk = customer.c_customer_sk)) otherCondition=()
------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------PhysicalProject
----------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[ws_sold_date_sk]
------------------------------PhysicalProject
---------------------------------PhysicalOlapScan[web_sales] apply RFs: RF4 RF5
+--------------------------------PhysicalOlapScan[web_sales] apply RFs: RF4
------------------------------PhysicalDistribute[DistributionSpecReplicated]
--------------------------------PhysicalProject
----------------------------------filter((date_dim.d_month_seq <= 1195) and (date_dim.d_month_seq >= 1184))
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query95.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query95.out
index 4973a40f076..f4c9f48d172 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query95.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query95.out
@@ -6,10 +6,10 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_order_number = ws2.ws_order_number)) otherCondition=(( not (ws_warehouse_sk = ws_warehouse_sk))) build RFs:RF0 ws_order_number->[ws_order_number]
--------PhysicalDistribute[DistributionSpecHash]
----------PhysicalProject
-------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF6 RF7
+------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF7
--------PhysicalDistribute[DistributionSpecHash]
----------PhysicalProject
-------------PhysicalOlapScan[web_sales] apply RFs: RF6 RF7
+------------PhysicalOlapScan[web_sales] apply RFs: RF7
--PhysicalResultSink
----PhysicalTopN[MERGE_SORT]
------PhysicalTopN[LOCAL_SORT]
@@ -19,16 +19,16 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------hashAgg[GLOBAL]
----------------hashAgg[LOCAL]
------------------PhysicalProject
---------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=()
+--------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=() build RFs:RF6 ws_order_number->[ws_order_number,wr_order_number]
----------------------PhysicalProject
-------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF5 wr_order_number->[ws_order_number];RF7 wr_order_number->[ws_order_number,ws_order_number]
+------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=()
--------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------PhysicalProject
-------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF6
--------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------PhysicalProject
-------------------------------PhysicalOlapScan[web_returns]
-----------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF4 ws_order_number->[ws_order_number];RF6 ws_order_number->[ws_order_number,ws_order_number]
+------------------------------PhysicalOlapScan[web_returns] apply RFs: RF6
+----------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF7 ws_order_number->[ws_order_number,ws_order_number]
------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------PhysicalProject
----------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query1.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query1.out
index 66550bfccf8..73dea99cdf9 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query1.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query1.out
@@ -19,16 +19,16 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------PhysicalDistribute[DistributionSpecGather]
--------PhysicalTopN[LOCAL_SORT]
----------PhysicalProject
-------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF2 ctr_customer_sk->[c_customer_sk]
+------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=()
--------------PhysicalDistribute[DistributionSpecHash]
----------------PhysicalProject
-------------------PhysicalOlapScan[customer] apply RFs: RF2
+------------------PhysicalOlapScan[customer]
--------------PhysicalDistribute[DistributionSpecHash]
----------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_store_sk = ctr2.ctr_store_sk)) otherCondition=((cast(ctr_total_return as DOUBLE) > cast((avg(cast(ctr_total_return as DECIMALV3(38, 4))) * 1.2) as DOUBLE)))
------------------PhysicalProject
--------------------hashJoin[INNER_JOIN] hashCondition=((store.s_store_sk = ctr1.ctr_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ctr_store_sk]
----------------------PhysicalDistribute[DistributionSpecExecutionAny]
-------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF1
----------------------PhysicalDistribute[DistributionSpecReplicated]
------------------------PhysicalProject
--------------------------filter((store.s_state = 'SD'))
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query14.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query14.out
index eddff073c83..69a8888f2a7 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query14.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query14.out
@@ -106,7 +106,7 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------------------------------------PhysicalProject
--------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF14 ss_item_sk->[ss_item_sk]
----------------------------------------PhysicalDistribute[DistributionSpecHash]
-------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF14
----------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF13 i_item_sk->[ss_item_sk]
------------------------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------------------------hashJoin[INNER_JOIN] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF12 d_date_sk->[ss_sold_date_sk]
@@ -132,7 +132,7 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------------------------------------PhysicalProject
--------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF17 cs_item_sk->[ss_item_sk]
----------------------------------------PhysicalDistribute[DistributionSpecHash]
-------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF17
----------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF16 i_item_sk->[cs_item_sk]
------------------------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF15 d_date_sk->[cs_sold_date_sk]
@@ -158,7 +158,7 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------------------------------------PhysicalProject
--------------------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF20 ws_item_sk->[ss_item_sk]
----------------------------------------PhysicalDistribute[DistributionSpecHash]
-------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF20
----------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF19 i_item_sk->[ws_item_sk]
------------------------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF18 d_date_sk->[ws_sold_date_sk]
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query2.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query2.out
index 69e7fe08ddc..63360e2ffb3 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query2.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query2.out
@@ -28,7 +28,7 @@ PhysicalCteAnchor ( cteId=CTEId#1 )
------------------hashJoin[INNER_JOIN] hashCondition=((date_dim.d_week_seq = d_week_seq1)) otherCondition=() build RFs:RF2 d_week_seq->[d_week_seq]
--------------------PhysicalDistribute[DistributionSpecExecutionAny]
----------------------PhysicalProject
-------------------------PhysicalCteConsumer ( cteId=CTEId#1 )
+------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) apply RFs: RF2
--------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------PhysicalProject
------------------------filter((date_dim.d_year = 1998))
@@ -38,7 +38,7 @@ PhysicalCteAnchor ( cteId=CTEId#1 )
------------------hashJoin[INNER_JOIN] hashCondition=((date_dim.d_week_seq = d_week_seq2)) otherCondition=() build RFs:RF1 d_week_seq->[d_week_seq]
--------------------PhysicalDistribute[DistributionSpecExecutionAny]
----------------------PhysicalProject
-------------------------PhysicalCteConsumer ( cteId=CTEId#1 )
+------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) apply RFs: RF1
--------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------PhysicalProject
------------------------filter((date_dim.d_year = 1999))
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query23.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query23.out
index 40248cb8300..8491810ebf8 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query23.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query23.out
@@ -56,17 +56,17 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------hashAgg[LOCAL]
----------------PhysicalUnion
------------------PhysicalProject
---------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = frequent_ss_items.item_sk)) otherCondition=()
+--------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((catalog_sales.cs_item_sk = frequent_ss_items.item_sk)) otherCondition=() build RFs:RF4 cs_item_sk->[item_sk]
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
---------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF4
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
---------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=() build RFs:RF4 c_customer_sk->[cs_bill_customer_sk]
+--------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((catalog_sales.cs_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=()
----------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------hashJoin[INNER_JOIN] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[cs_sold_date_sk]
--------------------------------PhysicalProject
-----------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF3 RF4
+----------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF3
--------------------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------------------PhysicalProject
------------------------------------filter((date_dim.d_moy = 5) and (date_dim.d_year = 2000))
@@ -75,17 +75,17 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------------------------------PhysicalProject
--------------------------------PhysicalCteConsumer ( cteId=CTEId#2 )
------------------PhysicalProject
---------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = frequent_ss_items.item_sk)) otherCondition=()
+--------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((web_sales.ws_item_sk = frequent_ss_items.item_sk)) otherCondition=() build RFs:RF6 ws_item_sk->[item_sk]
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
---------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF6
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
---------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((web_sales.ws_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=() build RFs:RF6 c_customer_sk->[ws_bill_customer_sk]
+--------------------------hashJoin[LEFT_SEMI_JOIN] hashCondition=((web_sales.ws_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=()
----------------------------PhysicalDistribute[DistributionSpecHash]
------------------------------hashJoin[INNER_JOIN] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[ws_sold_date_sk]
--------------------------------PhysicalProject
-----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF5 RF6
+----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF5
--------------------------------PhysicalDistribute[DistributionSpecReplicated]
----------------------------------PhysicalProject
------------------------------------filter((date_dim.d_moy = 5) and (date_dim.d_year = 2000))
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query30.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query30.out
index c70c5d0dda6..0160329ec26 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query30.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query30.out
@@ -29,7 +29,7 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------PhysicalProject
----------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ctr_customer_sk]
------------------PhysicalDistribute[DistributionSpecHash]
---------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF3
------------------PhysicalDistribute[DistributionSpecHash]
--------------------hashJoin[INNER_JOIN] hashCondition=((customer_address.ca_address_sk = customer.c_current_addr_sk)) otherCondition=() build RFs:RF2 ca_address_sk->[c_current_addr_sk]
----------------------PhysicalProject
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query59.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query59.out
index e43fadf4ebc..7c291bd9903 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query59.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query59.out
@@ -19,28 +19,28 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------PhysicalDistribute[DistributionSpecGather]
----------PhysicalTopN[LOCAL_SORT]
------------PhysicalProject
---------------hashJoin[INNER_JOIN] hashCondition=((expr_cast(d_week_seq1 as BIGINT) = expr_(d_week_seq2 - 52)) and (y.s_store_id1 = x.s_store_id2)) otherCondition=()
+--------------hashJoin[INNER_JOIN] hashCondition=((expr_cast(d_week_seq1 as BIGINT) = expr_(d_week_seq2 - 52)) and (y.s_store_id1 = x.s_store_id2)) otherCondition=() build RFs:RF5 s_store_id2->[s_store_id]
----------------PhysicalDistribute[DistributionSpecHash]
------------------PhysicalProject
--------------------hashJoin[INNER_JOIN] hashCondition=((wss.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF4 s_store_sk->[ss_store_sk]
----------------------hashJoin[INNER_JOIN] hashCondition=((d.d_week_seq = d_week_seq1)) otherCondition=() build RFs:RF3 d_week_seq->[d_week_seq]
------------------------PhysicalDistribute[DistributionSpecExecutionAny]
--------------------------PhysicalProject
-----------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+----------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF3 RF4
------------------------PhysicalDistribute[DistributionSpecReplicated]
--------------------------PhysicalProject
----------------------------filter((d.d_month_seq <= 1207) and (d.d_month_seq >= 1196))
------------------------------PhysicalOlapScan[date_dim]
----------------------PhysicalDistribute[DistributionSpecReplicated]
------------------------PhysicalProject
---------------------------PhysicalOlapScan[store]
+--------------------------PhysicalOlapScan[store] apply RFs: RF5
----------------PhysicalDistribute[DistributionSpecHash]
------------------PhysicalProject
--------------------hashJoin[INNER_JOIN] hashCondition=((wss.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ss_store_sk]
----------------------hashJoin[INNER_JOIN] hashCondition=((d.d_week_seq = d_week_seq2)) otherCondition=() build RFs:RF1 d_week_seq->[d_week_seq]
------------------------PhysicalDistribute[DistributionSpecExecutionAny]
--------------------------PhysicalProject
-----------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+----------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF1 RF2
------------------------PhysicalDistribute[DistributionSpecReplicated]
--------------------------PhysicalProject
----------------------------filter((d.d_month_seq <= 1219) and (d.d_month_seq >= 1208))
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query81.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query81.out
index 7fcc5b06b29..aa637bc6469 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query81.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query81.out
@@ -29,7 +29,7 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------PhysicalProject
----------------hashJoin[INNER_JOIN] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ctr_customer_sk]
------------------PhysicalDistribute[DistributionSpecHash]
---------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+--------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF3
------------------PhysicalDistribute[DistributionSpecHash]
--------------------hashJoin[INNER_JOIN] hashCondition=((customer_address.ca_address_sk = customer.c_current_addr_sk)) otherCondition=() build RFs:RF2 ca_address_sk->[c_current_addr_sk]
----------------------PhysicalDistribute[DistributionSpecHash]
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query95.out b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query95.out
index 4973a40f076..a2c6bccca1e 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query95.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query95.out
@@ -6,10 +6,10 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
------hashJoin[INNER_JOIN] hashCondition=((ws1.ws_order_number = ws2.ws_order_number)) otherCondition=(( not (ws_warehouse_sk = ws_warehouse_sk))) build RFs:RF0 ws_order_number->[ws_order_number]
--------PhysicalDistribute[DistributionSpecHash]
----------PhysicalProject
-------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF6 RF7
+------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF7
--------PhysicalDistribute[DistributionSpecHash]
----------PhysicalProject
-------------PhysicalOlapScan[web_sales] apply RFs: RF6 RF7
+------------PhysicalOlapScan[web_sales] apply RFs: RF7
--PhysicalResultSink
----PhysicalTopN[MERGE_SORT]
------PhysicalTopN[LOCAL_SORT]
@@ -19,16 +19,16 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
--------------hashAgg[GLOBAL]
----------------hashAgg[LOCAL]
------------------PhysicalProject
---------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=()
+--------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=() build RFs:RF6 ws_order_number->[ws_order_number,wr_order_number]
----------------------PhysicalProject
-------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF5 wr_order_number->[ws_order_number];RF7 wr_order_number->[ws_order_number,ws_order_number]
+------------------------hashJoin[INNER_JOIN] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF5 wr_order_number->[ws_order_number]
--------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------PhysicalProject
-------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF5 RF6
--------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------PhysicalProject
-------------------------------PhysicalOlapScan[web_returns]
-----------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF4 ws_order_number->[ws_order_number];RF6 ws_order_number->[ws_order_number,ws_order_number]
+------------------------------PhysicalOlapScan[web_returns] apply RFs: RF6
+----------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF7 ws_order_number->[ws_order_number,ws_order_number]
------------------------PhysicalDistribute[DistributionSpecHash]
--------------------------PhysicalProject
----------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
diff --git a/regression-test/data/nereids_tpch_shape_sf1000_p0/nostats_rf_prune/q21.out b/regression-test/data/nereids_tpch_shape_sf1000_p0/nostats_rf_prune/q21.out
index 44dc87ff59a..87fee9b93ff 100644
--- a/regression-test/data/nereids_tpch_shape_sf1000_p0/nostats_rf_prune/q21.out
+++ b/regression-test/data/nereids_tpch_shape_sf1000_p0/nostats_rf_prune/q21.out
@@ -12,10 +12,10 @@ PhysicalResultSink
------------------PhysicalProject
--------------------hashJoin[INNER_JOIN] hashCondition=((supplier.s_suppkey = l1.l_suppkey)) otherCondition=() build RFs:RF3 s_suppkey->[l_suppkey]
----------------------PhysicalDistribute[DistributionSpecHash]
-------------------------hashJoin[INNER_JOIN] hashCondition=((orders.o_orderkey = l1.l_orderkey)) otherCondition=() build RFs:RF2 o_orderkey->[l_orderkey]
+------------------------hashJoin[INNER_JOIN] hashCondition=((orders.o_orderkey = l1.l_orderkey)) otherCondition=() build RFs:RF2 o_orderkey->[l_orderkey,l_orderkey]
--------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((l2.l_orderkey = l1.l_orderkey)) otherCondition=(( not (l_suppkey = l_suppkey))) build RFs:RF1 l_orderkey->[l_orderkey]
----------------------------PhysicalProject
-------------------------------PhysicalOlapScan[lineitem] apply RFs: RF1
+------------------------------PhysicalOlapScan[lineitem] apply RFs: RF1 RF2
----------------------------hashJoin[RIGHT_ANTI_JOIN] hashCondition=((l3.l_orderkey = l1.l_orderkey)) otherCondition=(( not (l_suppkey = l_suppkey))) build RFs:RF0 l_orderkey->[l_orderkey]
------------------------------PhysicalProject
--------------------------------filter((l3.l_receiptdate > l3.l_commitdate))
diff --git a/regression-test/data/nereids_tpch_shape_sf1000_p0/shape_no_stats/q21.out b/regression-test/data/nereids_tpch_shape_sf1000_p0/shape_no_stats/q21.out
index 44dc87ff59a..87fee9b93ff 100644
--- a/regression-test/data/nereids_tpch_shape_sf1000_p0/shape_no_stats/q21.out
+++ b/regression-test/data/nereids_tpch_shape_sf1000_p0/shape_no_stats/q21.out
@@ -12,10 +12,10 @@ PhysicalResultSink
------------------PhysicalProject
--------------------hashJoin[INNER_JOIN] hashCondition=((supplier.s_suppkey = l1.l_suppkey)) otherCondition=() build RFs:RF3 s_suppkey->[l_suppkey]
----------------------PhysicalDistribute[DistributionSpecHash]
-------------------------hashJoin[INNER_JOIN] hashCondition=((orders.o_orderkey = l1.l_orderkey)) otherCondition=() build RFs:RF2 o_orderkey->[l_orderkey]
+------------------------hashJoin[INNER_JOIN] hashCondition=((orders.o_orderkey = l1.l_orderkey)) otherCondition=() build RFs:RF2 o_orderkey->[l_orderkey,l_orderkey]
--------------------------hashJoin[RIGHT_SEMI_JOIN] hashCondition=((l2.l_orderkey = l1.l_orderkey)) otherCondition=(( not (l_suppkey = l_suppkey))) build RFs:RF1 l_orderkey->[l_orderkey]
----------------------------PhysicalProject
-------------------------------PhysicalOlapScan[lineitem] apply RFs: RF1
+------------------------------PhysicalOlapScan[lineitem] apply RFs: RF1 RF2
----------------------------hashJoin[RIGHT_ANTI_JOIN] hashCondition=((l3.l_orderkey = l1.l_orderkey)) otherCondition=(( not (l_suppkey = l_suppkey))) build RFs:RF0 l_orderkey->[l_orderkey]
------------------------------PhysicalProject
--------------------------------filter((l3.l_receiptdate > l3.l_commitdate))
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/ddl/shape.tmpl b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/ddl/shape.tmpl
index 24519d50e49..d172804f48f 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/ddl/shape.tmpl
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/ddl/shape.tmpl
@@ -30,7 +30,7 @@ suite("query{--}") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """{query}"""
qt_ds_shape_{--} '''
explain shape plan
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query1.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query1.groovy
index 26e49347783..8dc4a378f89 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query1.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query1.groovy
@@ -30,7 +30,7 @@ suite("query1") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with customer_total_return as
(select sr_customer_sk as ctr_customer_sk
,sr_store_sk as ctr_store_sk
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query10.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query10.groovy
index 03b1d2bca94..2e51ad1a011 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query10.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query10.groovy
@@ -30,7 +30,7 @@ suite("query10") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select
cd_gender,
cd_marital_status,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query11.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query11.groovy
index f7bcf22622a..a61c145cc42 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query11.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query11.groovy
@@ -30,7 +30,7 @@ suite("query11") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with year_total as (
select c_customer_id customer_id
,c_first_name customer_first_name
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query12.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query12.groovy
index 4e512d43c28..2b262c61b69 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query12.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query12.groovy
@@ -30,7 +30,7 @@ suite("query12") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select i_item_id
,i_item_desc
,i_category
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query13.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query13.groovy
index 2f3d00c324c..afc5ba660c7 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query13.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query13.groovy
@@ -30,7 +30,7 @@ suite("query13") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select avg(ss_quantity)
,avg(ss_ext_sales_price)
,avg(ss_ext_wholesale_cost)
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query14.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query14.groovy
index 47a7ee463aa..59497dfbf6b 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query14.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query14.groovy
@@ -30,7 +30,7 @@ suite("query14") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with cross_items as
(select i_item_sk ss_item_sk
from item,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query15.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query15.groovy
index 91b7e5a036c..b2bb27b6197 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query15.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query15.groovy
@@ -30,7 +30,7 @@ suite("query15") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select ca_zip
,sum(cs_sales_price)
from catalog_sales
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query16.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query16.groovy
index 0ae40d15fc1..3fa9ea8af6f 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query16.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query16.groovy
@@ -30,7 +30,7 @@ suite("query16") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select
count(distinct cs_order_number) as "order count"
,sum(cs_ext_ship_cost) as "total shipping cost"
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query17.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query17.groovy
index 3f82efd83d8..6f2f5cbe735 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query17.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query17.groovy
@@ -30,7 +30,7 @@ suite("query17") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select i_item_id
,i_item_desc
,s_state
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query18.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query18.groovy
index 4279a94780a..2a829c7c0c2 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query18.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query18.groovy
@@ -30,7 +30,7 @@ suite("query18") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select i_item_id,
ca_country,
ca_state,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query19.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query19.groovy
index dc5714b7b39..a251716906e 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query19.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query19.groovy
@@ -30,7 +30,7 @@ suite("query19") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select i_brand_id brand_id, i_brand brand, i_manufact_id, i_manufact,
sum(ss_ext_sales_price) ext_price
from date_dim, store_sales, item,customer,customer_address,store
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query2.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query2.groovy
index f9897201e8a..2ed71d564ca 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query2.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query2.groovy
@@ -30,7 +30,7 @@ suite("query2") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with wscs as
(select sold_date_sk
,sales_price
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query20.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query20.groovy
index 6db88b75dd9..0c3f1013e08 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query20.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query20.groovy
@@ -30,7 +30,7 @@ suite("query20") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select i_item_id
,i_item_desc
,i_category
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query21.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query21.groovy
index bf872a39e4e..4fd5428ec77 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query21.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query21.groovy
@@ -30,7 +30,7 @@ suite("query21") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select *
from(select w_warehouse_name
,i_item_id
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query22.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query22.groovy
index a5acdc2d78a..c2b514c6e09 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query22.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query22.groovy
@@ -30,7 +30,7 @@ suite("query22") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select i_product_name
,i_brand
,i_class
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query23.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query23.groovy
index 3d3b936bfab..f52cf26cf28 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query23.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query23.groovy
@@ -30,7 +30,7 @@ suite("query23") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with frequent_ss_items as
(select substr(i_item_desc,1,30) itemdesc,i_item_sk item_sk,d_date solddate,count(*) cnt
from store_sales
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query24.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query24.groovy
index 42f2f0d8394..fee9c9889c1 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query24.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query24.groovy
@@ -30,7 +30,7 @@ suite("query24") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with ssales as
(select c_last_name
,c_first_name
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query25.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query25.groovy
index 49eaec75559..30f328156a7 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query25.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query25.groovy
@@ -30,7 +30,7 @@ suite("query25") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select
i_item_id
,i_item_desc
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query26.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query26.groovy
index ef1f6fb222c..7f934697c99 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query26.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query26.groovy
@@ -30,7 +30,7 @@ suite("query26") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select i_item_id,
avg(cs_quantity) agg1,
avg(cs_list_price) agg2,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query27.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query27.groovy
index b67c90cdd92..978973ca1ea 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query27.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query27.groovy
@@ -30,7 +30,7 @@ suite("query27") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select i_item_id,
s_state, grouping(s_state) g_state,
avg(ss_quantity) agg1,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query28.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query28.groovy
index 38c60856ea0..b84014c3575 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query28.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query28.groovy
@@ -30,7 +30,7 @@ suite("query28") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select *
from (select avg(ss_list_price) B1_LP
,count(ss_list_price) B1_CNT
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query29.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query29.groovy
index 32777541771..a86d44b2b19 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query29.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query29.groovy
@@ -30,7 +30,7 @@ suite("query29") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select
i_item_id
,i_item_desc
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query3.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query3.groovy
index 4ccdbce73bb..f1da8363abc 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query3.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query3.groovy
@@ -30,7 +30,7 @@ suite("query3") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select dt.d_year
,item.i_brand_id brand_id
,item.i_brand brand
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query30.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query30.groovy
index a1277ccb82b..d9e36153813 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query30.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query30.groovy
@@ -30,7 +30,7 @@ suite("query30") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with customer_total_return as
(select wr_returning_customer_sk as ctr_customer_sk
,ca_state as ctr_state,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query31.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query31.groovy
index 9114e7c747b..0500eddb405 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query31.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query31.groovy
@@ -30,7 +30,7 @@ suite("query31") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with ss as
(select ca_county,d_qoy, d_year,sum(ss_ext_sales_price) as store_sales
from store_sales,date_dim,customer_address
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query32.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query32.groovy
index 3a1c6518af7..2c1428db8cd 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query32.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query32.groovy
@@ -30,7 +30,7 @@ suite("query32") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select sum(cs_ext_discount_amt) as "excess discount amount"
from
catalog_sales
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query33.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query33.groovy
index a7ab465ac5c..70d745bf311 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query33.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query33.groovy
@@ -30,7 +30,7 @@ suite("query33") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with ss as (
select
i_manufact_id,sum(ss_ext_sales_price) total_sales
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query34.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query34.groovy
index 26de532c56a..15d128ff145 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query34.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query34.groovy
@@ -30,7 +30,7 @@ suite("query34") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select c_last_name
,c_first_name
,c_salutation
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query35.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query35.groovy
index afae0a31fb8..6dd6709ef45 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query35.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query35.groovy
@@ -30,7 +30,7 @@ suite("query35") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select
ca_state,
cd_gender,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query36.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query36.groovy
index 2cc21b564db..02dbe8cecc5 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query36.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query36.groovy
@@ -30,7 +30,7 @@ suite("query36") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select
sum(ss_net_profit)/sum(ss_ext_sales_price) as gross_margin
,i_category
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query37.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query37.groovy
index 6e93b1ae1a4..9163c80bd27 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query37.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query37.groovy
@@ -30,7 +30,7 @@ suite("query37") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select i_item_id
,i_item_desc
,i_current_price
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query38.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query38.groovy
index 63951c51104..965c45576e8 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query38.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query38.groovy
@@ -30,7 +30,7 @@ suite("query38") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select count(*) from (
select distinct c_last_name, c_first_name, d_date
from store_sales, date_dim, customer
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query39.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query39.groovy
index cc3130829bd..e41e232567c 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query39.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query39.groovy
@@ -30,7 +30,7 @@ suite("query39") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with inv as
(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy
,stdev,mean, case mean when 0 then null else stdev/mean end cov
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query4.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query4.groovy
index 363b6019b73..e70f2f68075 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query4.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query4.groovy
@@ -30,7 +30,7 @@ suite("query4") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with year_total as (
select c_customer_id customer_id
,c_first_name customer_first_name
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query40.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query40.groovy
index bf3c8bcba57..f73e73d700e 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query40.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query40.groovy
@@ -30,7 +30,7 @@ suite("query40") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select
w_state
,i_item_id
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query41.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query41.groovy
index 2da38b937ee..870e14f371f 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query41.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query41.groovy
@@ -30,7 +30,7 @@ suite("query41") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select distinct(i_product_name)
from item i1
where i_manufact_id between 704 and 704+40
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query42.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query42.groovy
index 2e742a6d5d7..a01f7df42ad 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query42.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query42.groovy
@@ -30,7 +30,7 @@ suite("query42") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select dt.d_year
,item.i_category_id
,item.i_category
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query43.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query43.groovy
index 895117ba234..b5fbf2041a5 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query43.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query43.groovy
@@ -30,7 +30,7 @@ suite("query43") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select s_store_name, s_store_id,
sum(case when (d_day_name='Sunday') then ss_sales_price else null end) sun_sales,
sum(case when (d_day_name='Monday') then ss_sales_price else null end) mon_sales,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query44.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query44.groovy
index ee63467db29..09997e9d85f 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query44.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query44.groovy
@@ -30,7 +30,7 @@ suite("query44") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select asceding.rnk, i1.i_product_name best_performing, i2.i_product_name worst_performing
from(select *
from (select item_sk,rank() over (order by rank_col asc) rnk
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query45.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query45.groovy
index 2dc555b0e74..4f9bd0254cc 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query45.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query45.groovy
@@ -30,7 +30,7 @@ suite("query45") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select ca_zip, ca_city, sum(ws_sales_price)
from web_sales, customer, customer_address, date_dim, item
where ws_bill_customer_sk = c_customer_sk
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query46.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query46.groovy
index 6352c0cd44d..12c4f884cd3 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query46.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query46.groovy
@@ -30,7 +30,7 @@ suite("query46") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select c_last_name
,c_first_name
,ca_city
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query47.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query47.groovy
index 65bdaa77b41..a07003aaad7 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query47.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query47.groovy
@@ -30,7 +30,7 @@ suite("query47") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with v1 as(
select i_category, i_brand,
s_store_name, s_company_name,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query48.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query48.groovy
index 29aa2dd0ddf..2efe971c711 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query48.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query48.groovy
@@ -30,7 +30,7 @@ suite("query48") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select sum (ss_quantity)
from store_sales, store, customer_demographics, customer_address, date_dim
where s_store_sk = ss_store_sk
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query49.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query49.groovy
index 48a8ce0740c..e3dba83118e 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query49.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query49.groovy
@@ -30,7 +30,7 @@ suite("query49") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select channel, item, return_ratio, return_rank, currency_rank from
(select
'web' as channel
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query5.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query5.groovy
index 230a1f766b8..28d199b6f5c 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query5.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query5.groovy
@@ -30,7 +30,7 @@ suite("query5") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with ssr as
(select s_store_id,
sum(sales_price) as sales,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query50.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query50.groovy
index 8518305731a..0dda1a1ae7d 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query50.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query50.groovy
@@ -30,7 +30,7 @@ suite("query50") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select
s_store_name
,s_company_id
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query51.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query51.groovy
index e5c49b81df5..67870f80fd0 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query51.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query51.groovy
@@ -30,7 +30,7 @@ suite("query51") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """WITH web_v1 as (
select
ws_item_sk item_sk, d_date,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query52.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query52.groovy
index 747015b1390..969ebf2f5b3 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query52.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query52.groovy
@@ -30,7 +30,7 @@ suite("query52") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select dt.d_year
,item.i_brand_id brand_id
,item.i_brand brand
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query53.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query53.groovy
index 44f6b9298c8..816669c3131 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query53.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query53.groovy
@@ -30,7 +30,7 @@ suite("query53") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select * from
(select i_manufact_id,
sum(ss_sales_price) sum_sales,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query54.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query54.groovy
index 3d5cb32046c..86c37f2df94 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query54.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query54.groovy
@@ -30,7 +30,7 @@ suite("query54") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with my_customers as (
select distinct c_customer_sk
, c_current_addr_sk
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query55.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query55.groovy
index 17969c92cb8..3b4a9a0062a 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query55.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query55.groovy
@@ -30,7 +30,7 @@ suite("query55") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select i_brand_id brand_id, i_brand brand,
sum(ss_ext_sales_price) ext_price
from date_dim, store_sales, item
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query56.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query56.groovy
index 383cafa5e02..5e9e5465024 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query56.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query56.groovy
@@ -30,7 +30,7 @@ suite("query56") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with ss as (
select i_item_id,sum(ss_ext_sales_price) total_sales
from
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query57.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query57.groovy
index e3e19c808fe..5e7e7fc8552 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query57.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query57.groovy
@@ -30,7 +30,7 @@ suite("query57") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with v1 as(
select i_category, i_brand,
cc_name,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query58.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query58.groovy
index 3539d9544b3..28f39fda583 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query58.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query58.groovy
@@ -30,7 +30,7 @@ suite("query58") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with ss_items as
(select i_item_id item_id
,sum(ss_ext_sales_price) ss_item_rev
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query59.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query59.groovy
index 47bff370156..5fcc50a0cbd 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query59.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query59.groovy
@@ -30,7 +30,7 @@ suite("query59") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with wss as
(select d_week_seq,
ss_store_sk,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query6.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query6.groovy
index 4fb62187bca..10660670c8c 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query6.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query6.groovy
@@ -30,7 +30,7 @@ suite("query6") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select a.ca_state state, count(*) cnt
from customer_address a
,customer c
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query60.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query60.groovy
index 461e65ed723..e030fa0a232 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query60.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query60.groovy
@@ -30,7 +30,7 @@ suite("query60") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with ss as (
select
i_item_id,sum(ss_ext_sales_price) total_sales
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query61.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query61.groovy
index 7ed7c6a5258..503e2733265 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query61.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query61.groovy
@@ -30,7 +30,7 @@ suite("query61") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select promotions,total,cast(promotions as decimal(15,4))/cast(total as decimal(15,4))*100
from
(select sum(ss_ext_sales_price) promotions
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query62.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query62.groovy
index 49aa2868657..93964a6ca01 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query62.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query62.groovy
@@ -30,7 +30,7 @@ suite("query62") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select
substr(w_warehouse_name,1,20)
,sm_type
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query63.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query63.groovy
index 621d5f89084..f96b85bb9ec 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query63.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query63.groovy
@@ -30,7 +30,7 @@ suite("query63") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select *
from (select i_manager_id
,sum(ss_sales_price) sum_sales
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query64.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query64.groovy
index 55190653ec0..7fcfa8afb5a 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query64.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query64.groovy
@@ -30,7 +30,7 @@ suite("query64") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with cs_ui as
(select cs_item_sk
,sum(cs_ext_list_price) as sale,sum(cr_refunded_cash+cr_reversed_charge+cr_store_credit) as refund
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query65.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query65.groovy
index ebbeea8abd1..b2dd10b4bca 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query65.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query65.groovy
@@ -30,7 +30,7 @@ suite("query65") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select
s_store_name,
i_item_desc,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query66.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query66.groovy
index 5fe60e2cab3..875148a86c8 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query66.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query66.groovy
@@ -30,7 +30,7 @@ suite("query66") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select
w_warehouse_name
,w_warehouse_sq_ft
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query67.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query67.groovy
index b770846d3ed..8ee3badac9d 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query67.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query67.groovy
@@ -30,7 +30,7 @@ suite("query67") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select *
from (select i_category
,i_class
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query68.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query68.groovy
index 0d6f6e95e22..b0ea47bb511 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query68.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query68.groovy
@@ -30,7 +30,7 @@ suite("query68") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select c_last_name
,c_first_name
,ca_city
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query69.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query69.groovy
index e5566c3a9be..3cdbe682960 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query69.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query69.groovy
@@ -30,7 +30,7 @@ suite("query69") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select
cd_gender,
cd_marital_status,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query7.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query7.groovy
index 8b7fd9175f2..a86e87323b3 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query7.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query7.groovy
@@ -30,7 +30,7 @@ suite("query7") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select i_item_id,
avg(ss_quantity) agg1,
avg(ss_list_price) agg2,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query70.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query70.groovy
index 1cf13e956b8..cddbbad4f33 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query70.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query70.groovy
@@ -30,7 +30,7 @@ suite("query70") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select
sum(ss_net_profit) as total_sum
,s_state
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query71.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query71.groovy
index 10f7a8be9c9..67c4b2c72f3 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query71.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query71.groovy
@@ -30,7 +30,7 @@ suite("query71") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select i_brand_id brand_id, i_brand brand,t_hour,t_minute,
sum(ext_price) ext_price
from item, (select ws_ext_sales_price as ext_price,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query72.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query72.groovy
index 4f9a018e2e0..d7d29fa74cb 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query72.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query72.groovy
@@ -30,7 +30,7 @@ suite("query72") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select i_item_desc
,w_warehouse_name
,d1.d_week_seq
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query73.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query73.groovy
index 55448730834..4a346539574 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query73.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query73.groovy
@@ -30,7 +30,7 @@ suite("query73") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select c_last_name
,c_first_name
,c_salutation
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query74.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query74.groovy
index f42dc7c6a45..4a26c2648ed 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query74.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query74.groovy
@@ -30,7 +30,7 @@ suite("query74") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with year_total as (
select c_customer_id customer_id
,c_first_name customer_first_name
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query75.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query75.groovy
index 9eeb254104c..f9be13cc96e 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query75.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query75.groovy
@@ -30,7 +30,7 @@ suite("query75") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """WITH all_sales AS (
SELECT d_year
,i_brand_id
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query76.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query76.groovy
index bf5f4c8d97e..52c6e6b7717 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query76.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query76.groovy
@@ -30,7 +30,7 @@ suite("query76") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select channel, col_name, d_year, d_qoy, i_category, COUNT(*) sales_cnt, SUM(ext_sales_price) sales_amt FROM (
SELECT 'store' as channel, 'ss_customer_sk' col_name, d_year, d_qoy, i_category, ss_ext_sales_price ext_sales_price
FROM store_sales, item, date_dim
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query77.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query77.groovy
index 45693e6f1b4..02bdd22af3f 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query77.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query77.groovy
@@ -30,7 +30,7 @@ suite("query77") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with ss as
(select s_store_sk,
sum(ss_ext_sales_price) as sales,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query78.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query78.groovy
index 7a8b57e7679..00ffaec9481 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query78.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query78.groovy
@@ -30,7 +30,7 @@ suite("query78") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with ws as
(select d_year AS ws_sold_year, ws_item_sk,
ws_bill_customer_sk ws_customer_sk,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query79.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query79.groovy
index fde72e0859f..2051eab4fb8 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query79.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query79.groovy
@@ -30,7 +30,7 @@ suite("query79") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select
c_last_name,c_first_name,substr(s_city,1,30),ss_ticket_number,amt,profit
from
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query8.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query8.groovy
index e8f8e6f4b03..80e5d51ed4d 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query8.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query8.groovy
@@ -30,7 +30,7 @@ suite("query8") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select s_store_name
,sum(ss_net_profit)
from store_sales
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query80.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query80.groovy
index 64e7f913ed9..1a2580ca5a7 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query80.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query80.groovy
@@ -30,7 +30,7 @@ suite("query80") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with ssr as
(select s_store_id as store_id,
sum(ss_ext_sales_price) as sales,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query81.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query81.groovy
index f058cff75ef..407f1e3f712 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query81.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query81.groovy
@@ -30,7 +30,7 @@ suite("query81") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with customer_total_return as
(select cr_returning_customer_sk as ctr_customer_sk
,ca_state as ctr_state,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query82.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query82.groovy
index 49ca2c51e3e..d69f74d004c 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query82.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query82.groovy
@@ -30,7 +30,7 @@ suite("query82") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select i_item_id
,i_item_desc
,i_current_price
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query83.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query83.groovy
index 2f0de7342be..a9fc04b2739 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query83.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query83.groovy
@@ -30,7 +30,7 @@ suite("query83") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with sr_items as
(select i_item_id item_id,
sum(sr_return_quantity) sr_item_qty
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query84.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query84.groovy
index a69dd44fb37..76b269131ce 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query84.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query84.groovy
@@ -30,7 +30,7 @@ suite("query84") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select c_customer_id as customer_id
, concat(concat(coalesce(c_last_name,''), ','), coalesce(c_first_name,'')) as customername
from customer
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query85.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query85.groovy
index 3ef45ade8b7..c7a6121e3e2 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query85.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query85.groovy
@@ -30,7 +30,7 @@ suite("query85") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select substr(r_reason_desc,1,20)
,avg(ws_quantity)
,avg(wr_refunded_cash)
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query86.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query86.groovy
index 6803b4b594d..6ebfdc8d182 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query86.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query86.groovy
@@ -30,7 +30,7 @@ suite("query86") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select
sum(ws_net_paid) as total_sum
,i_category
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query87.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query87.groovy
index 6a7e665ea4a..6cb12437394 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query87.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query87.groovy
@@ -30,7 +30,7 @@ suite("query87") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select count(*)
from ((select distinct c_last_name, c_first_name, d_date
from store_sales, date_dim, customer
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query88.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query88.groovy
index 401af85bd66..0a2786236a7 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query88.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query88.groovy
@@ -30,7 +30,7 @@ suite("query88") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select *
from
(select count(*) h8_30_to_9
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query89.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query89.groovy
index 8e654061dce..34a0521f6be 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query89.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query89.groovy
@@ -30,7 +30,7 @@ suite("query89") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select *
from(
select i_category, i_class, i_brand,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query9.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query9.groovy
index 8110bc942b6..17b42f2cde8 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query9.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query9.groovy
@@ -30,7 +30,7 @@ suite("query9") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select case when (select count(*)
from store_sales
where ss_quantity between 1 and 20) > 1071
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query90.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query90.groovy
index 1a6743a7d6d..990f71d96d7 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query90.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query90.groovy
@@ -30,7 +30,7 @@ suite("query90") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select cast(amc as decimal(15,4))/cast(pmc as decimal(15,4)) am_pm_ratio
from ( select count(*) amc
from web_sales, household_demographics , time_dim, web_page
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query91.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query91.groovy
index fe2e497bc27..1195f26e702 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query91.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query91.groovy
@@ -30,7 +30,7 @@ suite("query91") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select
cc_call_center_id Call_Center,
cc_name Call_Center_Name,
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query92.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query92.groovy
index 181cdfb32a2..835d38fbe38 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query92.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query92.groovy
@@ -30,7 +30,7 @@ suite("query92") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select
sum(ws_ext_discount_amt) as "Excess Discount Amount"
from
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query93.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query93.groovy
index c03b9046074..2856dbf7c56 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query93.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query93.groovy
@@ -30,7 +30,7 @@ suite("query93") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select ss_customer_sk
,sum(act_sales) sumsales
from (select ss_item_sk
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query94.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query94.groovy
index bbbdca8c7e2..a9620dbe6e3 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query94.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query94.groovy
@@ -30,7 +30,7 @@ suite("query94") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select
count(distinct ws_order_number) as "order count"
,sum(ws_ext_ship_cost) as "total shipping cost"
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query95.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query95.groovy
index eda70ba6edc..1fe9952aecb 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query95.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query95.groovy
@@ -30,7 +30,7 @@ suite("query95") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with ws_wh as
(select ws1.ws_order_number,ws1.ws_warehouse_sk wh1,ws2.ws_warehouse_sk wh2
from web_sales ws1,web_sales ws2
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query96.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query96.groovy
index b296603c792..950a3e5ae32 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query96.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query96.groovy
@@ -30,7 +30,7 @@ suite("query96") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select count(*)
from store_sales
,household_demographics
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query97.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query97.groovy
index 93b3e29d906..10680c82bc4 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query97.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query97.groovy
@@ -30,7 +30,7 @@ suite("query97") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """with ssci as (
select ss_customer_sk customer_sk
,ss_item_sk item_sk
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query98.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query98.groovy
index 118b1fd6cc9..c2521358fe2 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query98.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query98.groovy
@@ -30,7 +30,7 @@ suite("query98") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select i_item_id
,i_item_desc
,i_category
diff --git a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query99.groovy b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query99.groovy
index e560299d8a2..60f0d19d8bd 100644
--- a/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query99.groovy
+++ b/regression-test/suites/nereids_tpcds_shape_sf1000_p0/shape/query99.groovy
@@ -30,7 +30,7 @@ suite("query99") {
sql 'set enable_nereids_timeout = false'
sql 'set enable_runtime_filter_prune=false'
sql 'set runtime_filter_type=8'
- sql 'set dump_nereids_memo=true'
+ sql 'set dump_nereids_memo=false'
def ds = """select
substr(w_warehouse_name,1,20)
,sm_type
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 10/24: [fix](nereids)need substitute agg function using agg node's output if it's in order by key (#30704)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit e413dbec91dfad3610b8e3cae8ae30f6317b9276
Author: starocean999 <40...@users.noreply.github.com>
AuthorDate: Fri Feb 2 20:37:54 2024 +0800
[fix](nereids)need substitute agg function using agg node's output if it's in order by key (#30704)
---
.../nereids/rules/analysis/FillUpMissingSlots.java | 7 ++++++-
.../rules/analysis/FillUpMissingSlotsTest.java | 23 ++++++++++++++++++++++
2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/FillUpMissingSlots.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/FillUpMissingSlots.java
index c8efc1a8917..5688b9d48b3 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/FillUpMissingSlots.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/FillUpMissingSlots.java
@@ -183,10 +183,14 @@ public class FillUpMissingSlots implements AnalysisRuleFactory {
private final List<Expression> groupByExpressions;
private final Map<Expression, Slot> substitution = Maps.newHashMap();
private final List<NamedExpression> newOutputSlots = Lists.newArrayList();
+ private final Map<Slot, Expression> outputSubstitutionMap;
Resolver(Aggregate aggregate) {
outputExpressions = aggregate.getOutputExpressions();
groupByExpressions = aggregate.getGroupByExpressions();
+ outputSubstitutionMap = outputExpressions.stream().filter(Alias.class::isInstance)
+ .collect(Collectors.toMap(alias -> alias.toSlot(), alias -> alias.child(0),
+ (k1, k2) -> k1));
}
public void resolve(Expression expression) {
@@ -273,7 +277,8 @@ public class FillUpMissingSlots implements AnalysisRuleFactory {
}
private void generateAliasForNewOutputSlots(Expression expression) {
- Alias alias = new Alias(expression);
+ Expression replacedExpr = ExpressionUtils.replace(expression, outputSubstitutionMap);
+ Alias alias = new Alias(replacedExpr);
newOutputSlots.add(alias);
substitution.put(expression, alias.toSlot());
}
diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/analysis/FillUpMissingSlotsTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/analysis/FillUpMissingSlotsTest.java
index 0ebaa6f3c38..f270ff4db0e 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/analysis/FillUpMissingSlotsTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/analysis/FillUpMissingSlotsTest.java
@@ -32,6 +32,7 @@ import org.apache.doris.nereids.trees.expressions.SlotReference;
import org.apache.doris.nereids.trees.expressions.functions.agg.Count;
import org.apache.doris.nereids.trees.expressions.functions.agg.Min;
import org.apache.doris.nereids.trees.expressions.functions.agg.Sum;
+import org.apache.doris.nereids.trees.expressions.functions.scalar.Abs;
import org.apache.doris.nereids.trees.expressions.literal.Literal;
import org.apache.doris.nereids.trees.expressions.literal.TinyIntLiteral;
import org.apache.doris.nereids.types.BigIntType;
@@ -513,6 +514,28 @@ public class FillUpMissingSlotsTest extends AnalyzeCheckTestBase implements Memo
).when(FieldChecker.check("outputExpressions", Lists.newArrayList(a1, countStar))))
).when(FieldChecker.check("orderKeys", ImmutableList.of(new OrderKey(countStar.toSlot(), true, true))))
).when(FieldChecker.check("projects", Lists.newArrayList(a1.toSlot()))));
+ sql = "SELECT abs(a1) xx, sum(a2) FROM t1 GROUP BY xx ORDER BY MIN(xx)";
+ a1 = new SlotReference(
+ new ExprId(1), "a1", TinyIntType.INSTANCE, true,
+ ImmutableList.of("test_resolve_aggregate_functions", "t1")
+ );
+ Alias xx = new Alias(new ExprId(3), new Abs(a1), "xx");
+ a2 = new SlotReference(
+ new ExprId(2), "a2", TinyIntType.INSTANCE, true,
+ ImmutableList.of("test_resolve_aggregate_functions", "t1")
+ );
+ sumA2 = new Alias(new ExprId(4), new Sum(a2), "sum(a2)");
+
+ Alias minXX = new Alias(new ExprId(5), new Min(xx.toSlot()), "min(xx)");
+ PlanChecker.from(connectContext).analyze(sql).printlnTree().matches(logicalProject(
+ logicalSort(logicalProject(logicalAggregate(logicalProject(logicalOlapScan())
+ .when(FieldChecker.check("projects", Lists.newArrayList(xx, a2, a1))))))
+ .when(FieldChecker.check("orderKeys",
+ ImmutableList
+ .of(new OrderKey(minXX.toSlot(), true, true)))))
+ .when(FieldChecker.check("projects",
+ Lists.newArrayList(xx.toSlot(),
+ sumA2.toSlot()))));
}
@Test
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 20/24: [fix](Nereids) date >= simplify to > by mistake (#30765)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 4f0414d13eb9db163c074991e4f28e9bfec98b60
Author: morrySnow <10...@users.noreply.github.com>
AuthorDate: Sat Feb 3 20:16:24 2024 +0800
[fix](Nereids) date >= simplify to > by mistake (#30765)
---
.../doris/nereids/rules/expression/rules/DateFunctionRewrite.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/DateFunctionRewrite.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/DateFunctionRewrite.java
index 688271cc07b..09f9b311f49 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/DateFunctionRewrite.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/DateFunctionRewrite.java
@@ -96,14 +96,14 @@ public class DateFunctionRewrite extends AbstractExpressionRewriteRule {
if (greaterThanEqual.left().child(0).getDataType() instanceof DateTimeType
&& greaterThanEqual.right() instanceof DateLiteral) {
DateTimeLiteral newLiteral = ((DateLiteral) greaterThanEqual.right()).toBeginOfTheDay();
- return new GreaterThan(greaterThanEqual.left().child(0), newLiteral);
+ return new GreaterThanEqual(greaterThanEqual.left().child(0), newLiteral);
}
// V2
if (greaterThanEqual.left().child(0).getDataType() instanceof DateTimeV2Type
&& greaterThanEqual.right() instanceof DateV2Literal) {
DateTimeV2Literal newLiteral = ((DateV2Literal) greaterThanEqual.right()).toBeginOfTheDay();
- return new GreaterThan(greaterThanEqual.left().child(0), newLiteral);
+ return new GreaterThanEqual(greaterThanEqual.left().child(0), newLiteral);
}
}
return greaterThanEqual;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 03/24: [Feature](runtime filter) normalize ignore runtime filter (#30152)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 0f47f7f3892a6f16747f86c1eb0360f05d3a45a0
Author: Pxl <px...@qq.com>
AuthorDate: Fri Feb 2 15:30:29 2024 +0800
[Feature](runtime filter) normalize ignore runtime filter (#30152)
normalize ignore runtime filter
---
be/src/common/config.cpp | 2 +-
be/src/common/config.h | 2 +-
be/src/exprs/create_predicate_function.h | 2 +-
be/src/exprs/minmax_predicate.h | 117 ++++++++-------------
be/src/exprs/runtime_filter.h | 4 +-
be/src/olap/accept_null_predicate.h | 90 ++++++++--------
be/src/olap/bitmap_filter_predicate.h | 14 +--
be/src/olap/bloom_filter_predicate.h | 38 ++-----
be/src/olap/column_predicate.h | 43 +++++++-
be/src/olap/comparison_predicate.h | 72 ++++++++-----
be/src/olap/in_list_predicate.h | 61 ++++++-----
be/src/olap/like_column_predicate.cpp | 4 +-
be/src/olap/like_column_predicate.h | 6 +-
be/src/olap/match_predicate.h | 9 +-
be/src/olap/null_predicate.cpp | 4 +-
be/src/olap/null_predicate.h | 6 +-
be/src/olap/rowset/segment_v2/segment_iterator.cpp | 28 +++--
be/src/vec/exprs/vruntimefilter_wrapper.cpp | 3 +-
be/src/vec/exprs/vruntimefilter_wrapper.h | 8 +-
.../olap/bitmap_filter_column_predicate_test.cpp | 4 +-
.../join-optimization/runtime-filter.md | 2 +-
.../join-optimization/runtime-filter.md | 2 +-
.../java/org/apache/doris/qe/SessionVariable.java | 2 +-
.../data/variable_p0/set_and_unset_variable.out | 20 ++--
24 files changed, 289 insertions(+), 254 deletions(-)
diff --git a/be/src/common/config.cpp b/be/src/common/config.cpp
index d68efb0550a..6fb925b3a91 100644
--- a/be/src/common/config.cpp
+++ b/be/src/common/config.cpp
@@ -889,7 +889,7 @@ DEFINE_mInt64(small_column_size_buffer, "100");
// When the rows number reached this limit, will check the filter rate the of bloomfilter
// if it is lower than a specific threshold, the predicate will be disabled.
-DEFINE_mInt32(bloom_filter_predicate_check_row_num, "204800");
+DEFINE_mInt32(rf_predicate_check_row_num, "204800");
// cooldown task configs
DEFINE_Int32(cooldown_thread_num, "5");
diff --git a/be/src/common/config.h b/be/src/common/config.h
index e2e8b5323e7..d6b1244d1a3 100644
--- a/be/src/common/config.h
+++ b/be/src/common/config.h
@@ -941,7 +941,7 @@ DECLARE_mInt64(small_column_size_buffer);
// When the rows number reached this limit, will check the filter rate the of bloomfilter
// if it is lower than a specific threshold, the predicate will be disabled.
-DECLARE_mInt32(bloom_filter_predicate_check_row_num);
+DECLARE_mInt32(rf_predicate_check_row_num);
// cooldown task configs
DECLARE_Int32(cooldown_thread_num);
diff --git a/be/src/exprs/create_predicate_function.h b/be/src/exprs/create_predicate_function.h
index 0e792563acf..11889ff2ec3 100644
--- a/be/src/exprs/create_predicate_function.h
+++ b/be/src/exprs/create_predicate_function.h
@@ -232,7 +232,7 @@ ColumnPredicate* create_olap_column_predicate(uint32_t column_id,
std::shared_ptr<BloomFilterFuncBase> filter_olap;
filter_olap.reset(create_bloom_filter(PT));
filter_olap->light_copy(filter.get());
- return new BloomFilterColumnPredicate<PT>(column_id, filter, be_exec_version);
+ return new BloomFilterColumnPredicate<PT>(column_id, filter);
}
template <PrimitiveType PT>
diff --git a/be/src/exprs/minmax_predicate.h b/be/src/exprs/minmax_predicate.h
index fcf2ef44a19..b9ee56a8dc1 100644
--- a/be/src/exprs/minmax_predicate.h
+++ b/be/src/exprs/minmax_predicate.h
@@ -30,9 +30,7 @@ namespace doris {
// only used in Runtime Filter
class MinMaxFuncBase {
public:
- virtual void insert(const void* data) = 0;
virtual void insert_fixed_len(const vectorized::ColumnPtr& column, size_t start) = 0;
- virtual bool find(void* data) = 0;
virtual void* get_max() = 0;
virtual void* get_min() = 0;
// assign minmax data
@@ -48,66 +46,54 @@ public:
MinMaxNumFunc() = default;
~MinMaxNumFunc() override = default;
- void insert(const void* data) override {
- if (data == nullptr) {
- return;
- }
-
- T val_data = *reinterpret_cast<const T*>(data);
-
- if constexpr (NeedMin) {
- if (val_data < _min) {
- _min = val_data;
- }
- }
-
- if constexpr (NeedMax) {
- if (val_data > _max) {
- _max = val_data;
- }
- }
- }
-
void insert_fixed_len(const vectorized::ColumnPtr& column, size_t start) override {
if (column->empty()) {
return;
}
if (column->is_nullable()) {
const auto* nullable = assert_cast<const vectorized::ColumnNullable*>(column.get());
- const auto& col = nullable->get_nested_column();
- const auto& nullmap =
- assert_cast<const vectorized::ColumnUInt8&>(nullable->get_null_map_column())
- .get_data();
-
- if constexpr (std::is_same_v<T, StringRef>) {
- const auto& column_string = assert_cast<const vectorized::ColumnString&>(col);
- for (size_t i = start; i < column->size(); i++) {
- if (!nullmap[i]) {
- if constexpr (NeedMin) {
- _min = std::min(_min, column_string.get_data_at(i));
- }
- if constexpr (NeedMax) {
- _max = std::max(_max, column_string.get_data_at(i));
- }
- }
- }
+ const auto& col = nullable->get_nested_column_ptr();
+ const auto& nullmap = nullable->get_null_map_data();
+ if (nullable->has_null()) {
+ update_batch(col, nullmap, start);
} else {
- const T* data = (T*)col.get_raw_data().data;
- for (size_t i = start; i < column->size(); i++) {
- if (!nullmap[i]) {
- if constexpr (NeedMin) {
- _min = std::min(_min, *(data + i));
- }
- if constexpr (NeedMax) {
- _max = std::max(_max, *(data + i));
- }
- }
+ update_batch(col, start);
+ }
+ } else {
+ update_batch(column, start);
+ }
+ }
+
+ void update_batch(const vectorized::ColumnPtr& column, size_t start) {
+ if constexpr (std::is_same_v<T, StringRef>) {
+ const auto& column_string = assert_cast<const vectorized::ColumnString&>(*column);
+ for (size_t i = start; i < column->size(); i++) {
+ if constexpr (NeedMin) {
+ _min = std::min(_min, column_string.get_data_at(i));
+ }
+ if constexpr (NeedMax) {
+ _max = std::max(_max, column_string.get_data_at(i));
}
}
} else {
- if constexpr (std::is_same_v<T, StringRef>) {
- const auto& column_string = assert_cast<const vectorized::ColumnString&>(*column);
- for (size_t i = start; i < column->size(); i++) {
+ const T* data = (T*)column->get_raw_data().data;
+ for (size_t i = start; i < column->size(); i++) {
+ if constexpr (NeedMin) {
+ _min = std::min(_min, *(data + i));
+ }
+ if constexpr (NeedMax) {
+ _max = std::max(_max, *(data + i));
+ }
+ }
+ }
+ }
+
+ void update_batch(const vectorized::ColumnPtr& column, const vectorized::NullMap& nullmap,
+ size_t start) {
+ if constexpr (std::is_same_v<T, StringRef>) {
+ const auto& column_string = assert_cast<const vectorized::ColumnString&>(*column);
+ for (size_t i = start; i < column->size(); i++) {
+ if (!nullmap[i]) {
if constexpr (NeedMin) {
_min = std::min(_min, column_string.get_data_at(i));
}
@@ -115,9 +101,11 @@ public:
_max = std::max(_max, column_string.get_data_at(i));
}
}
- } else {
- const T* data = (T*)column->get_raw_data().data;
- for (size_t i = start; i < column->size(); i++) {
+ }
+ } else {
+ const T* data = (T*)column->get_raw_data().data;
+ for (size_t i = start; i < column->size(); i++) {
+ if (!nullmap[i]) {
if constexpr (NeedMin) {
_min = std::min(_min, *(data + i));
}
@@ -129,25 +117,6 @@ public:
}
}
- bool find(void* data) override {
- if (data == nullptr) {
- return false;
- }
-
- T val_data = *reinterpret_cast<T*>(data);
- if constexpr (NeedMin) {
- if (val_data < _min) {
- return false;
- }
- }
- if constexpr (NeedMax) {
- if (val_data > _max) {
- return false;
- }
- }
- return true;
- }
-
Status merge(MinMaxFuncBase* minmax_func, ObjectPool* pool) override {
if constexpr (std::is_same_v<T, StringRef>) {
auto* other_minmax = static_cast<MinMaxNumFunc<T>*>(minmax_func);
diff --git a/be/src/exprs/runtime_filter.h b/be/src/exprs/runtime_filter.h
index bc487bfe9c9..9a7c1a2ae3c 100644
--- a/be/src/exprs/runtime_filter.h
+++ b/be/src/exprs/runtime_filter.h
@@ -140,7 +140,9 @@ public:
}
}
- [[nodiscard]] int get_filter_id() const { return _filter_id; }
+ int get_filter_id() const { return _filter_id; }
+
+ bool is_runtime_filter() const { return _filter_id != -1; }
private:
int _filter_id = -1;
diff --git a/be/src/olap/accept_null_predicate.h b/be/src/olap/accept_null_predicate.h
index 90cff5cc70b..3d6103e81cd 100644
--- a/be/src/olap/accept_null_predicate.h
+++ b/be/src/olap/accept_null_predicate.h
@@ -59,55 +59,12 @@ public:
return _nested->can_do_apply_safely(input_type, is_null);
}
- uint16_t evaluate(const vectorized::IColumn& column, uint16_t* sel,
- uint16_t size) const override {
- if (column.has_null()) {
- // create selected_flags
- uint16_t max_idx = *std::max_element(sel, sel + size);
- auto selected_flags_ptr = std::make_unique<bool[]>(max_idx + 1);
- auto selected_flags = selected_flags_ptr.get();
- // init to 0 / false
- memset(selected_flags, 0, (max_idx + 1) * sizeof(bool));
- for (uint16_t i = 0; i < size; ++i) {
- uint16_t row_idx = sel[i];
- if (column.is_null_at(row_idx)) {
- // set selected flag true for NULL value
- selected_flags[row_idx] = true;
- }
- }
-
- // call nested predicate evaluate
- uint16_t new_size = _nested->evaluate(column, sel, size);
-
- // process NULL values
- if (new_size < size) {
- // add rows selected by _nested->evaluate
- for (uint16_t i = 0; i < new_size; ++i) {
- uint16_t row_idx = sel[i];
- selected_flags[row_idx] = true;
- }
-
- // recaculate new_size and sel array
- new_size = 0;
- for (uint16_t row_idx = 0; row_idx < max_idx + 1; ++row_idx) {
- if (selected_flags[row_idx]) {
- sel[new_size++] = row_idx;
- }
- }
- }
-
- return new_size;
- } else {
- return _nested->evaluate(column, sel, size);
- }
- }
-
void evaluate_and(const vectorized::IColumn& column, const uint16_t* sel, uint16_t size,
bool* flags) const override {
if (column.has_null()) {
// copy original flags
auto original_flags_buf = std::make_unique<bool[]>(size);
- auto original_flags = original_flags_buf.get();
+ auto* original_flags = original_flags_buf.get();
memcpy(original_flags, flags, size * sizeof(bool));
// call evaluate_and and restore true for NULL rows
@@ -175,7 +132,7 @@ public:
if (column.has_null()) {
// copy original flags
auto original_flags_buf = std::make_unique<bool[]>(size);
- auto original_flags = original_flags_buf.get();
+ auto* original_flags = original_flags_buf.get();
memcpy(original_flags, flags, size * sizeof(bool));
// call evaluate_and_vec and restore true for NULL rows
@@ -208,6 +165,49 @@ public:
}
private:
+ uint16_t _evaluate_inner(const vectorized::IColumn& column, uint16_t* sel,
+ uint16_t size) const override {
+ if (column.has_null()) {
+ // create selected_flags
+ uint16_t max_idx = *std::max_element(sel, sel + size);
+ auto selected_flags_ptr = std::make_unique<bool[]>(max_idx + 1);
+ auto* selected_flags = selected_flags_ptr.get();
+ // init to 0 / false
+ memset(selected_flags, 0, (max_idx + 1) * sizeof(bool));
+ for (uint16_t i = 0; i < size; ++i) {
+ uint16_t row_idx = sel[i];
+ if (column.is_null_at(row_idx)) {
+ // set selected flag true for NULL value
+ selected_flags[row_idx] = true;
+ }
+ }
+
+ // call nested predicate evaluate
+ uint16_t new_size = _nested->evaluate(column, sel, size);
+
+ // process NULL values
+ if (new_size < size) {
+ // add rows selected by _nested->evaluate
+ for (uint16_t i = 0; i < new_size; ++i) {
+ uint16_t row_idx = sel[i];
+ selected_flags[row_idx] = true;
+ }
+
+ // recaculate new_size and sel array
+ new_size = 0;
+ for (uint16_t row_idx = 0; row_idx < max_idx + 1; ++row_idx) {
+ if (selected_flags[row_idx]) {
+ sel[new_size++] = row_idx;
+ }
+ }
+ }
+
+ return new_size;
+ } else {
+ return _nested->evaluate(column, sel, size);
+ }
+ }
+
std::string _debug_string() const override {
return "passnull predicate for " + _nested->debug_string();
}
diff --git a/be/src/olap/bitmap_filter_predicate.h b/be/src/olap/bitmap_filter_predicate.h
index 7420356a33a..a540346990a 100644
--- a/be/src/olap/bitmap_filter_predicate.h
+++ b/be/src/olap/bitmap_filter_predicate.h
@@ -76,10 +76,10 @@ public:
return Status::OK();
}
- uint16_t evaluate(const vectorized::IColumn& column, uint16_t* sel,
- uint16_t size) const override;
-
private:
+ uint16_t _evaluate_inner(const vectorized::IColumn& column, uint16_t* sel,
+ uint16_t size) const override;
+
template <bool is_nullable>
uint16_t evaluate(const vectorized::IColumn& column, const uint8_t* null_map, uint16_t* sel,
uint16_t size) const {
@@ -109,12 +109,12 @@ private:
};
template <PrimitiveType T>
-uint16_t BitmapFilterColumnPredicate<T>::evaluate(const vectorized::IColumn& column, uint16_t* sel,
- uint16_t size) const {
+uint16_t BitmapFilterColumnPredicate<T>::_evaluate_inner(const vectorized::IColumn& column,
+ uint16_t* sel, uint16_t size) const {
uint16_t new_size = 0;
if (column.is_nullable()) {
- auto* nullable_col = reinterpret_cast<const vectorized::ColumnNullable*>(&column);
- auto& null_map_data = nullable_col->get_null_map_column().get_data();
+ const auto* nullable_col = reinterpret_cast<const vectorized::ColumnNullable*>(&column);
+ const auto& null_map_data = nullable_col->get_null_map_column().get_data();
new_size =
evaluate<true>(nullable_col->get_nested_column(), null_map_data.data(), sel, size);
} else {
diff --git a/be/src/olap/bloom_filter_predicate.h b/be/src/olap/bloom_filter_predicate.h
index bacf61b8362..9cc95d7152a 100644
--- a/be/src/olap/bloom_filter_predicate.h
+++ b/be/src/olap/bloom_filter_predicate.h
@@ -37,12 +37,10 @@ public:
using SpecificFilter = BloomFilterFunc<T>;
BloomFilterColumnPredicate(uint32_t column_id,
- const std::shared_ptr<BloomFilterFuncBase>& filter,
- int be_exec_version)
+ const std::shared_ptr<BloomFilterFuncBase>& filter)
: ColumnPredicate(column_id),
_filter(filter),
- _specific_filter(reinterpret_cast<SpecificFilter*>(_filter.get())),
- _be_exec_version(be_exec_version) {}
+ _specific_filter(reinterpret_cast<SpecificFilter*>(_filter.get())) {}
~BloomFilterColumnPredicate() override = default;
PredicateType type() const override { return PredicateType::BF; }
@@ -52,14 +50,16 @@ public:
return Status::OK();
}
- uint16_t evaluate(const vectorized::IColumn& column, uint16_t* sel,
- uint16_t size) const override;
-
bool can_do_apply_safely(PrimitiveType input_type, bool is_null) const override {
return input_type == T || (is_string_type(input_type) && is_string_type(T));
}
private:
+ bool _can_ignore() const override { return _filter->is_runtime_filter(); }
+
+ uint16_t _evaluate_inner(const vectorized::IColumn& column, uint16_t* sel,
+ uint16_t size) const override;
+
template <bool is_nullable>
uint16_t evaluate(const vectorized::IColumn& column, const uint8_t* null_map, uint16_t* sel,
uint16_t size) const {
@@ -97,34 +97,18 @@ private:
std::shared_ptr<BloomFilterFuncBase> _filter;
SpecificFilter* _specific_filter; // owned by _filter
- mutable bool _always_true = false;
- mutable bool _has_calculate_filter = false;
- int _be_exec_version;
};
template <PrimitiveType T>
-uint16_t BloomFilterColumnPredicate<T>::evaluate(const vectorized::IColumn& column, uint16_t* sel,
- uint16_t size) const {
- uint16_t new_size = 0;
- if (_always_true) {
- return size;
- }
+uint16_t BloomFilterColumnPredicate<T>::_evaluate_inner(const vectorized::IColumn& column,
+ uint16_t* sel, uint16_t size) const {
if (column.is_nullable()) {
const auto* nullable_col = reinterpret_cast<const vectorized::ColumnNullable*>(&column);
const auto& null_map_data = nullable_col->get_null_map_column().get_data();
- new_size =
- evaluate<true>(nullable_col->get_nested_column(), null_map_data.data(), sel, size);
+ return evaluate<true>(nullable_col->get_nested_column(), null_map_data.data(), sel, size);
} else {
- new_size = evaluate<false>(column, nullptr, sel, size);
+ return evaluate<false>(column, nullptr, sel, size);
}
- // If the pass rate is very high, for example > 50%, then the bloomfilter is useless.
- // Some bloomfilter is useless, for example ssb 4.3, it consumes a lot of cpu but it is
- // useless.
- _evaluated_rows += size;
- _passed_rows += new_size;
- vectorized::VRuntimeFilterWrapper::calculate_filter(
- _evaluated_rows - _passed_rows, _evaluated_rows, _has_calculate_filter, _always_true);
- return new_size;
}
} //namespace doris
diff --git a/be/src/olap/column_predicate.h b/be/src/olap/column_predicate.h
index 5c3ad135062..adbb9a695ed 100644
--- a/be/src/olap/column_predicate.h
+++ b/be/src/olap/column_predicate.h
@@ -19,6 +19,7 @@
#include <roaring/roaring.hh>
+#include "common/exception.h"
#include "olap/rowset/segment_v2/bitmap_index_reader.h"
#include "olap/rowset/segment_v2/bloom_filter.h"
#include "olap/rowset/segment_v2/inverted_index_reader.h"
@@ -26,6 +27,7 @@
#include "olap/selection_vector.h"
#include "runtime/define_primitive_type.h"
#include "vec/columns/column.h"
+#include "vec/exprs/vruntimefilter_wrapper.h"
using namespace doris::segment_v2;
@@ -181,11 +183,29 @@ public:
"Not Implemented evaluate with inverted index, please check the predicate");
}
+ virtual double get_ignore_threshold() const {
+ return vectorized::VRuntimeFilterWrapper::EXPECTED_FILTER_RATE;
+ }
+
// evaluate predicate on IColumn
// a short circuit eval way
- virtual uint16_t evaluate(const vectorized::IColumn& column, uint16_t* sel,
- uint16_t size) const {
- return size;
+ uint16_t evaluate(const vectorized::IColumn& column, uint16_t* sel, uint16_t size) const {
+ if (_always_true) {
+ return size;
+ }
+
+ uint16_t new_size = _evaluate_inner(column, sel, size);
+ _evaluated_rows += size;
+ _passed_rows += new_size;
+ if (_can_ignore()) {
+ // If the pass rate is very high, for example > 50%, then the filter is useless.
+ // Some filter is useless, for example ssb 4.3, it consumes a lot of cpu but it is
+ // useless.
+ vectorized::VRuntimeFilterWrapper::calculate_filter(
+ get_ignore_threshold(), _evaluated_rows - _passed_rows, _evaluated_rows,
+ _has_calculate_filter, _always_true);
+ }
+ return new_size;
}
virtual void evaluate_and(const vectorized::IColumn& column, const uint16_t* sel, uint16_t size,
bool* flags) const {}
@@ -262,7 +282,7 @@ public:
std::shared_ptr<PredicateParams> predicate_params() { return _predicate_params; }
- const std::string pred_type_string(PredicateType type) {
+ static std::string pred_type_string(PredicateType type) {
switch (type) {
case PredicateType::EQ:
return "eq";
@@ -293,8 +313,21 @@ public:
}
}
+ bool always_true() const { return _always_true; }
+
protected:
virtual std::string _debug_string() const = 0;
+ virtual bool _can_ignore() const {
+ if (_predicate_params) {
+ // minmax filter will set marked_by_runtime_filter to true
+ return _predicate_params->marked_by_runtime_filter;
+ }
+ return false;
+ }
+ virtual uint16_t _evaluate_inner(const vectorized::IColumn& column, uint16_t* sel,
+ uint16_t size) const {
+ throw Exception(INTERNAL_ERROR, "Not Implemented _evaluate_inner");
+ }
uint32_t _column_id;
// TODO: the value is only in delete condition, better be template value
@@ -302,6 +335,8 @@ protected:
std::shared_ptr<PredicateParams> _predicate_params;
mutable uint64_t _evaluated_rows = 1;
mutable uint64_t _passed_rows = 0;
+ mutable bool _always_true = false;
+ mutable bool _has_calculate_filter = false;
};
} //namespace doris
diff --git a/be/src/olap/comparison_predicate.h b/be/src/olap/comparison_predicate.h
index 35157808d75..17b334d7b8d 100644
--- a/be/src/olap/comparison_predicate.h
+++ b/be/src/olap/comparison_predicate.h
@@ -139,22 +139,6 @@ public:
return Status::OK();
}
- uint16_t evaluate(const vectorized::IColumn& column, uint16_t* sel,
- uint16_t size) const override {
- if (column.is_nullable()) {
- auto* nullable_column_ptr =
- vectorized::check_and_get_column<vectorized::ColumnNullable>(column);
- auto& nested_column = nullable_column_ptr->get_nested_column();
- auto& null_map = reinterpret_cast<const vectorized::ColumnUInt8&>(
- nullable_column_ptr->get_null_map_column())
- .get_data();
-
- return _base_evaluate<true>(&nested_column, null_map.data(), sel, size);
- } else {
- return _base_evaluate<false>(&column, nullptr, sel, size);
- }
- }
-
void evaluate_and(const vectorized::IColumn& column, const uint16_t* sel, uint16_t size,
bool* flags) const override {
_evaluate_bit<true>(column, sel, size, flags);
@@ -273,17 +257,27 @@ public:
template <bool is_and>
__attribute__((flatten)) void _evaluate_vec_internal(const vectorized::IColumn& column,
uint16_t size, bool* flags) const {
+ if (_can_ignore() && !_has_calculate_filter) {
+ if (is_and) {
+ for (uint16_t i = 0; i < size; i++) {
+ _evaluated_rows += flags[i];
+ }
+ } else {
+ _evaluated_rows += size;
+ }
+ }
+
if (column.is_nullable()) {
- auto* nullable_column_ptr =
+ const auto* nullable_column_ptr =
vectorized::check_and_get_column<vectorized::ColumnNullable>(column);
- auto& nested_column = nullable_column_ptr->get_nested_column();
- auto& null_map = reinterpret_cast<const vectorized::ColumnUInt8&>(
- nullable_column_ptr->get_null_map_column())
- .get_data();
+ const auto& nested_column = nullable_column_ptr->get_nested_column();
+ const auto& null_map = reinterpret_cast<const vectorized::ColumnUInt8&>(
+ nullable_column_ptr->get_null_map_column())
+ .get_data();
if (nested_column.is_column_dictionary()) {
if constexpr (std::is_same_v<T, StringRef>) {
- auto* dict_column_ptr =
+ const auto* dict_column_ptr =
vectorized::check_and_get_column<vectorized::ColumnDictI32>(
nested_column);
@@ -295,7 +289,7 @@ public:
break;
}
}
- auto* data_array = dict_column_ptr->get_data().data();
+ const auto* data_array = dict_column_ptr->get_data().data();
_base_loop_vec<true, is_and>(size, flags, null_map.data(), data_array,
dict_code);
@@ -316,7 +310,7 @@ public:
} else {
if (column.is_column_dictionary()) {
if constexpr (std::is_same_v<T, StringRef>) {
- auto* dict_column_ptr =
+ const auto* dict_column_ptr =
vectorized::check_and_get_column<vectorized::ColumnDictI32>(column);
auto dict_code = _find_code_from_dictionary_column(*dict_column_ptr);
do {
@@ -326,7 +320,7 @@ public:
break;
}
}
- auto* data_array = dict_column_ptr->get_data().data();
+ const auto* data_array = dict_column_ptr->get_data().data();
_base_loop_vec<false, is_and>(size, flags, nullptr, data_array, dict_code);
} while (false);
@@ -350,6 +344,15 @@ public:
flags[i] = !flags[i];
}
}
+
+ if (_can_ignore() && !_has_calculate_filter) {
+ for (uint16_t i = 0; i < size; i++) {
+ _passed_rows += flags[i];
+ }
+ vectorized::VRuntimeFilterWrapper::calculate_filter(
+ get_ignore_threshold(), _evaluated_rows - _passed_rows, _evaluated_rows,
+ _has_calculate_filter, _always_true);
+ }
}
void evaluate_vec(const vectorized::IColumn& column, uint16_t size,
@@ -362,7 +365,26 @@ public:
_evaluate_vec_internal<true>(column, size, flags);
}
+ // todo: It may be necessary to set a more reasonable threshold
+ double get_ignore_threshold() const override { return 0.1; }
+
private:
+ uint16_t _evaluate_inner(const vectorized::IColumn& column, uint16_t* sel,
+ uint16_t size) const override {
+ if (column.is_nullable()) {
+ const auto* nullable_column_ptr =
+ vectorized::check_and_get_column<vectorized::ColumnNullable>(column);
+ const auto& nested_column = nullable_column_ptr->get_nested_column();
+ const auto& null_map = reinterpret_cast<const vectorized::ColumnUInt8&>(
+ nullable_column_ptr->get_null_map_column())
+ .get_data();
+
+ return _base_evaluate<true>(&nested_column, null_map.data(), sel, size);
+ } else {
+ return _base_evaluate<false>(&column, nullptr, sel, size);
+ }
+ }
+
template <typename LeftT, typename RightT>
bool _operator(const LeftT& lhs, const RightT& rhs) const {
if constexpr (PT == PredicateType::EQ) {
diff --git a/be/src/olap/in_list_predicate.h b/be/src/olap/in_list_predicate.h
index 7d3a9d1d3a7..5d7fb783239 100644
--- a/be/src/olap/in_list_predicate.h
+++ b/be/src/olap/in_list_predicate.h
@@ -228,34 +228,6 @@ public:
return Status::OK();
}
- uint16_t evaluate(const vectorized::IColumn& column, uint16_t* sel,
- uint16_t size) const override {
- int64_t new_size = 0;
-
- if (column.is_nullable()) {
- auto* nullable_col =
- vectorized::check_and_get_column<vectorized::ColumnNullable>(column);
- auto& null_map = reinterpret_cast<const vectorized::ColumnUInt8&>(
- nullable_col->get_null_map_column())
- .get_data();
- auto& nested_col = nullable_col->get_nested_column();
-
- if (_opposite) {
- new_size = _base_evaluate<true, true>(&nested_col, &null_map, sel, size);
- } else {
- new_size = _base_evaluate<true, false>(&nested_col, &null_map, sel, size);
- }
- } else {
- if (_opposite) {
- new_size = _base_evaluate<false, true>(&column, nullptr, sel, size);
- } else {
- new_size = _base_evaluate<false, false>(&column, nullptr, sel, size);
- }
- }
- _evaluated_rows += size;
- _passed_rows += new_size;
- return new_size;
- }
int get_filter_id() const override { return _values->get_filter_id(); }
bool is_filter() const override { return true; }
@@ -372,7 +344,40 @@ public:
return PT == PredicateType::IN_LIST && !ngram;
}
+ double get_ignore_threshold() const override { return std::log2(_values->size() + 1) / 64; }
+
private:
+ bool _can_ignore() const override { return _values->is_runtime_filter(); }
+
+ uint16_t _evaluate_inner(const vectorized::IColumn& column, uint16_t* sel,
+ uint16_t size) const override {
+ int64_t new_size = 0;
+
+ if (column.is_nullable()) {
+ const auto* nullable_col =
+ vectorized::check_and_get_column<vectorized::ColumnNullable>(column);
+ const auto& null_map = reinterpret_cast<const vectorized::ColumnUInt8&>(
+ nullable_col->get_null_map_column())
+ .get_data();
+ const auto& nested_col = nullable_col->get_nested_column();
+
+ if (_opposite) {
+ new_size = _base_evaluate<true, true>(&nested_col, &null_map, sel, size);
+ } else {
+ new_size = _base_evaluate<true, false>(&nested_col, &null_map, sel, size);
+ }
+ } else {
+ if (_opposite) {
+ new_size = _base_evaluate<false, true>(&column, nullptr, sel, size);
+ } else {
+ new_size = _base_evaluate<false, false>(&column, nullptr, sel, size);
+ }
+ }
+ _evaluated_rows += size;
+ _passed_rows += new_size;
+ return new_size;
+ }
+
template <typename LeftT, typename RightT>
bool _operator(const LeftT& lhs, const RightT& rhs) const {
if constexpr (PT == PredicateType::IN_LIST) {
diff --git a/be/src/olap/like_column_predicate.cpp b/be/src/olap/like_column_predicate.cpp
index 94b65c0eca2..b441e982606 100644
--- a/be/src/olap/like_column_predicate.cpp
+++ b/be/src/olap/like_column_predicate.cpp
@@ -51,8 +51,8 @@ void LikeColumnPredicate<T>::evaluate_and_vec(const vectorized::IColumn& column,
}
template <PrimitiveType T>
-uint16_t LikeColumnPredicate<T>::evaluate(const vectorized::IColumn& column, uint16_t* sel,
- uint16_t size) const {
+uint16_t LikeColumnPredicate<T>::_evaluate_inner(const vectorized::IColumn& column, uint16_t* sel,
+ uint16_t size) const {
uint16_t new_size = 0;
if (column.is_nullable()) {
auto* nullable_col = vectorized::check_and_get_column<vectorized::ColumnNullable>(column);
diff --git a/be/src/olap/like_column_predicate.h b/be/src/olap/like_column_predicate.h
index 3a918d7605d..eda033095a0 100644
--- a/be/src/olap/like_column_predicate.h
+++ b/be/src/olap/like_column_predicate.h
@@ -66,9 +66,6 @@ public:
return input_type == T || (is_string_type(input_type) && is_string_type(T));
}
- uint16_t evaluate(const vectorized::IColumn& column, uint16_t* sel,
- uint16_t size) const override;
-
void evaluate_and_vec(const vectorized::IColumn& column, uint16_t size,
bool* flags) const override;
@@ -91,6 +88,9 @@ public:
bool can_do_bloom_filter(bool ngram) const override { return ngram; }
private:
+ uint16_t _evaluate_inner(const vectorized::IColumn& column, uint16_t* sel,
+ uint16_t size) const override;
+
template <bool is_and>
void _evaluate_vec(const vectorized::IColumn& column, uint16_t size, bool* flags) const {
if (column.is_nullable()) {
diff --git a/be/src/olap/match_predicate.h b/be/src/olap/match_predicate.h
index 776c9c4c258..5ec8a8bf9cb 100644
--- a/be/src/olap/match_predicate.h
+++ b/be/src/olap/match_predicate.h
@@ -53,8 +53,8 @@ public:
bool support_zonemap() const override { return false; }
//evaluate predicate on Bitmap
- virtual Status evaluate(BitmapIndexIterator* iterator, uint32_t num_rows,
- roaring::Roaring* roaring) const override {
+ Status evaluate(BitmapIndexIterator* iterator, uint32_t num_rows,
+ roaring::Roaring* roaring) const override {
LOG(FATAL) << "Not Implemented MatchPredicate::evaluate";
}
@@ -68,6 +68,11 @@ public:
}
private:
+ uint16_t _evaluate_inner(const vectorized::IColumn& column, uint16_t* sel,
+ uint16_t size) const override {
+ return size;
+ }
+
InvertedIndexQueryType _to_inverted_index_query_type(MatchType match_type) const;
std::string _debug_string() const override {
std::string info = "MatchPredicate";
diff --git a/be/src/olap/null_predicate.cpp b/be/src/olap/null_predicate.cpp
index 7aec65cc7ea..0b184707d8f 100644
--- a/be/src/olap/null_predicate.cpp
+++ b/be/src/olap/null_predicate.cpp
@@ -77,8 +77,8 @@ Status NullPredicate::evaluate(const vectorized::NameAndTypePair& name_with_type
return Status::OK();
}
-uint16_t NullPredicate::evaluate(const vectorized::IColumn& column, uint16_t* sel,
- uint16_t size) const {
+uint16_t NullPredicate::_evaluate_inner(const vectorized::IColumn& column, uint16_t* sel,
+ uint16_t size) const {
uint16_t new_size = 0;
if (auto* nullable = check_and_get_column<ColumnNullable>(column)) {
if (!nullable->has_null()) {
diff --git a/be/src/olap/null_predicate.h b/be/src/olap/null_predicate.h
index 388d0803178..ccca5c51027 100644
--- a/be/src/olap/null_predicate.h
+++ b/be/src/olap/null_predicate.h
@@ -56,9 +56,6 @@ public:
InvertedIndexIterator* iterator, uint32_t num_rows,
roaring::Roaring* bitmap) const override;
- uint16_t evaluate(const vectorized::IColumn& column, uint16_t* sel,
- uint16_t size) const override;
-
void evaluate_or(const vectorized::IColumn& column, const uint16_t* sel, uint16_t size,
bool* flags) const override;
@@ -105,6 +102,9 @@ public:
void evaluate_vec(const vectorized::IColumn& column, uint16_t size, bool* flags) const override;
private:
+ uint16_t _evaluate_inner(const vectorized::IColumn& column, uint16_t* sel,
+ uint16_t size) const override;
+
std::string _debug_string() const override {
std::string info = "NullPredicate(" + std::string(_is_null ? "is_null" : "not_null") + ")";
return info;
diff --git a/be/src/olap/rowset/segment_v2/segment_iterator.cpp b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
index 3c7de0adb7b..68e67d28830 100644
--- a/be/src/olap/rowset/segment_v2/segment_iterator.cpp
+++ b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
@@ -1960,6 +1960,12 @@ void SegmentIterator::_replace_version_col(size_t num_rows) {
uint16_t SegmentIterator::_evaluate_vectorization_predicate(uint16_t* sel_rowid_idx,
uint16_t selected_size) {
SCOPED_RAW_TIMER(&_opts.stats->vec_cond_ns);
+ if (_is_need_vec_eval) {
+ _is_need_vec_eval = false;
+ for (const auto& pred : _pre_eval_block_predicate) {
+ _is_need_vec_eval |= (!pred->always_true());
+ }
+ }
if (!_is_need_vec_eval) {
for (uint32_t i = 0; i < selected_size; ++i) {
sel_rowid_idx[i] = i;
@@ -1969,14 +1975,20 @@ uint16_t SegmentIterator::_evaluate_vectorization_predicate(uint16_t* sel_rowid_
uint16_t original_size = selected_size;
bool ret_flags[original_size];
- DCHECK(_pre_eval_block_predicate.size() > 0);
- auto column_id = _pre_eval_block_predicate[0]->column_id();
- auto& column = _current_return_columns[column_id];
- _pre_eval_block_predicate[0]->evaluate_vec(*column, original_size, ret_flags);
- for (int i = 1; i < _pre_eval_block_predicate.size(); i++) {
- auto column_id2 = _pre_eval_block_predicate[i]->column_id();
- auto& column2 = _current_return_columns[column_id2];
- _pre_eval_block_predicate[i]->evaluate_and_vec(*column2, original_size, ret_flags);
+ DCHECK(!_pre_eval_block_predicate.empty());
+ bool is_first = true;
+ for (int i = 0; i < _pre_eval_block_predicate.size(); i++) {
+ if (_pre_eval_block_predicate[i]->always_true()) {
+ continue;
+ }
+ auto column_id = _pre_eval_block_predicate[i]->column_id();
+ auto& column = _current_return_columns[column_id];
+ if (is_first) {
+ _pre_eval_block_predicate[i]->evaluate_vec(*column, original_size, ret_flags);
+ is_first = false;
+ } else {
+ _pre_eval_block_predicate[i]->evaluate_and_vec(*column, original_size, ret_flags);
+ }
}
uint16_t new_size = 0;
diff --git a/be/src/vec/exprs/vruntimefilter_wrapper.cpp b/be/src/vec/exprs/vruntimefilter_wrapper.cpp
index c623355d673..075e5194866 100644
--- a/be/src/vec/exprs/vruntimefilter_wrapper.cpp
+++ b/be/src/vec/exprs/vruntimefilter_wrapper.cpp
@@ -121,7 +121,8 @@ Status VRuntimeFilterWrapper::execute(VExprContext* context, Block* block, int*
_expr_name, _data_type->get_name(), *result_column_id, block->dump_structure());
}
- calculate_filter(_filtered_rows, _scan_rows, _has_calculate_filter, _always_true);
+ calculate_filter(VRuntimeFilterWrapper::EXPECTED_FILTER_RATE, _filtered_rows, _scan_rows,
+ _has_calculate_filter, _always_true);
return Status::OK();
}
}
diff --git a/be/src/vec/exprs/vruntimefilter_wrapper.h b/be/src/vec/exprs/vruntimefilter_wrapper.h
index 642e669288f..6d50b914beb 100644
--- a/be/src/vec/exprs/vruntimefilter_wrapper.h
+++ b/be/src/vec/exprs/vruntimefilter_wrapper.h
@@ -60,10 +60,10 @@ public:
// if filter rate less than this, bloom filter will set always true
constexpr static double EXPECTED_FILTER_RATE = 0.4;
- static void calculate_filter(int64_t filter_rows, int64_t scan_rows, bool& has_calculate,
- bool& always_true) {
- if ((!has_calculate) && (scan_rows > config::bloom_filter_predicate_check_row_num)) {
- if (filter_rows / (scan_rows * 1.0) < VRuntimeFilterWrapper::EXPECTED_FILTER_RATE) {
+ static void calculate_filter(double ignore_threshold, int64_t filter_rows, int64_t scan_rows,
+ bool& has_calculate, bool& always_true) {
+ if ((!has_calculate) && (scan_rows > config::rf_predicate_check_row_num)) {
+ if (filter_rows / (scan_rows * 1.0) < ignore_threshold) {
always_true = true;
}
has_calculate = true;
diff --git a/be/test/olap/bitmap_filter_column_predicate_test.cpp b/be/test/olap/bitmap_filter_column_predicate_test.cpp
index da7d92d546d..2f97704de50 100644
--- a/be/test/olap/bitmap_filter_column_predicate_test.cpp
+++ b/be/test/olap/bitmap_filter_column_predicate_test.cpp
@@ -136,7 +136,7 @@ TEST_F(BitmapFilterColumnPredicateTest, evaluate_column) {
sel[i] = i;
}
uint16_t size = column->size();
- size = predicate.evaluate(*column, sel, size);
+ size = predicate.ColumnPredicate::evaluate(*column, sel, size);
EXPECT_EQ(size, 8);
EXPECT_EQ(sel[0], 0);
EXPECT_EQ(sel[1], 1);
@@ -178,7 +178,7 @@ TEST_F(BitmapFilterColumnPredicateTest, evaluate_column_nullable) {
}
uint16_t size = column_nullable->size();
- size = predicate.evaluate(*column_nullable, sel, size);
+ size = predicate.ColumnPredicate::evaluate(*column_nullable, sel, size);
EXPECT_EQ(size, 6);
EXPECT_EQ(sel[0], 1);
diff --git a/docs/en/docs/query-acceleration/join-optimization/runtime-filter.md b/docs/en/docs/query-acceleration/join-optimization/runtime-filter.md
index a70522b0215..88a4e6dd169 100644
--- a/docs/en/docs/query-acceleration/join-optimization/runtime-filter.md
+++ b/docs/en/docs/query-acceleration/join-optimization/runtime-filter.md
@@ -114,7 +114,7 @@ The query options are further explained below.
#### 1.runtime_filter_type
Type of Runtime Filter used.
-**Type**: Number (1, 2, 4, 8, 16) or the corresponding mnemonic string (IN, BLOOM_FILTER, MIN_MAX, IN_OR_BLOOM_FILTER, BITMAP_FILTER), the default is 8 (IN_OR_BLOOM FILTER), use multiple commas to separate, pay attention to the need to add quotation marks , Or add any number of types, for example:
+**Type**: Number (1, 2, 4, 8, 16) or the corresponding mnemonic string (IN, BLOOM_FILTER, MIN_MAX, IN_OR_BLOOM_FILTER, BITMAP_FILTER), the default is 12 (MIN_MAX,IN_OR_BLOOM_FILTER), use multiple commas to separate, pay attention to the need to add quotation marks , Or add any number of types, for example:
```
set runtime_filter_type="BLOOM_FILTER,IN,MIN_MAX";
```
diff --git a/docs/zh-CN/docs/query-acceleration/join-optimization/runtime-filter.md b/docs/zh-CN/docs/query-acceleration/join-optimization/runtime-filter.md
index 8ed2876235a..bcb8fcf9de1 100644
--- a/docs/zh-CN/docs/query-acceleration/join-optimization/runtime-filter.md
+++ b/docs/zh-CN/docs/query-acceleration/join-optimization/runtime-filter.md
@@ -111,7 +111,7 @@ Runtime Filter主要用于大表join小表的优化,如果左表的数据量
使用的Runtime Filter类型。
-**类型**: 数字(1, 2, 4, 8, 16)或者相对应的助记符字符串(IN, BLOOM_FILTER, MIN_MAX, `IN_OR_BLOOM_FILTER`, BITMAP_FILTER),默认8(`IN_OR_BLOOM_FILTER`),使用多个时用逗号分隔,注意需要加引号,或者将任意多个类型的数字相加,例如:
+**类型**: 数字(1, 2, 4, 8, 16)或者相对应的助记符字符串(IN, BLOOM_FILTER, MIN_MAX, IN_OR_BLOOM_FILTER, BITMAP_FILTER),默认12(MIN_MAX,IN_OR_BLOOM_FILTER),使用多个时用逗号分隔,注意需要加引号,或者将任意多个类型的数字相加,例如:
```sql
set runtime_filter_type="BLOOM_FILTER,IN,MIN_MAX";
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
index e4e23b411cd..de3c7a1ffa3 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
@@ -902,7 +902,7 @@ public class SessionVariable implements Serializable, Writable {
// Set runtimeFilterType to IN_OR_BLOOM filter
@VariableMgr.VarAttr(name = RUNTIME_FILTER_TYPE, fuzzy = true, needForward = true)
- private int runtimeFilterType = 8;
+ private int runtimeFilterType = 12;
@VariableMgr.VarAttr(name = RUNTIME_FILTER_MAX_IN_NUM, needForward = true)
private int runtimeFilterMaxInNum = 1024;
diff --git a/regression-test/data/variable_p0/set_and_unset_variable.out b/regression-test/data/variable_p0/set_and_unset_variable.out
index 7f6aeed2efe..e7f0dc2fdf1 100644
--- a/regression-test/data/variable_p0/set_and_unset_variable.out
+++ b/regression-test/data/variable_p0/set_and_unset_variable.out
@@ -21,37 +21,37 @@ wait_timeout 28800 28800 0
0
-- !cmd --
-runtime_filter_type BLOOM_FILTER IN_OR_BLOOM_FILTER 1
+runtime_filter_type BLOOM_FILTER IN_OR_BLOOM_FILTER,MIN_MAX 1
-- !cmd --
-runtime_filter_type IN_OR_BLOOM_FILTER IN_OR_BLOOM_FILTER 0
+runtime_filter_type IN_OR_BLOOM_FILTER,MIN_MAX IN_OR_BLOOM_FILTER,MIN_MAX 0
-- !cmd --
0
-- !cmd --
-runtime_filter_type IN_OR_BLOOM_FILTER IN_OR_BLOOM_FILTER 0
+runtime_filter_type IN_OR_BLOOM_FILTER,MIN_MAX IN_OR_BLOOM_FILTER,MIN_MAX 0
-- !cmd --
-runtime_filter_type IN_OR_BLOOM_FILTER IN_OR_BLOOM_FILTER 0
+runtime_filter_type IN_OR_BLOOM_FILTER,MIN_MAX IN_OR_BLOOM_FILTER,MIN_MAX 0
-- !cmd --
0
-- !cmd --
-runtime_filter_type BLOOM_FILTER IN_OR_BLOOM_FILTER 1
+runtime_filter_type BLOOM_FILTER IN_OR_BLOOM_FILTER,MIN_MAX 1
-- !cmd --
-runtime_filter_type BLOOM_FILTER IN_OR_BLOOM_FILTER 1
+runtime_filter_type BLOOM_FILTER IN_OR_BLOOM_FILTER,MIN_MAX 1
-- !cmd --
0
-- !cmd --
-runtime_filter_type IN_OR_BLOOM_FILTER IN_OR_BLOOM_FILTER 0
+runtime_filter_type IN_OR_BLOOM_FILTER,MIN_MAX IN_OR_BLOOM_FILTER,MIN_MAX 0
-- !cmd --
-runtime_filter_type IN_OR_BLOOM_FILTER IN_OR_BLOOM_FILTER 0
+runtime_filter_type IN_OR_BLOOM_FILTER,MIN_MAX IN_OR_BLOOM_FILTER,MIN_MAX 0
-- !cmd --
0
@@ -123,7 +123,7 @@ deprecated_enable_local_exchange true true 0
0
-- !cmd --
-runtime_filter_type IN_OR_BLOOM_FILTER IN_OR_BLOOM_FILTER 0
+runtime_filter_type IN_OR_BLOOM_FILTER,MIN_MAX IN_OR_BLOOM_FILTER,MIN_MAX 0
-- !cmd --
experimental_enable_agg_state false false 0
@@ -150,7 +150,7 @@ show_hidden_columns false false 0
0
-- !cmd --
-runtime_filter_type IN_OR_BLOOM_FILTER IN_OR_BLOOM_FILTER 0
+runtime_filter_type IN_OR_BLOOM_FILTER,MIN_MAX IN_OR_BLOOM_FILTER,MIN_MAX 0
-- !cmd --
experimental_enable_agg_state false false 0
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 09/24: [Bug](java-udf) fix core dump when javaudf input 0 row block (#30720)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 5687ca977dd6acd9fdeadb7b6f3090888ab15d42
Author: Pxl <px...@qq.com>
AuthorDate: Fri Feb 2 20:03:38 2024 +0800
[Bug](java-udf) fix core dump when javaudf input 0 row block (#30720)
fix core dump when javaudf input 0 row block
---
be/src/olap/schema_change.cpp | 5 +++++
be/src/vec/exec/jni_connector.cpp | 11 +++++------
.../src/main/java/org/apache/doris/analysis/Analyzer.java | 10 ++++++++++
.../org/apache/doris/analysis/CreateMaterializedViewStmt.java | 6 ++++++
.../main/java/org/apache/doris/analysis/FunctionCallExpr.java | 4 ++--
.../java/org/apache/doris/catalog/MaterializedIndexMeta.java | 2 +-
regression-test/data/javaudf_p0/test_javaudf_float.out | 5 +++++
regression-test/suites/javaudf_p0/test_javaudf_float.groovy | 7 +++++++
8 files changed, 41 insertions(+), 9 deletions(-)
diff --git a/be/src/olap/schema_change.cpp b/be/src/olap/schema_change.cpp
index 66e6ffcf2b2..f0372f4bcf7 100644
--- a/be/src/olap/schema_change.cpp
+++ b/be/src/olap/schema_change.cpp
@@ -293,6 +293,11 @@ Status BlockChanger::change_block(vectorized::Block* ref_block,
int result_column_id = -1;
RETURN_IF_ERROR(ctx->execute(ref_block, &result_column_id));
+ if (ref_block->get_by_position(result_column_id).column == nullptr) {
+ return Status::Error<ErrorCode::INTERNAL_ERROR>(
+ "{} result column is nullptr",
+ ref_block->get_by_position(result_column_id).name);
+ }
ref_block->replace_by_position_if_const(result_column_id);
if (ref_block->get_by_position(result_column_id).column->size() != row_size) {
diff --git a/be/src/vec/exec/jni_connector.cpp b/be/src/vec/exec/jni_connector.cpp
index 26b66f48aca..fe3bcd50d41 100644
--- a/be/src/vec/exec/jni_connector.cpp
+++ b/be/src/vec/exec/jni_connector.cpp
@@ -215,8 +215,10 @@ Status JniConnector::close() {
Status JniConnector::_init_jni_scanner(JNIEnv* env, int batch_size) {
RETURN_IF_ERROR(
JniUtil::get_jni_scanner_class(env, _connector_class.c_str(), &_jni_scanner_cls));
- if (_jni_scanner_cls == NULL) {
- if (env->ExceptionOccurred()) env->ExceptionDescribe();
+ if (_jni_scanner_cls == nullptr) {
+ if (env->ExceptionOccurred()) {
+ env->ExceptionDescribe();
+ }
return Status::InternalError("Fail to get JniScanner class.");
}
RETURN_ERROR_IF_EXC(env);
@@ -249,13 +251,10 @@ Status JniConnector::_init_jni_scanner(JNIEnv* env, int batch_size) {
Status JniConnector::fill_block(Block* block, const ColumnNumbers& arguments, long table_address) {
if (table_address == 0) {
- return Status::OK();
+ return Status::InternalError("table_address is 0");
}
TableMetaAddress table_meta(table_address);
long num_rows = table_meta.next_meta_as_long();
- if (num_rows == 0) {
- return Status::OK();
- }
for (size_t i : arguments) {
if (block->get_by_position(i).column == nullptr) {
auto return_type = block->get_data_type(i);
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
index 115ca193622..38b7403960c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
@@ -192,6 +192,8 @@ public class Analyzer {
private boolean isReAnalyze = false;
+ private boolean isReplay = false;
+
public void setIsSubquery() {
isSubquery = true;
isFirstScopeInSubquery = true;
@@ -266,6 +268,14 @@ public class Analyzer {
return globalState.autoBroadcastJoinThreshold;
}
+ public void setReplay() {
+ isReplay = true;
+ }
+
+ public boolean isReplay() {
+ return isReplay;
+ }
+
private static class InferPredicateState {
// map from two table tuple ids to JoinOperator between two tables.
// NOTE: first tupleId's position in front of the second tupleId.
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateMaterializedViewStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateMaterializedViewStmt.java
index c6a3db45b96..9c120d70048 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateMaterializedViewStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateMaterializedViewStmt.java
@@ -200,6 +200,9 @@ public class CreateMaterializedViewStmt extends DdlStmt {
rewriteToBitmapWithCheck();
// TODO(ml): The mv name in from clause should pass the analyze without error.
selectStmt.forbiddenMVRewrite();
+ if (isReplay) {
+ analyzer.setReplay();
+ }
selectStmt.analyze(analyzer);
ExprRewriter rewriter = analyzer.getExprRewriter();
@@ -207,6 +210,9 @@ public class CreateMaterializedViewStmt extends DdlStmt {
selectStmt.rewriteExprs(rewriter);
selectStmt.reset();
analyzer = new Analyzer(analyzer.getEnv(), analyzer.getContext());
+ if (isReplay) {
+ analyzer.setReplay();
+ }
selectStmt.analyze(analyzer);
analyzeSelectClause(analyzer);
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
index 4273b4b56e9..9907b497bb9 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
@@ -2471,8 +2471,8 @@ public class FunctionCallExpr extends Expr {
String dbName = fnName.analyzeDb(analyzer);
if (!Strings.isNullOrEmpty(dbName)) {
// check operation privilege
- if (!Env.getCurrentEnv().getAccessManager()
- .checkDbPriv(ConnectContext.get(), dbName, PrivPredicate.SELECT)) {
+ if (!analyzer.isReplay() && !Env.getCurrentEnv().getAccessManager().checkDbPriv(ConnectContext.get(),
+ dbName, PrivPredicate.SELECT)) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR, "SELECT");
}
// TODO(gaoxin): ExternalDatabase not implement udf yet.
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/MaterializedIndexMeta.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/MaterializedIndexMeta.java
index 57d428d481f..82a49b14907 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/MaterializedIndexMeta.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/MaterializedIndexMeta.java
@@ -303,6 +303,7 @@ public class MaterializedIndexMeta implements Writable, GsonPostProcessable {
CreateMaterializedViewStmt stmt;
try {
stmt = (CreateMaterializedViewStmt) SqlParserUtils.getStmt(parser, defineStmt.idx);
+ stmt.setIsReplay(true);
if (analyzer != null) {
try {
stmt.analyze(analyzer);
@@ -312,7 +313,6 @@ public class MaterializedIndexMeta implements Writable, GsonPostProcessable {
}
}
- stmt.setIsReplay(true);
setWhereClause(stmt.getWhereClause());
stmt.rewriteToBitmapWithCheck();
try {
diff --git a/regression-test/data/javaudf_p0/test_javaudf_float.out b/regression-test/data/javaudf_p0/test_javaudf_float.out
index d806cbd5461..91977ee43e7 100644
--- a/regression-test/data/javaudf_p0/test_javaudf_float.out
+++ b/regression-test/data/javaudf_p0/test_javaudf_float.out
@@ -21,6 +21,11 @@
112 1012333.8
113 \N
+-- !select --
+111 -211111.22
+112 1012333.8
+113 \N
+
-- !select --
113.9475611
diff --git a/regression-test/suites/javaudf_p0/test_javaudf_float.groovy b/regression-test/suites/javaudf_p0/test_javaudf_float.groovy
index 06a7f6a4730..0672e1545d7 100644
--- a/regression-test/suites/javaudf_p0/test_javaudf_float.groovy
+++ b/regression-test/suites/javaudf_p0/test_javaudf_float.groovy
@@ -63,6 +63,13 @@ suite("test_javaudf_float") {
qt_select """ SELECT java_udf_float_test(2.83645,null) as result ; """
qt_select """ SELECT java_udf_float_test(cast(2.83645 as float),null) as result ; """
qt_select """ SELECT user_id,java_udf_float_test(float_1, float_2) as sum FROM ${tableName} order by user_id; """
+ createMV("create materialized view udf_mv as SELECT user_id,java_udf_float_test(float_1, float_2) as sum FROM test_javaudf_float order by user_id;")
+ qt_select """ SELECT user_id,java_udf_float_test(float_1, float_2) as sum FROM ${tableName} order by user_id; """
+
+ explain {
+ sql("SELECT user_id,java_udf_float_test(float_1, float_2) as sum FROM ${tableName} order by user_id; ")
+ contains "(udf_mv)"
+ }
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 06/24: [Bug](pipeline) fix pipeline task execute without wait second start rpc (#30659)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 0e2d2f616984997be1e05d7938603e75bcc802b3
Author: zhangstar333 <87...@users.noreply.github.com>
AuthorDate: Fri Feb 2 18:13:07 2024 +0800
[Bug](pipeline) fix pipeline task execute without wait second start rpc (#30659)
---
be/src/pipeline/pipeline_task.cpp | 25 ++++++++++++++++++++-----
be/src/pipeline/pipeline_task.h | 1 +
2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/be/src/pipeline/pipeline_task.cpp b/be/src/pipeline/pipeline_task.cpp
index 9b72762ebf9..6ea1b482c85 100644
--- a/be/src/pipeline/pipeline_task.cpp
+++ b/be/src/pipeline/pipeline_task.cpp
@@ -232,15 +232,30 @@ Status PipelineTask::execute(bool* eos) {
if (!_opened) {
{
SCOPED_RAW_TIMER(&time_spent);
- auto st = _open();
- if (st.is<ErrorCode::PIP_WAIT_FOR_RF>()) {
+ // if _open_status is not ok, could know have execute open function,
+ // now execute open again, so need excluding PIP_WAIT_FOR_RF and PIP_WAIT_FOR_SC error out.
+ if (!_open_status.ok() && !_open_status.is<ErrorCode::PIP_WAIT_FOR_RF>() &&
+ !_open_status.is<ErrorCode::PIP_WAIT_FOR_SC>()) {
+ return _open_status;
+ }
+ // here execute open and not check dependency(eg: the second start rpc arrival)
+ // so if open have some error, and return error status directly, the query will be cancel.
+ // and then the rpc arrival will not found the query as have been canceled and remove.
+ _open_status = _open();
+ if (_open_status.is<ErrorCode::PIP_WAIT_FOR_RF>()) {
set_state(PipelineTaskState::BLOCKED_FOR_RF);
return Status::OK();
- } else if (st.is<ErrorCode::PIP_WAIT_FOR_SC>()) {
+ } else if (_open_status.is<ErrorCode::PIP_WAIT_FOR_SC>()) {
set_state(PipelineTaskState::BLOCKED_FOR_SOURCE);
return Status::OK();
}
- RETURN_IF_ERROR(st);
+ //if status is not ok, and have dependency to push back to queue again.
+ if (!_open_status.ok() && has_dependency()) {
+ set_state(PipelineTaskState::BLOCKED_FOR_DEPENDENCY);
+ return Status::OK();
+ }
+ // if not ok and no dependency, return error to cancel.
+ RETURN_IF_ERROR(_open_status);
}
if (has_dependency()) {
set_state(PipelineTaskState::BLOCKED_FOR_DEPENDENCY);
@@ -297,7 +312,7 @@ Status PipelineTask::execute(bool* eos) {
}
}
}
- if (*eos) { // now only join node have add_dependency, and join probe could start when the join sink is eos
+ if (*eos) { // now only join node/set operation node have add_dependency, and join probe could start when the join sink is eos
_finish_p_dependency();
}
diff --git a/be/src/pipeline/pipeline_task.h b/be/src/pipeline/pipeline_task.h
index dd512293e05..04bc55908e3 100644
--- a/be/src/pipeline/pipeline_task.h
+++ b/be/src/pipeline/pipeline_task.h
@@ -324,6 +324,7 @@ protected:
// 3 update task statistics(update _queue_level/_core_id)
int _queue_level = 0;
int _core_id = 0;
+ Status _open_status = Status::OK();
RuntimeProfile* _parent_profile = nullptr;
std::unique_ptr<RuntimeProfile> _task_profile;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 19/24: [doc](jdbc catalog) add connection pool doc (#30641)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit f01813750069556434fbd6eb36a12b214cb62bc6
Author: zy-kkk <zh...@gmail.com>
AuthorDate: Sat Feb 3 18:43:38 2024 +0800
[doc](jdbc catalog) add connection pool doc (#30641)
---
docs/en/docs/lakehouse/multi-catalog/jdbc.md | 16 ++++++++++++++++
docs/zh-CN/docs/lakehouse/multi-catalog/jdbc.md | 16 ++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/docs/en/docs/lakehouse/multi-catalog/jdbc.md b/docs/en/docs/lakehouse/multi-catalog/jdbc.md
index dc45c247d54..f9e21b2080b 100644
--- a/docs/en/docs/lakehouse/multi-catalog/jdbc.md
+++ b/docs/en/docs/lakehouse/multi-catalog/jdbc.md
@@ -159,6 +159,22 @@ set enable_odbc_transcation = true;
The transaction mechanism ensures the atomicity of data writing to JDBC External Tables, but it reduces performance to a certain extent. You may decide whether to enable transactions based on your own tradeoff.
+## JDBC Connection Pool Configuration
+
+In Doris, each Frontend (FE) and Backend (BE) node maintains a connection pool, thus avoiding the need to frequently open and close individual connections to data sources. Each connection within this pool can be used to establish a connection to a data source and perform queries. After operations are completed, connections are returned to the pool for reuse. This not only enhances performance but also reduces system load during connection establishment, and helps to prevent hitting the m [...]
+
+The following Catalog configuration properties are available for tuning the behavior of the connection pool:
+
+| Parameter Name | Default Value | Description and Behavior |
+|---------------------------------|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `connection_pool_min_size` | 1 | Defines the minimum number of connections that the pool will maintain, ensuring that this number of connections remains active when the keep-alive mechanism is enabled. |
+| `connection_pool_max_size` | 10 | Specifies the maximum number of connections allowed in the pool. Each Catalog corresponding to every FE or BE node can hold up to this number of connections. |
+| `connection_pool_max_wait_time` | 5000 | Determines the maximum amount of time, in milliseconds, that the client will wait for a connection from the pool if none is immediately available. |
+| `connection_pool_max_life_time` | 1800000 | Sets the maximum lifetime of connections in the pool, in milliseconds. Connections exceeding this set time limit will be forcibly closed. Additionally, half of this value is used as the minimum evictable idle time for the pool. Connections reaching this idle time are considered for eviction, and the eviction task runs at intervals of one-tenth of the `connection_pool_max_life_time`. |
+| `connection_pool_keep_alive` | false | Effective only on BE nodes, it controls whether to keep connections that have reached the minimum evictable idle time but not the maximum lifetime active. It is kept false by default to avoid unnecessary resource usage. |
+
+To prevent an accumulation of unused connection pool caches on the BE, the BE `jdbc_connection_pool_cache_clear_time_sec` parameter for the BE can be set to specify the interval for clearing the cache. With a default value of 28800 seconds (8 hours), the BE will forcibly clear all connection pool caches that have not been used beyond this interval.
+
## Guide
### View the JDBC Catalog
diff --git a/docs/zh-CN/docs/lakehouse/multi-catalog/jdbc.md b/docs/zh-CN/docs/lakehouse/multi-catalog/jdbc.md
index 52aece0db2b..23e9f777a81 100644
--- a/docs/zh-CN/docs/lakehouse/multi-catalog/jdbc.md
+++ b/docs/zh-CN/docs/lakehouse/multi-catalog/jdbc.md
@@ -159,6 +159,22 @@ set enable_odbc_transcation = true;
事务保证了JDBC外表数据写入的原子性,但是一定程度上会降低数据写入的性能,可以考虑酌情开启该功能。
+## JDBC 连接池配置
+
+在 Doris 中,每个 FE 和 BE 节点都会维护一个连接池,这样可以避免频繁地打开和关闭单独的数据源连接。连接池中的每个连接都可以用来与数据源建立连接并执行查询。任务完成后,这些连接会被归还到池中以便重复使用,这不仅提高了性能,还减少了建立连接时的系统开销,并帮助防止达到数据源的连接数上限。
+
+下面列出了一些可用于调整连接池行为的 Catalog 配置属性:
+
+| 参数名称 | 默认值 | 描述和行为 |
+|---------------------------------|---------|-----------------------------------------------------------------------------------------------------|
+| `connection_pool_min_size` | 1 | 定义连接池的最小连接数,用于初始化连接池并保证在启用保活机制时至少有该数量的连接处于活跃状态。 |
+| `connection_pool_max_size` | 10 | 定义连接池的最大连接数,每个 Catalog 对应的每个 FE 或 BE 节点最多可持有此数量的连接。 |
+| `connection_pool_max_wait_time` | 5000 | 如果连接池中没有可用连接,定义客户端等待连接的最大毫秒数。 |
+| `connection_pool_max_life_time` | 1800000 | 设置连接在连接池中保持活跃的最大时长(毫秒)。超时的连接将被回收。同时,此值的一半将作为连接池的最小逐出空闲时间,达到该时间的连接将成为逐出候选对象。执行回收操作的频率将是该最大生命周期的十分之一。 |
+| `connection_pool_keep_alive` | false | 仅在 BE 节点上有效,用于决定是否保持达到最小逐出空闲时间但未到最大生命周期的连接活跃。默认关闭,以减少不必要的资源使用。 |
+
+为了避免在 BE 上累积过多的未使用的连接池缓存,可以通过设置 BE 的 `jdbc_connection_pool_cache_clear_time_sec` 参数来指定清理缓存的时间间隔。默认值为 28800 秒(8小时),此间隔过后,BE 将强制清理所有超过该时间未使用的连接池缓存。
+
## 使用指南
### 查看 JDBC Catalog
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 07/24: [fix](move-memtable) use signed integer when calculating remain ms (#30750)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 79a83e9e1a637d66dd2c01dc34fa206b9e8907ee
Author: Kaijie Chen <ck...@apache.org>
AuthorDate: Fri Feb 2 19:15:04 2024 +0800
[fix](move-memtable) use signed integer when calculating remain ms (#30750)
---
be/src/vec/sink/writer/vtablet_writer_v2.cpp | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/be/src/vec/sink/writer/vtablet_writer_v2.cpp b/be/src/vec/sink/writer/vtablet_writer_v2.cpp
index f2fdbcaece3..e0576ac11da 100644
--- a/be/src/vec/sink/writer/vtablet_writer_v2.cpp
+++ b/be/src/vec/sink/writer/vtablet_writer_v2.cpp
@@ -551,15 +551,15 @@ Status VTabletWriterV2::close(Status exec_status) {
{
SCOPED_TIMER(_close_load_timer);
- auto remain_ms = _state->execution_timeout() * 1000 -
- _timeout_watch.elapsed_time() / 1000 / 1000;
- if (remain_ms <= 0) {
- LOG(WARNING) << "load timed out before close waiting, load_id="
- << print_id(_load_id);
- return Status::TimedOut("load timed out before close waiting");
- }
for (const auto& [_, streams] : _streams_for_node) {
for (const auto& stream : streams->streams()) {
+ int64_t remain_ms = static_cast<int64_t>(_state->execution_timeout()) * 1000 -
+ _timeout_watch.elapsed_time() / 1000 / 1000;
+ if (remain_ms <= 0) {
+ LOG(WARNING) << "load timed out before close waiting, load_id="
+ << print_id(_load_id);
+ return Status::TimedOut("load timed out before close waiting");
+ }
RETURN_IF_ERROR(stream->close_wait(remain_ms));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 11/24: [ehmancement](binlog) Add show proc '/binlog' impl (#30770)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit ac681e8e8c513bc3ba07a82cc1661c65e1c0b53c
Author: Jack Drogon <ja...@gmail.com>
AuthorDate: Fri Feb 2 21:37:44 2024 +0800
[ehmancement](binlog) Add show proc '/binlog' impl (#30770)
Signed-off-by: Jack Drogon <ja...@gmail.com>
---
.../org/apache/doris/binlog/BinlogConfigCache.java | 4 +-
.../org/apache/doris/binlog/BinlogManager.java | 24 +++++++
.../java/org/apache/doris/binlog/BinlogUtils.java | 4 ++
.../java/org/apache/doris/binlog/DBBinlog.java | 64 +++++++++++++++++
.../java/org/apache/doris/binlog/TableBinlog.java | 82 ++++++++++++++++++++++
.../apache/doris/common/proc/BinlogProcDir.java | 45 ++++++++++++
.../org/apache/doris/common/proc/ProcService.java | 1 +
7 files changed, 223 insertions(+), 1 deletion(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogConfigCache.java b/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogConfigCache.java
index c414b853078..30641bae8c6 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogConfigCache.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogConfigCache.java
@@ -97,7 +97,7 @@ public class BinlogConfigCache {
return null;
}
- Table table = db.getTableOrMetaException(tableId);
+ Table table = db.getTableNullable(tableId);
if (table == null) {
LOG.warn("fail to get table. db: {}, table id: {}", db.getFullName(), tableId);
return null;
@@ -109,6 +109,8 @@ public class BinlogConfigCache {
OlapTable olapTable = (OlapTable) table;
tableBinlogConfig = olapTable.getBinlogConfig();
+ // get table binlog config, when table modify binlogConfig
+ // it create a new binlog, not update inplace, so we don't need to clone binlogConfig
dbTableBinlogEnableMap.put(tableId, tableBinlogConfig);
return tableBinlogConfig;
} catch (Exception e) {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogManager.java b/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogManager.java
index 8c68f908ce5..8187e966561 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogManager.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogManager.java
@@ -22,6 +22,8 @@ import org.apache.doris.catalog.Database;
import org.apache.doris.catalog.Env;
import org.apache.doris.common.Config;
import org.apache.doris.common.Pair;
+import org.apache.doris.common.proc.BaseProcResult;
+import org.apache.doris.common.proc.ProcResult;
import org.apache.doris.persist.AlterDatabasePropertyInfo;
import org.apache.doris.persist.BarrierLog;
import org.apache.doris.persist.BatchModifyPartitionsInfo;
@@ -36,6 +38,7 @@ import org.apache.doris.thrift.TBinlogType;
import org.apache.doris.thrift.TStatus;
import org.apache.doris.thrift.TStatusCode;
+import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.logging.log4j.LogManager;
@@ -54,6 +57,11 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
public class BinlogManager {
private static final int BUFFER_SIZE = 16 * 1024;
+ private static final ImmutableList<String> TITLE_NAMES = new ImmutableList.Builder<String>().add("Name")
+ .add("Type").add("Id").add("Dropped").add("BinlogLength").add("FirstBinlogCommittedTime")
+ .add("ReadableFirstBinlogCommittedTime").add("LastBinlogCommittedTime")
+ .add("ReadableLastBinlogCommittedTime").add("BinlogTtlSeconds")
+ .build();
private static final Logger LOG = LogManager.getLogger(BinlogManager.class);
@@ -545,6 +553,22 @@ public class BinlogManager {
return checksum;
}
+ public ProcResult getBinlogInfo() {
+ BaseProcResult result = new BaseProcResult();
+ result.setNames(TITLE_NAMES);
+
+ lock.readLock().lock();
+ try {
+ for (DBBinlog dbBinlog : dbBinlogMap.values()) {
+ dbBinlog.getBinlogInfo(result);
+ }
+ } finally {
+ lock.readLock().unlock();
+ }
+
+ return result;
+ }
+
// remove DB
// remove Table
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogUtils.java b/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogUtils.java
index 4e134104b6d..0f6c2308248 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogUtils.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogUtils.java
@@ -90,4 +90,8 @@ public class BinlogUtils {
long expireSeconds = currentSeconds - ttlSeconds;
return expireSeconds * 1000;
}
+
+ public static String convertTimeToReadable(long time) {
+ return new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new java.util.Date(time));
+ }
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/binlog/DBBinlog.java b/fe/fe-core/src/main/java/org/apache/doris/binlog/DBBinlog.java
index 4ba1416cd5c..a3133bfb5c7 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/binlog/DBBinlog.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/binlog/DBBinlog.java
@@ -18,7 +18,10 @@
package org.apache.doris.binlog;
import org.apache.doris.catalog.BinlogConfig;
+import org.apache.doris.catalog.Database;
+import org.apache.doris.catalog.Env;
import org.apache.doris.common.Pair;
+import org.apache.doris.common.proc.BaseProcResult;
import org.apache.doris.thrift.TBinlog;
import org.apache.doris.thrift.TBinlogType;
import org.apache.doris.thrift.TStatus;
@@ -30,6 +33,7 @@ import com.google.common.collect.Sets;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
@@ -448,4 +452,64 @@ public class DBBinlog {
lock.writeLock().unlock();
}
}
+
+ public void getBinlogInfo(BaseProcResult result) {
+ BinlogConfig binlogConfig = binlogConfigCache.getDBBinlogConfig(dbId);
+
+ String dbName = "(dropped)";
+ String dropped = "true";
+ Database db = Env.getCurrentInternalCatalog().getDbNullable(dbId);
+ if (db != null) {
+ dbName = db.getFullName();
+ dropped = "false";
+ }
+
+ lock.readLock().lock();
+ try {
+ boolean dbBinlogEnable = binlogConfigCache.isEnableDB(dbId);
+ if (dbBinlogEnable) {
+ List<String> info = new ArrayList<>();
+
+ info.add(dbName);
+ String type = "db";
+ info.add(type);
+ String id = String.valueOf(dbId);
+ info.add(id);
+ info.add(dropped);
+ String binlogLength = String.valueOf(allBinlogs.size());
+ info.add(binlogLength);
+ String firstBinlogCommittedTime = null;
+ String readableFirstBinlogCommittedTime = null;
+ if (!timestamps.isEmpty()) {
+ long timestamp = timestamps.get(0).second;
+ firstBinlogCommittedTime = String.valueOf(timestamp);
+ readableFirstBinlogCommittedTime = BinlogUtils.convertTimeToReadable(timestamp);
+ }
+ info.add(firstBinlogCommittedTime);
+ info.add(readableFirstBinlogCommittedTime);
+ String lastBinlogCommittedTime = null;
+ String readableLastBinlogCommittedTime = null;
+ if (!timestamps.isEmpty()) {
+ long timestamp = timestamps.get(timestamps.size() - 1).second;
+ lastBinlogCommittedTime = String.valueOf(timestamp);
+ readableLastBinlogCommittedTime = BinlogUtils.convertTimeToReadable(timestamp);
+ }
+ info.add(lastBinlogCommittedTime);
+ info.add(readableLastBinlogCommittedTime);
+ String binlogTtlSeconds = null;
+ if (binlogConfig != null) {
+ binlogTtlSeconds = String.valueOf(binlogConfig.getTtlSeconds());
+ }
+ info.add(binlogTtlSeconds);
+
+ result.addRow(info);
+ } else {
+ for (TableBinlog tableBinlog : tableBinlogMap.values()) {
+ tableBinlog.getBinlogInfo(db, result);
+ }
+ }
+ } finally {
+ lock.readLock().unlock();
+ }
+ }
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/binlog/TableBinlog.java b/fe/fe-core/src/main/java/org/apache/doris/binlog/TableBinlog.java
index 0857ae7abb1..3dd290a07f8 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/binlog/TableBinlog.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/binlog/TableBinlog.java
@@ -18,7 +18,11 @@
package org.apache.doris.binlog;
import org.apache.doris.catalog.BinlogConfig;
+import org.apache.doris.catalog.Database;
+import org.apache.doris.catalog.OlapTable;
+import org.apache.doris.catalog.Table;
import org.apache.doris.common.Pair;
+import org.apache.doris.common.proc.BaseProcResult;
import org.apache.doris.thrift.TBinlog;
import org.apache.doris.thrift.TBinlogType;
import org.apache.doris.thrift.TStatus;
@@ -27,8 +31,10 @@ import com.google.common.collect.Sets;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
+import java.util.List;
import java.util.TreeSet;
import java.util.concurrent.locks.ReentrantReadWriteLock;
@@ -233,4 +239,80 @@ public class TableBinlog {
lock.writeLock().unlock();
}
}
+
+ public void getBinlogInfo(Database db, BaseProcResult result) {
+ BinlogConfig binlogConfig = binlogConfigCache.getTableBinlogConfig(dbId, tableId);
+
+ String tableName = null;
+ String dropped = null;
+ if (db == null) {
+ tableName = "(dropped).(unknown)";
+ dropped = "true";
+ } else {
+ String dbName = db.getFullName();
+ Table table = db.getTableNullable(tableId);
+ if (table == null) {
+ dropped = "true";
+ tableName = dbName + ".(dropped)";
+ }
+
+ dropped = "false";
+ if (table instanceof OlapTable) {
+ OlapTable olapTable = (OlapTable) table;
+ tableName = dbName + "." + olapTable.getName();
+ } else {
+ tableName = dbName + ".(not_olaptable)";
+ }
+ }
+
+ lock.readLock().lock();
+ try {
+ List<String> info = new ArrayList<>();
+
+ info.add(tableName);
+ String type = "table";
+ info.add(type);
+
+ String id = String.valueOf(tableId);
+ info.add(id);
+ info.add(dropped);
+ String binlogLength = String.valueOf(binlogs.size());
+ info.add(binlogLength);
+ String firstBinlogCommittedTime = null;
+ String readableFirstBinlogCommittedTime = null;
+ for (TBinlog binlog : binlogs) {
+ long timestamp = binlog.getTimestamp();
+ if (timestamp != -1) {
+ firstBinlogCommittedTime = String.valueOf(timestamp);
+ readableFirstBinlogCommittedTime = BinlogUtils.convertTimeToReadable(timestamp);
+ break;
+ }
+ }
+ info.add(firstBinlogCommittedTime);
+ info.add(readableFirstBinlogCommittedTime);
+ String lastBinlogCommittedTime = null;
+ String readableLastBinlogCommittedTime = null;
+ Iterator<TBinlog> iterator = binlogs.descendingIterator();
+ while (iterator.hasNext()) {
+ TBinlog binlog = iterator.next();
+ long timestamp = binlog.getTimestamp();
+ if (timestamp != -1) {
+ lastBinlogCommittedTime = String.valueOf(timestamp);
+ readableLastBinlogCommittedTime = BinlogUtils.convertTimeToReadable(timestamp);
+ break;
+ }
+ }
+ info.add(lastBinlogCommittedTime);
+ info.add(readableLastBinlogCommittedTime);
+ String binlogTtlSeconds = null;
+ if (binlogConfig != null) {
+ binlogTtlSeconds = String.valueOf(binlogConfig.getTtlSeconds());
+ }
+ info.add(binlogTtlSeconds);
+
+ result.addRow(info);
+ } finally {
+ lock.readLock().unlock();
+ }
+ }
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/proc/BinlogProcDir.java b/fe/fe-core/src/main/java/org/apache/doris/common/proc/BinlogProcDir.java
new file mode 100644
index 00000000000..f72ed30d2b6
--- /dev/null
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/proc/BinlogProcDir.java
@@ -0,0 +1,45 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.common.proc;
+
+import org.apache.doris.binlog.BinlogManager;
+import org.apache.doris.catalog.Env;
+import org.apache.doris.common.AnalysisException;
+
+
+public class BinlogProcDir implements ProcDirInterface {
+ @Override
+ public boolean register(String name, ProcNodeInterface node) {
+ return false;
+ }
+
+ @Override
+ public ProcNodeInterface lookup(String name) throws AnalysisException {
+ throw new AnalysisException("not implemented");
+ }
+
+ @Override
+ public ProcResult fetchResult() throws AnalysisException {
+ BinlogManager binlogManager = Env.getCurrentEnv().getBinlogManager();
+ if (binlogManager == null) {
+ throw new AnalysisException("binlog manager is not initialized");
+ }
+
+ return binlogManager.getBinlogInfo();
+ }
+}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/proc/ProcService.java b/fe/fe-core/src/main/java/org/apache/doris/common/proc/ProcService.java
index e54ee4d5d11..42010ccbd20 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/proc/ProcService.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/proc/ProcService.java
@@ -58,6 +58,7 @@ public final class ProcService {
root.register("colocation_group", new ColocationGroupProcDir());
root.register("bdbje", new BDBJEProcDir());
root.register("diagnose", new DiagnoseProcDir());
+ root.register("binlog", new BinlogProcDir());
}
// 通过指定的路径获得对应的PROC Node
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 21/24: [Doc](auto-inc) Add doc for auto increment start value (#30741)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit d33f3be436a7c95c853e1dc0180b2764ea376af4
Author: abmdocrt <Yu...@gmail.com>
AuthorDate: Sat Feb 3 20:17:04 2024 +0800
[Doc](auto-inc) Add doc for auto increment start value (#30741)
---
docs/en/docs/advanced/auto-increment.md | 53 ++++++++++++++--------
.../Create/CREATE-TABLE.md | 7 +--
docs/zh-CN/docs/advanced/auto-increment.md | 53 ++++++++++++++--------
.../Create/CREATE-TABLE.md | 5 +-
4 files changed, 75 insertions(+), 43 deletions(-)
diff --git a/docs/en/docs/advanced/auto-increment.md b/docs/en/docs/advanced/auto-increment.md
index 98f1ee8e21f..9cc51cae8c0 100644
--- a/docs/en/docs/advanced/auto-increment.md
+++ b/docs/en/docs/advanced/auto-increment.md
@@ -48,7 +48,7 @@ Doris ensures that the values generated on the auto-increment column are dense,
## Syntax
-To use auto-increment columns, you need to add the `AUTO_INCREMENT` attribute to the corresponding column during table creation ([CREATE-TABLE](../../sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE)).
+To use auto-increment columns, you need to add the `AUTO_INCREMENT` attribute to the corresponding column during table creation ([CREATE-TABLE](../../sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE)). To manually specify the starting value for an auto-increment column, you can do so by using the `AUTO_INCREMENT(start_value)` statement when creating the table. If not specified, the default starting value is 1.
### Examples
@@ -65,7 +65,21 @@ To use auto-increment columns, you need to add the `AUTO_INCREMENT` attribute to
"replication_allocation" = "tag.location.default: 3"
);
-2. Creating a Duplicate table with one value column as an auto-increment column:
+2. Creating a Duplicate table with one key column as an auto-increment column, and set start value is 100:
+
+ ```sql
+ CREATE TABLE `demo`.`tbl` (
+ `id` BIGINT NOT NULL AUTO_INCREMENT(100),
+ `value` BIGINT NOT NULL
+ ) ENGINE=OLAP
+ DUPLICATE KEY(`id`)
+ DISTRIBUTED BY HASH(`id`) BUCKETS 10
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 3"
+ );
+ ```
+
+3. Creating a Duplicate table with one value column as an auto-increment column:
```sql
CREATE TABLE `demo`.`tbl` (
@@ -81,7 +95,7 @@ To use auto-increment columns, you need to add the `AUTO_INCREMENT` attribute to
);
```
-3. Creating a Unique tbl table with one key column as an auto-increment column:
+4. Creating a Unique tbl table with one key column as an auto-increment column:
```sql
CREATE TABLE `demo`.`tbl` (
@@ -97,7 +111,7 @@ To use auto-increment columns, you need to add the `AUTO_INCREMENT` attribute to
);
```
-4. Creating a Unique tbl table with one value column as an auto-increment column:
+5. Creating a Unique tbl table with one value column as an auto-increment column:
```sql
CREATE TABLE `demo`.`tbl` (
@@ -117,6 +131,7 @@ To use auto-increment columns, you need to add the `AUTO_INCREMENT` attribute to
- Only Duplicate model tables and Unique model tables can contain auto-increment columns.
- A table can contain at most one auto-increment column.
- The type of the auto-increment column must be BIGINT and must be NOT NULL.
+- The manually specified starting value for an auto-increment column must be greater than or equal to 0.
## Usage
@@ -149,9 +164,9 @@ mysql> select * from tbl order by id;
+------+-------+-------+
| id | name | value |
+------+-------+-------+
-| 0 | Bob | 10 |
-| 1 | Alice | 20 |
-| 2 | Jack | 30 |
+| 1 | Bob | 10 |
+| 2 | Alice | 20 |
+| 3 | Jack | 30 |
+------+-------+-------+
3 rows in set (0.05 sec)
```
@@ -173,11 +188,11 @@ mysql> select * from tbl order by id;
+------+-------+-------+
| id | name | value |
+------+-------+-------+
-| 0 | Bob | 10 |
-| 1 | Alice | 20 |
-| 2 | Jack | 30 |
-| 3 | Tom | 40 |
-| 4 | John | 50 |
+| 1 | Bob | 10 |
+| 2 | Alice | 20 |
+| 3 | Jack | 30 |
+| 4 | Tom | 40 |
+| 5 | John | 50 |
+------+-------+-------+
5 rows in set (0.04 sec)
```
@@ -193,13 +208,13 @@ mysql> select * from tbl order by id;
+------+---------+-------+
| id | name | value |
+------+---------+-------+
-| 0 | Bob | 10 |
-| 1 | Alice | 20 |
-| 2 | Jack | 30 |
-| 3 | Tom | 40 |
-| 4 | John | 50 |
-| 5 | Doris | 60 |
-| 6 | Nereids | 70 |
+| 1 | Bob | 10 |
+| 2 | Alice | 20 |
+| 3 | Jack | 30 |
+| 4 | Tom | 40 |
+| 5 | John | 50 |
+| 6 | Doris | 60 |
+| 7 | Nereids | 70 |
+------+---------+-------+
7 rows in set (0.04 sec)
```
diff --git a/docs/en/docs/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE.md b/docs/en/docs/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE.md
index d2d68aa292d..cfa612bca4d 100644
--- a/docs/en/docs/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE.md
+++ b/docs/en/docs/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE.md
@@ -58,7 +58,7 @@ Column definition list:
Column definition:
- `column_name column_type [KEY] [aggr_type] [NULL] [AUTO_INCREMENT] [default_value] [on update current_timestamp] [column_comment]`
+ `column_name column_type [KEY] [aggr_type] [NULL] [AUTO_INCREMENT(auto_inc_start_value)] [default_value] [on update current_timestamp] [column_comment]`
* `column_type`
@@ -115,11 +115,12 @@ Column definition list:
BITMAP_UNION: The aggregation mode of BIMTAP type columns, which performs the union aggregation of bitmaps.
```
- * `AUTO_INCREMENT`(only avaliable in master branch)
+ * `AUTO_INCREMENT(auto_inc_start_value)`(Available from version 2.1 and later.)
To indicate if the column is a auto-increment column. Auto-increment column can be used to generate a unique identity for new row. If no values are assgined for auto-increment column when inserting, Doris will generate sequence numbers automatically. You can also assign the auto-increment column with NULL literal to indicate Doris to generate sequence numbers. It should be noted that, for performance reasons, BE will cache some values of auto-increment column in memory. Therefore [...]
A table can have at most one auto-incremnt column. The auto-increment column should be BIGINT type and be NOT NULL.
- Both Duplicate model table and Unique model table support auto-increment column
+ Both Duplicate model table and Unique model table support auto-increment column.
+ You can specify the starting value for an auto-increment column by providing `auto_inc_start_value. If not specified, the default starting value is 1.
* `default_value`
diff --git a/docs/zh-CN/docs/advanced/auto-increment.md b/docs/zh-CN/docs/advanced/auto-increment.md
index 140546299f8..5a5129348ea 100644
--- a/docs/zh-CN/docs/advanced/auto-increment.md
+++ b/docs/zh-CN/docs/advanced/auto-increment.md
@@ -49,7 +49,7 @@ Doris保证自增列上自动生成的值是稠密的,但**不能保证**在
## 语法
-要使用自增列,需要在建表[CREATE-TABLE](../../sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE)时为对应的列添加`AUTO_INCREMENT`属性。
+要使用自增列,需要在建表[CREATE-TABLE](../../sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE)时为对应的列添加`AUTO_INCREMENT`属性。 若要手动指定自增列起始值,可以通过建表时`AUTO_INCREMENT(start_value)`语句指定,如果未指定,则默认起始值为1。
### 示例
@@ -67,7 +67,21 @@ Doris保证自增列上自动生成的值是稠密的,但**不能保证**在
);
```
-2. 创建一个Dupliciate模型表,其中一个value列是自增列
+2. 创建一个Dupliciate模型表,其中一个key列是自增列,并设置起始值为100
+
+ ```sql
+ CREATE TABLE `demo`.`tbl` (
+ `id` BIGINT NOT NULL AUTO_INCREMENT(100),
+ `value` BIGINT NOT NULL
+ ) ENGINE=OLAP
+ DUPLICATE KEY(`id`)
+ DISTRIBUTED BY HASH(`id`) BUCKETS 10
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 3"
+ );
+ ```
+
+3. 创建一个Dupliciate模型表,其中一个value列是自增列
```sql
CREATE TABLE `demo`.`tbl` (
@@ -83,7 +97,7 @@ Doris保证自增列上自动生成的值是稠密的,但**不能保证**在
);
```
-3. 创建一个Unique模型表,其中一个key列是自增列
+4. 创建一个Unique模型表,其中一个key列是自增列
```sql
CREATE TABLE `demo`.`tbl` (
@@ -99,7 +113,7 @@ Doris保证自增列上自动生成的值是稠密的,但**不能保证**在
);
```
-4. 创建一个Unique模型表,其中一个value列是自增列
+5. 创建一个Unique模型表,其中一个value列是自增列
```sql
CREATE TABLE `demo`.`tbl` (
@@ -119,6 +133,7 @@ Doris保证自增列上自动生成的值是稠密的,但**不能保证**在
1. 仅Duplicate模型表和Unique模型表可以包含自增列。
2. 一张表最多只能包含一个自增列。
3. 自增列的类型必须是BIGINT类型,且必须为NOT NULL。
+4. 自增列手动指定的起始值必须大于等于0。
## 使用方式
@@ -150,9 +165,9 @@ mysql> select * from tbl order by id;
+------+-------+-------+
| id | name | value |
+------+-------+-------+
-| 0 | Bob | 10 |
-| 1 | Alice | 20 |
-| 2 | Jack | 30 |
+| 1 | Bob | 10 |
+| 2 | Alice | 20 |
+| 3 | Jack | 30 |
+------+-------+-------+
3 rows in set (0.05 sec)
```
@@ -174,11 +189,11 @@ mysql> select * from tbl order by id;
+------+-------+-------+
| id | name | value |
+------+-------+-------+
-| 0 | Bob | 10 |
-| 1 | Alice | 20 |
-| 2 | Jack | 30 |
-| 3 | Tom | 40 |
-| 4 | John | 50 |
+| 1 | Bob | 10 |
+| 2 | Alice | 20 |
+| 3 | Jack | 30 |
+| 4 | Tom | 40 |
+| 5 | John | 50 |
+------+-------+-------+
5 rows in set (0.04 sec)
```
@@ -194,13 +209,13 @@ mysql> select * from tbl order by id;
+------+---------+-------+
| id | name | value |
+------+---------+-------+
-| 0 | Bob | 10 |
-| 1 | Alice | 20 |
-| 2 | Jack | 30 |
-| 3 | Tom | 40 |
-| 4 | John | 50 |
-| 5 | Doris | 60 |
-| 6 | Nereids | 70 |
+| 1 | Bob | 10 |
+| 2 | Alice | 20 |
+| 3 | Jack | 30 |
+| 4 | Tom | 40 |
+| 5 | John | 50 |
+| 6 | Doris | 60 |
+| 7 | Nereids | 70 |
+------+---------+-------+
7 rows in set (0.04 sec)
```
diff --git a/docs/zh-CN/docs/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE.md b/docs/zh-CN/docs/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE.md
index 9eba3f809af..e288dea49a5 100644
--- a/docs/zh-CN/docs/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE.md
+++ b/docs/zh-CN/docs/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE.md
@@ -56,7 +56,7 @@ distribution_desc
* `column_definition`
列定义:
- `column_name column_type [KEY] [aggr_type] [NULL] [AUTO_INCREMENT] [default_value] [on update current_timestamp] [column_comment]`
+ `column_name column_type [KEY] [aggr_type] [NULL] [AUTO_INCREMENT(auto_inc_start_value)] [default_value] [on update current_timestamp] [column_comment]`
* `column_type`
列类型,支持以下类型:
```
@@ -106,11 +106,12 @@ distribution_desc
HLL_UNION:HLL 类型的列的聚合方式,通过 HyperLogLog 算法聚合。
BITMAP_UNION:BIMTAP 类型的列的聚合方式,进行位图的并集聚合。
```
- * `AUTO_INCREMENT`(仅在master分支可用)
+ * `AUTO_INCREMENT(auto_inc_start_value)`(2.1版本及以后可用)
是否为自增列,自增列可以用来为新插入的行生成一个唯一标识。在插入表数据时如果没有指定自增列的值,则会自动生成一个合法的值。当自增列被显示地插入NULL时,其值也会被替换为生成的合法值。需要注意的是,处于性能考虑,BE会在内存中缓存部分自增列的值,所以自增列自动生成的值只能保证单调性和唯一性,无法保证严格的连续性。
一张表中至多有一个列是自增列,自增列必须是BIGINT类型,且必须为NOT NULL。
Duplicate模型表和Unique模型表均支持自增列。
+ 可以通过给定`auto_inc_start_value`的方式指定自增列的起始值,如果不指定,则默认起始值为1。
* `default_value`
列默认值,当导入数据未指定该列的值时,系统将赋予该列default_value。
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 04/24: [chore](ci) try to set 'performance (Doris Performance)' to required (#30752)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit fd000dbdb3c854c31beb249a90bec56b233c75f5
Author: Dongyang Li <he...@qq.com>
AuthorDate: Fri Feb 2 15:50:16 2024 +0800
[chore](ci) try to set 'performance (Doris Performance)' to required (#30752)
---
.asf.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.asf.yaml b/.asf.yaml
index cc730103843..b92d8548b04 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -55,6 +55,7 @@ github:
- P0 Regression PipelineX (Doris Regression)
- P1 Regression (Doris Regression)
- External Regression (Doris External Regression)
+ - performance (Doris Performance)
- FE UT (Doris FE UT)
- BE UT (Doris BE UT)
- Build Broker
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 24/24: [Fix](Nereids) Fix rewrite by materialized view fail when join input has agg (#30734)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 5aed3abb8a89ee95c0c3e08634b6bc16c084ce98
Author: seawinde <14...@users.noreply.github.com>
AuthorDate: Sat Feb 3 20:19:53 2024 +0800
[Fix](Nereids) Fix rewrite by materialized view fail when join input has agg (#30734)
materialized view definition is as following, and the query sql is the same
when outer group by use the col1 in the inner group, which can be rewritten by materialized view
select
t1.o_orderdate,
t1.o_orderkey,
t1.col1
from
(
select
o_orderkey,
o_custkey,
o_orderstatus,
o_orderdate,
sum(o_shippriority) as col1
from
orders
group by
o_orderkey,
o_custkey,
o_orderstatus,
o_orderdate
) as t1
left join lineitem on lineitem.l_orderkey = t1.o_orderkey
group by
t1.o_orderdate,
t1.o_orderkey,
t1.col1
---
.../mv/AbstractMaterializedViewAggregateRule.java | 28 +------
.../mv/AbstractMaterializedViewJoinRule.java | 25 +-----
.../nereids/rules/exploration/mv/StructInfo.java | 89 +++++++++++-----------
.../mv/join/dphyp_outer/outer_join_dphyp.out | 14 ++++
.../mv/join/left_outer/outer_join.out | 14 ++++
.../mv/join/dphyp_outer/outer_join_dphyp.groovy | 60 +++++++++++++++
.../mv/join/left_outer/outer_join.groovy | 85 ++++++++++++++++++---
7 files changed, 212 insertions(+), 103 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/AbstractMaterializedViewAggregateRule.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/AbstractMaterializedViewAggregateRule.java
index b56cfd4ea2b..514469ac76e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/AbstractMaterializedViewAggregateRule.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/AbstractMaterializedViewAggregateRule.java
@@ -18,10 +18,6 @@
package org.apache.doris.nereids.rules.exploration.mv;
import org.apache.doris.common.Pair;
-import org.apache.doris.nereids.jobs.joinorder.hypergraph.HyperGraph;
-import org.apache.doris.nereids.jobs.joinorder.hypergraph.edge.JoinEdge;
-import org.apache.doris.nereids.jobs.joinorder.hypergraph.node.AbstractNode;
-import org.apache.doris.nereids.jobs.joinorder.hypergraph.node.StructInfoNode;
import org.apache.doris.nereids.rules.exploration.mv.StructInfo.PlanSplitContext;
import org.apache.doris.nereids.rules.exploration.mv.mapping.SlotMapping;
import org.apache.doris.nereids.trees.expressions.Alias;
@@ -368,29 +364,11 @@ public abstract class AbstractMaterializedViewAggregateRule extends AbstractMate
}
// Check Aggregate is simple or not and check join is whether valid or not.
- // Support join's input can not contain aggregate Only support project, filter, join, logical relation node and
- // join condition should be slot reference equals currently
+ // Support project, filter, join, logical relation node and join condition should only contain
+ // slot reference equals currently.
@Override
protected boolean checkPattern(StructInfo structInfo) {
-
- Plan topPlan = structInfo.getTopPlan();
- Boolean valid = topPlan.accept(StructInfo.AGGREGATE_PATTERN_CHECKER, null);
- if (!valid) {
- return false;
- }
- HyperGraph hyperGraph = structInfo.getHyperGraph();
- for (AbstractNode node : hyperGraph.getNodes()) {
- StructInfoNode structInfoNode = (StructInfoNode) node;
- if (!structInfoNode.getPlan().accept(StructInfo.JOIN_PATTERN_CHECKER, SUPPORTED_JOIN_TYPE_SET)) {
- return false;
- }
- }
- for (JoinEdge edge : hyperGraph.getJoinEdges()) {
- if (!edge.getJoin().accept(StructInfo.JOIN_PATTERN_CHECKER, SUPPORTED_JOIN_TYPE_SET)) {
- return false;
- }
- }
- return true;
+ return structInfo.getTopPlan().accept(StructInfo.PLAN_PATTERN_CHECKER, SUPPORTED_JOIN_TYPE_SET);
}
/**
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/AbstractMaterializedViewJoinRule.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/AbstractMaterializedViewJoinRule.java
index c8a64a740f2..03549297bf8 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/AbstractMaterializedViewJoinRule.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/AbstractMaterializedViewJoinRule.java
@@ -18,10 +18,6 @@
package org.apache.doris.nereids.rules.exploration.mv;
import org.apache.doris.common.Pair;
-import org.apache.doris.nereids.jobs.joinorder.hypergraph.HyperGraph;
-import org.apache.doris.nereids.jobs.joinorder.hypergraph.edge.JoinEdge;
-import org.apache.doris.nereids.jobs.joinorder.hypergraph.node.AbstractNode;
-import org.apache.doris.nereids.jobs.joinorder.hypergraph.node.StructInfoNode;
import org.apache.doris.nereids.rules.exploration.mv.mapping.SlotMapping;
import org.apache.doris.nereids.trees.expressions.Alias;
import org.apache.doris.nereids.trees.expressions.Expression;
@@ -79,26 +75,11 @@ public abstract class AbstractMaterializedViewJoinRule extends AbstractMateriali
}
/**
- * Check join is whether valid or not. Support join's input can not contain aggregate
- * Only support project, filter, join, logical relation node and
- * join condition should be slot reference equals currently
+ * Check join is whether valid or not. Support join's input only support project, filter, join,
+ * logical relation node and join condition should be slot reference equals currently
*/
@Override
protected boolean checkPattern(StructInfo structInfo) {
- HyperGraph hyperGraph = structInfo.getHyperGraph();
- for (AbstractNode node : hyperGraph.getNodes()) {
- StructInfoNode structInfoNode = (StructInfoNode) node;
- if (!structInfoNode.getPlan().accept(StructInfo.JOIN_PATTERN_CHECKER,
- SUPPORTED_JOIN_TYPE_SET)) {
- return false;
- }
- }
- for (JoinEdge edge : hyperGraph.getJoinEdges()) {
- if (!edge.getJoin().accept(StructInfo.JOIN_PATTERN_CHECKER,
- SUPPORTED_JOIN_TYPE_SET)) {
- return false;
- }
- }
- return true;
+ return structInfo.getTopPlan().accept(StructInfo.PLAN_PATTERN_CHECKER, SUPPORTED_JOIN_TYPE_SET);
}
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/StructInfo.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/StructInfo.java
index 618aaa8684f..6a5c82691e7 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/StructInfo.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/StructInfo.java
@@ -29,6 +29,7 @@ import org.apache.doris.nereids.trees.expressions.ExprId;
import org.apache.doris.nereids.trees.expressions.Expression;
import org.apache.doris.nereids.trees.expressions.SlotReference;
import org.apache.doris.nereids.trees.expressions.literal.Literal;
+import org.apache.doris.nereids.trees.plans.GroupPlan;
import org.apache.doris.nereids.trees.plans.JoinType;
import org.apache.doris.nereids.trees.plans.ObjectId;
import org.apache.doris.nereids.trees.plans.Plan;
@@ -37,12 +38,11 @@ import org.apache.doris.nereids.trees.plans.algebra.CatalogRelation;
import org.apache.doris.nereids.trees.plans.algebra.Filter;
import org.apache.doris.nereids.trees.plans.algebra.Join;
import org.apache.doris.nereids.trees.plans.algebra.Project;
-import org.apache.doris.nereids.trees.plans.algebra.Sort;
import org.apache.doris.nereids.trees.plans.logical.LogicalAggregate;
import org.apache.doris.nereids.trees.plans.logical.LogicalFilter;
import org.apache.doris.nereids.trees.plans.logical.LogicalJoin;
import org.apache.doris.nereids.trees.plans.logical.LogicalProject;
-import org.apache.doris.nereids.trees.plans.logical.LogicalRepeat;
+import org.apache.doris.nereids.trees.plans.logical.LogicalSort;
import org.apache.doris.nereids.trees.plans.visitor.DefaultPlanVisitor;
import org.apache.doris.nereids.trees.plans.visitor.ExpressionLineageReplacer;
import org.apache.doris.nereids.util.ExpressionUtils;
@@ -57,7 +57,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
@@ -68,8 +67,7 @@ import javax.annotation.Nullable;
* modify, if wanting to modify, should copy and then modify
*/
public class StructInfo {
- public static final JoinPatternChecker JOIN_PATTERN_CHECKER = new JoinPatternChecker();
- public static final AggregatePatternChecker AGGREGATE_PATTERN_CHECKER = new AggregatePatternChecker();
+ public static final PlanPatternChecker PLAN_PATTERN_CHECKER = new PlanPatternChecker();
// struct info splitter
public static final PlanSplitter PLAN_SPLITTER = new PlanSplitter();
private static final RelationCollector RELATION_COLLECTOR = new RelationCollector();
@@ -189,7 +187,7 @@ public class StructInfo {
Lists.newArrayList(expression),
ImmutableSet.of(),
ImmutableSet.of());
- topPlan.accept(ExpressionLineageReplacer.INSTANCE, replaceContext);
+ structInfoNode.getPlan().accept(ExpressionLineageReplacer.INSTANCE, replaceContext);
// Replace expressions by expression map
List<Expression> replacedExpressions = replaceContext.getReplacedExpressions();
shuttledHashConjunctsToConjunctsMap.put(replacedExpressions.get(0), expression);
@@ -448,55 +446,58 @@ public class StructInfo {
}
/**
- * JoinPatternChecker
+ * PlanPatternChecker, this is used to check the plan pattern is valid or not
*/
- public static class JoinPatternChecker extends DefaultPlanVisitor<Boolean, Set<JoinType>> {
+ public static class PlanPatternChecker extends DefaultPlanVisitor<Boolean, Set<JoinType>> {
@Override
- public Boolean visit(Plan plan, Set<JoinType> requiredJoinType) {
- super.visit(plan, requiredJoinType);
- if (!(plan instanceof Filter)
- && !(plan instanceof Project)
- && !(plan instanceof CatalogRelation)
- && !(plan instanceof Join)
- && !(plan instanceof Sort)
- && !(plan instanceof LogicalAggregate && !((LogicalAggregate) plan).getSourceRepeat()
- .isPresent())) {
+ public Boolean visitLogicalJoin(LogicalJoin<? extends Plan, ? extends Plan> join,
+ Set<JoinType> supportJoinTypes) {
+ if (!supportJoinTypes.contains(join.getJoinType())) {
return false;
}
- if (plan instanceof Join) {
- Join join = (Join) plan;
- if (!requiredJoinType.contains(join.getJoinType())) {
- return false;
- }
- if (!join.getOtherJoinConjuncts().isEmpty()) {
- return false;
- }
+ if (!join.getOtherJoinConjuncts().isEmpty()) {
+ return false;
}
- return true;
+ return visit(join, supportJoinTypes);
}
- }
- /**
- * AggregatePatternChecker
- */
- public static class AggregatePatternChecker extends DefaultPlanVisitor<Boolean, Void> {
@Override
- public Boolean visit(Plan plan, Void context) {
- if (plan instanceof LogicalAggregate) {
- LogicalAggregate<Plan> aggregate = (LogicalAggregate<Plan>) plan;
- Optional<LogicalRepeat<?>> sourceRepeat = aggregate.getSourceRepeat();
- if (sourceRepeat.isPresent()) {
- return false;
- }
- super.visit(aggregate, context);
- return true;
+ public Boolean visitLogicalAggregate(LogicalAggregate<? extends Plan> aggregate,
+ Set<JoinType> supportJoinTypes) {
+ if (aggregate.getSourceRepeat().isPresent()) {
+ return false;
}
- if (plan instanceof Project || plan instanceof Filter || plan instanceof Sort) {
- super.visit(plan, context);
- return true;
+ return visit(aggregate, supportJoinTypes);
+ }
+
+ @Override
+ public Boolean visitGroupPlan(GroupPlan groupPlan, Set<JoinType> supportJoinTypes) {
+ return groupPlan.getGroup().getLogicalExpressions().stream()
+ .anyMatch(logicalExpression -> logicalExpression.getPlan().accept(this, supportJoinTypes));
+ }
+
+ @Override
+ public Boolean visit(Plan plan, Set<JoinType> supportJoinTypes) {
+ if (plan instanceof Filter
+ || plan instanceof Project
+ || plan instanceof CatalogRelation
+ || plan instanceof Join
+ || plan instanceof LogicalSort
+ || plan instanceof LogicalAggregate
+ || plan instanceof GroupPlan) {
+ return doVisit(plan, supportJoinTypes);
}
- super.visit(plan, context);
return false;
}
+
+ private Boolean doVisit(Plan plan, Set<JoinType> supportJoinTypes) {
+ for (Plan child : plan.children()) {
+ boolean valid = child.accept(this, supportJoinTypes);
+ if (!valid) {
+ return false;
+ }
+ }
+ return true;
+ }
}
}
diff --git a/regression-test/data/nereids_rules_p0/mv/join/dphyp_outer/outer_join_dphyp.out b/regression-test/data/nereids_rules_p0/mv/join/dphyp_outer/outer_join_dphyp.out
index 845ef3933dc..a1020a1e1e8 100644
--- a/regression-test/data/nereids_rules_p0/mv/join/dphyp_outer/outer_join_dphyp.out
+++ b/regression-test/data/nereids_rules_p0/mv/join/dphyp_outer/outer_join_dphyp.out
@@ -295,3 +295,17 @@
4 0 0 0 43.2000 43.20 43.20
5 0 0 0 28.7000 56.20 1.20
+-- !query9_0_before --
+2023-12-08 1 2
+2023-12-09 2 1
+2023-12-10 3 2
+2023-12-11 4 2
+2023-12-12 5 4
+
+-- !query9_0_after --
+2023-12-08 1 2
+2023-12-09 2 1
+2023-12-10 3 2
+2023-12-11 4 2
+2023-12-12 5 4
+
diff --git a/regression-test/data/nereids_rules_p0/mv/join/left_outer/outer_join.out b/regression-test/data/nereids_rules_p0/mv/join/left_outer/outer_join.out
index 0b171742bca..225e336b91f 100644
--- a/regression-test/data/nereids_rules_p0/mv/join/left_outer/outer_join.out
+++ b/regression-test/data/nereids_rules_p0/mv/join/left_outer/outer_join.out
@@ -311,3 +311,17 @@
4 0 0 0 43.2000 43.20 43.20
5 0 0 0 28.7000 56.20 1.20
+-- !query9_0_before --
+2023-12-08 1 2
+2023-12-09 2 1
+2023-12-10 3 2
+2023-12-11 4 2
+2023-12-12 5 4
+
+-- !query9_0_after --
+2023-12-08 1 2
+2023-12-09 2 1
+2023-12-10 3 2
+2023-12-11 4 2
+2023-12-12 5 4
+
diff --git a/regression-test/suites/nereids_rules_p0/mv/join/dphyp_outer/outer_join_dphyp.groovy b/regression-test/suites/nereids_rules_p0/mv/join/dphyp_outer/outer_join_dphyp.groovy
index 3d858c57ddc..dc9e78e00c6 100644
--- a/regression-test/suites/nereids_rules_p0/mv/join/dphyp_outer/outer_join_dphyp.groovy
+++ b/regression-test/suites/nereids_rules_p0/mv/join/dphyp_outer/outer_join_dphyp.groovy
@@ -466,4 +466,64 @@ suite("outer_join_dphyp") {
check_rewrite(mv8_0, query8_0, "mv8_0")
order_qt_query8_0_after "${query8_0}"
sql """ DROP MATERIALIZED VIEW IF EXISTS mv8_0"""
+
+ // join input with simple agg, use aggregate function as outer group by
+ def mv9_0 = """
+ select
+ t1.o_orderdate,
+ t1.o_orderkey,
+ t1.col1
+ from
+ (
+ select
+ o_orderkey,
+ o_custkey,
+ o_orderstatus,
+ o_orderdate,
+ sum(o_shippriority) as col1
+ from
+ orders
+ group by
+ o_orderkey,
+ o_custkey,
+ o_orderstatus,
+ o_orderdate
+ ) as t1
+ left join lineitem on lineitem.l_orderkey = t1.o_orderkey
+ group by
+ t1.o_orderdate,
+ t1.o_orderkey,
+ t1.col1
+ """
+ def query9_0 = """
+ select
+ t1.o_orderdate,
+ t1.o_orderkey,
+ t1.col1
+ from
+ (
+ select
+ o_orderkey,
+ o_custkey,
+ o_orderstatus,
+ o_orderdate,
+ sum(o_shippriority) as col1
+ from
+ orders
+ group by
+ o_orderkey,
+ o_custkey,
+ o_orderstatus,
+ o_orderdate
+ ) as t1
+ left join lineitem on lineitem.l_orderkey = t1.o_orderkey
+ group by
+ t1.o_orderdate,
+ t1.o_orderkey,
+ t1.col1
+ """
+ order_qt_query9_0_before "${query9_0}"
+ check_rewrite(mv9_0, query9_0, "mv9_0")
+ order_qt_query9_0_after "${query9_0}"
+ sql """ DROP MATERIALIZED VIEW IF EXISTS mv9_0"""
}
diff --git a/regression-test/suites/nereids_rules_p0/mv/join/left_outer/outer_join.groovy b/regression-test/suites/nereids_rules_p0/mv/join/left_outer/outer_join.groovy
index eadb0df1553..6a5bda9d22b 100644
--- a/regression-test/suites/nereids_rules_p0/mv/join/left_outer/outer_join.groovy
+++ b/regression-test/suites/nereids_rules_p0/mv/join/left_outer/outer_join.groovy
@@ -476,14 +476,14 @@ suite("outer_join") {
def mv6_1 = """
select l_shipdate, t.o_orderdate, l_partkey, l_suppkey, t.o_orderkey
from lineitem_null
- left join (select o_orderdate,o_orderkey from orders_null where o_orderdate = '2023-12-10' ) t
+ left join (select o_orderdate,o_orderkey from orders_null where o_orderdate = '2023-12-10' ) t
on l_orderkey = t.o_orderkey;
"""
def query6_1 = """
- select l_shipdate, o_orderdate, l_partkey, l_suppkey, o_orderkey
- from lineitem_null
- left join orders_null
- on l_orderkey = o_orderkey
+ select l_shipdate, o_orderdate, l_partkey, l_suppkey, o_orderkey
+ from lineitem_null
+ left join orders_null
+ on l_orderkey = o_orderkey
where l_shipdate = '2023-12-10' and o_orderdate = '2023-12-10';
"""
order_qt_query6_1_before "${query6_1}"
@@ -494,16 +494,16 @@ suite("outer_join") {
// should compensate predicate o_orderdate = '2023-12-10' on mv
def mv6_2 = """
- select l_shipdate, o_orderdate, l_partkey, l_suppkey, o_orderkey
- from lineitem
- left join (select * from orders where o_orderdate = '2023-12-10' ) t2
+ select l_shipdate, o_orderdate, l_partkey, l_suppkey, o_orderkey
+ from lineitem
+ left join (select * from orders where o_orderdate = '2023-12-10' ) t2
on lineitem.l_orderkey = t2.o_orderkey;
"""
def query6_2 = """
- select l_shipdate, o_orderdate, l_partkey, l_suppkey, o_orderkey
- from lineitem
- left join orders
- on lineitem.l_orderkey = orders.o_orderkey
+ select l_shipdate, o_orderdate, l_partkey, l_suppkey, o_orderkey
+ from lineitem
+ left join orders
+ on lineitem.l_orderkey = orders.o_orderkey
where o_orderdate = '2023-12-10' order by 1, 2, 3, 4, 5;
"""
order_qt_query6_2_before "${query6_2}"
@@ -586,4 +586,65 @@ suite("outer_join") {
check_rewrite(mv8_0, query8_0, "mv8_0")
order_qt_query8_0_after "${query8_0}"
sql """ DROP MATERIALIZED VIEW IF EXISTS mv8_0"""
+
+
+ // join input with simple agg, use aggregate function as outer group by
+ def mv9_0 = """
+ select
+ t1.o_orderdate,
+ t1.o_orderkey,
+ t1.col1
+ from
+ (
+ select
+ o_orderkey,
+ o_custkey,
+ o_orderstatus,
+ o_orderdate,
+ sum(o_shippriority) as col1
+ from
+ orders
+ group by
+ o_orderkey,
+ o_custkey,
+ o_orderstatus,
+ o_orderdate
+ ) as t1
+ left join lineitem on lineitem.l_orderkey = t1.o_orderkey
+ group by
+ t1.o_orderdate,
+ t1.o_orderkey,
+ t1.col1
+ """
+ def query9_0 = """
+ select
+ t1.o_orderdate,
+ t1.o_orderkey,
+ t1.col1
+ from
+ (
+ select
+ o_orderkey,
+ o_custkey,
+ o_orderstatus,
+ o_orderdate,
+ sum(o_shippriority) as col1
+ from
+ orders
+ group by
+ o_orderkey,
+ o_custkey,
+ o_orderstatus,
+ o_orderdate
+ ) as t1
+ left join lineitem on lineitem.l_orderkey = t1.o_orderkey
+ group by
+ t1.o_orderdate,
+ t1.o_orderkey,
+ t1.col1
+ """
+ order_qt_query9_0_before "${query9_0}"
+ check_rewrite(mv9_0, query9_0, "mv9_0")
+ order_qt_query9_0_after "${query9_0}"
+ sql """ DROP MATERIALIZED VIEW IF EXISTS mv9_0"""
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 12/24: [improvement](jdbc catalog) Optimize connection pool parameter settings (#30588)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 4f8730d092e09372af766e23688356dfd75d5c26
Author: zy-kkk <zh...@gmail.com>
AuthorDate: Fri Feb 2 21:39:37 2024 +0800
[improvement](jdbc catalog) Optimize connection pool parameter settings (#30588)
This PR makes the following changes to the connection pool of JDBC Catalog
1. Set the maximum connection survival time, the default is 30 minutes
- Moreover, one-half of the maximum survival time is the recyclable time,
- One-tenth is the check interval for recycling connections
2. Keepalive only takes effect on the connection pool on BE, and will be activated based on one-fifth of the maximum survival time.
3. The maximum number of existing connections is changed from 100 to 10
4. Add the connection cache recycling thread on BE, and add a parameter to control the recycling time, the default is 28800 (8 hours)
5. Add CatalogID to the key of the connection pool cache to achieve better isolation, requires refresh catalog to take effect
6. Upgrade druid connection pool to version 1.2.20
7. Added JdbcResource's setting of default parameters when upgrading the FE version to avoid errors due to unset parameters.
---
be/src/common/config.cpp | 3 +
be/src/common/config.h | 3 +
be/src/runtime/descriptors.cpp | 33 ++---
be/src/runtime/descriptors.h | 22 ++--
be/src/vec/exec/scan/new_jdbc_scanner.cpp | 11 +-
be/src/vec/exec/vjdbc_connector.cpp | 13 +-
be/src/vec/exec/vjdbc_connector.h | 11 +-
be/src/vec/sink/writer/vjdbc_table_writer.cpp | 11 +-
.../java/org/apache/doris/jdbc/JdbcDataSource.java | 50 +++++++
.../apache/doris/jdbc/JdbcDataSourceConfig.java | 75 +++++------
.../java/org/apache/doris/jdbc/JdbcExecutor.java | 95 ++++++++------
.../org/apache/doris/catalog/JdbcResource.java | 115 ++++++++++++----
.../java/org/apache/doris/catalog/JdbcTable.java | 63 ++++++---
.../java/org/apache/doris/catalog/Resource.java | 2 +
.../java/org/apache/doris/catalog/ResourceMgr.java | 1 +
.../doris/catalog/external/JdbcExternalTable.java | 11 +-
.../doris/datasource/jdbc/JdbcExternalCatalog.java | 71 +++++-----
.../doris/datasource/jdbc/client/JdbcClient.java | 25 ++--
.../datasource/jdbc/client/JdbcClientConfig.java | 93 +++++++------
.../org/apache/doris/catalog/JdbcResourceTest.java | 146 ++++++++++++++++++++-
.../datasource/jdbc/JdbcExternalCatalogTest.java | 45 +++++--
fe/pom.xml | 2 +-
gensrc/thrift/Descriptors.thrift | 11 +-
gensrc/thrift/Types.thrift | 12 +-
24 files changed, 640 insertions(+), 284 deletions(-)
diff --git a/be/src/common/config.cpp b/be/src/common/config.cpp
index 293608755fe..0be957f2379 100644
--- a/be/src/common/config.cpp
+++ b/be/src/common/config.cpp
@@ -804,6 +804,9 @@ DEFINE_mInt32(segment_compression_threshold_kb, "256");
// The connection timeout when connecting to external table such as odbc table.
DEFINE_mInt32(external_table_connect_timeout_sec, "30");
+// Time to clean up useless JDBC connection pool cache
+DEFINE_mInt32(jdbc_connection_pool_cache_clear_time_sec, "28800");
+
// Global bitmap cache capacity for aggregation cache, size in bytes
DEFINE_Int64(delete_bitmap_agg_cache_capacity, "104857600");
DEFINE_mInt32(delete_bitmap_agg_cache_stale_sweep_time_sec, "1800");
diff --git a/be/src/common/config.h b/be/src/common/config.h
index 67e4b621980..eaebffbd1eb 100644
--- a/be/src/common/config.h
+++ b/be/src/common/config.h
@@ -858,6 +858,9 @@ DECLARE_mInt32(segment_compression_threshold_kb);
// The connection timeout when connecting to external table such as odbc table.
DECLARE_mInt32(external_table_connect_timeout_sec);
+// Time to clean up useless JDBC connection pool cache
+DECLARE_mInt32(jdbc_connection_pool_cache_clear_time_sec);
+
// Global bitmap cache capacity for aggregation cache, size in bytes
DECLARE_Int64(delete_bitmap_agg_cache_capacity);
DECLARE_mInt32(delete_bitmap_agg_cache_stale_sweep_time_sec);
diff --git a/be/src/runtime/descriptors.cpp b/be/src/runtime/descriptors.cpp
index 1f70c8e281b..0f6f4319189 100644
--- a/be/src/runtime/descriptors.cpp
+++ b/be/src/runtime/descriptors.cpp
@@ -258,6 +258,7 @@ std::string ODBCTableDescriptor::debug_string() const {
JdbcTableDescriptor::JdbcTableDescriptor(const TTableDescriptor& tdesc)
: TableDescriptor(tdesc),
+ _jdbc_catalog_id(tdesc.jdbcTable.catalog_id),
_jdbc_resource_name(tdesc.jdbcTable.jdbc_resource_name),
_jdbc_driver_url(tdesc.jdbcTable.jdbc_driver_url),
_jdbc_driver_class(tdesc.jdbcTable.jdbc_driver_class),
@@ -266,24 +267,26 @@ JdbcTableDescriptor::JdbcTableDescriptor(const TTableDescriptor& tdesc)
_jdbc_table_name(tdesc.jdbcTable.jdbc_table_name),
_jdbc_user(tdesc.jdbcTable.jdbc_user),
_jdbc_passwd(tdesc.jdbcTable.jdbc_password),
- _jdbc_min_pool_size(tdesc.jdbcTable.jdbc_min_pool_size),
- _jdbc_max_pool_size(tdesc.jdbcTable.jdbc_max_pool_size),
- _jdbc_max_idle_time(tdesc.jdbcTable.jdbc_max_idle_time),
- _jdbc_max_wait_time(tdesc.jdbcTable.jdbc_max_wait_time),
- _jdbc_keep_alive(tdesc.jdbcTable.jdbc_keep_alive) {}
+ _connection_pool_min_size(tdesc.jdbcTable.connection_pool_min_size),
+ _connection_pool_max_size(tdesc.jdbcTable.connection_pool_max_size),
+ _connection_pool_max_wait_time(tdesc.jdbcTable.connection_pool_max_wait_time),
+ _connection_pool_max_life_time(tdesc.jdbcTable.connection_pool_max_life_time),
+ _connection_pool_keep_alive(tdesc.jdbcTable.connection_pool_keep_alive) {}
std::string JdbcTableDescriptor::debug_string() const {
fmt::memory_buffer buf;
- fmt::format_to(buf,
- "JDBCTable({} ,_jdbc_resource_name={} ,_jdbc_driver_url={} "
- ",_jdbc_driver_class={} ,_jdbc_driver_checksum={} ,_jdbc_url={} "
- ",_jdbc_table_name={} ,_jdbc_user={} ,_jdbc_passwd={} ,_jdbc_min_pool_size={} "
- ",_jdbc_max_pool_size={} ,_jdbc_max_idle_time={} ,_jdbc_max_wait_time={} "
- ",_jdbc_keep_alive={})",
- TableDescriptor::debug_string(), _jdbc_resource_name, _jdbc_driver_url,
- _jdbc_driver_class, _jdbc_driver_checksum, _jdbc_url, _jdbc_table_name,
- _jdbc_user, _jdbc_passwd, _jdbc_min_pool_size, _jdbc_max_pool_size,
- _jdbc_max_idle_time, _jdbc_max_wait_time, _jdbc_keep_alive);
+ fmt::format_to(
+ buf,
+ "JDBCTable({} ,_jdbc_catalog_id = {}, _jdbc_resource_name={} ,_jdbc_driver_url={} "
+ ",_jdbc_driver_class={} ,_jdbc_driver_checksum={} ,_jdbc_url={} "
+ ",_jdbc_table_name={} ,_jdbc_user={} ,_jdbc_passwd={} ,_connection_pool_min_size={} "
+ ",_connection_pool_max_size={} ,_connection_pool_max_wait_time={} "
+ ",_connection_pool_max_life_time={} ,_connection_pool_keep_alive={})",
+ TableDescriptor::debug_string(), _jdbc_catalog_id, _jdbc_resource_name,
+ _jdbc_driver_url, _jdbc_driver_class, _jdbc_driver_checksum, _jdbc_url,
+ _jdbc_table_name, _jdbc_user, _jdbc_passwd, _connection_pool_min_size,
+ _connection_pool_max_size, _connection_pool_max_wait_time,
+ _connection_pool_max_life_time, _connection_pool_keep_alive);
return fmt::to_string(buf);
}
diff --git a/be/src/runtime/descriptors.h b/be/src/runtime/descriptors.h
index 42fa67a0f84..4aa3d28e47d 100644
--- a/be/src/runtime/descriptors.h
+++ b/be/src/runtime/descriptors.h
@@ -310,6 +310,7 @@ class JdbcTableDescriptor : public TableDescriptor {
public:
JdbcTableDescriptor(const TTableDescriptor& tdesc);
std::string debug_string() const override;
+ int64_t jdbc_catalog_id() const { return _jdbc_catalog_id; }
const std::string& jdbc_resource_name() const { return _jdbc_resource_name; }
const std::string& jdbc_driver_url() const { return _jdbc_driver_url; }
const std::string& jdbc_driver_class() const { return _jdbc_driver_class; }
@@ -318,13 +319,14 @@ public:
const std::string& jdbc_table_name() const { return _jdbc_table_name; }
const std::string& jdbc_user() const { return _jdbc_user; }
const std::string& jdbc_passwd() const { return _jdbc_passwd; }
- int32_t jdbc_min_pool_size() const { return _jdbc_min_pool_size; }
- int32_t jdbc_max_pool_size() const { return _jdbc_max_pool_size; }
- int32_t jdbc_max_idle_time() const { return _jdbc_max_idle_time; }
- int32_t jdbc_max_wait_time() const { return _jdbc_max_wait_time; }
- bool jdbc_keep_alive() const { return _jdbc_keep_alive; }
+ int32_t connection_pool_min_size() const { return _connection_pool_min_size; }
+ int32_t connection_pool_max_size() const { return _connection_pool_max_size; }
+ int32_t connection_pool_max_wait_time() const { return _connection_pool_max_wait_time; }
+ int32_t connection_pool_max_life_time() const { return _connection_pool_max_life_time; }
+ bool connection_pool_keep_alive() const { return _connection_pool_keep_alive; }
private:
+ int64_t _jdbc_catalog_id;
std::string _jdbc_resource_name;
std::string _jdbc_driver_url;
std::string _jdbc_driver_class;
@@ -333,11 +335,11 @@ private:
std::string _jdbc_table_name;
std::string _jdbc_user;
std::string _jdbc_passwd;
- int32_t _jdbc_min_pool_size;
- int32_t _jdbc_max_pool_size;
- int32_t _jdbc_max_idle_time;
- int32_t _jdbc_max_wait_time;
- bool _jdbc_keep_alive;
+ int32_t _connection_pool_min_size;
+ int32_t _connection_pool_max_size;
+ int32_t _connection_pool_max_wait_time;
+ int32_t _connection_pool_max_life_time;
+ bool _connection_pool_keep_alive;
};
class TupleDescriptor {
diff --git a/be/src/vec/exec/scan/new_jdbc_scanner.cpp b/be/src/vec/exec/scan/new_jdbc_scanner.cpp
index f403dad6c73..e0c64b58fb5 100644
--- a/be/src/vec/exec/scan/new_jdbc_scanner.cpp
+++ b/be/src/vec/exec/scan/new_jdbc_scanner.cpp
@@ -85,6 +85,7 @@ Status NewJdbcScanner::prepare(RuntimeState* state, const VExprContextSPtrs& con
if (jdbc_table == nullptr) {
return Status::InternalError("jdbc table pointer is NULL of VJdbcScanNode::prepare.");
}
+ _jdbc_param.catalog_id = jdbc_table->jdbc_catalog_id();
_jdbc_param.driver_class = jdbc_table->jdbc_driver_class();
_jdbc_param.driver_path = jdbc_table->jdbc_driver_url();
_jdbc_param.resource_name = jdbc_table->jdbc_resource_name();
@@ -95,11 +96,11 @@ Status NewJdbcScanner::prepare(RuntimeState* state, const VExprContextSPtrs& con
_jdbc_param.tuple_desc = _tuple_desc;
_jdbc_param.query_string = std::move(_query_string);
_jdbc_param.table_type = _table_type;
- _jdbc_param.min_pool_size = jdbc_table->jdbc_min_pool_size();
- _jdbc_param.max_pool_size = jdbc_table->jdbc_max_pool_size();
- _jdbc_param.max_idle_time = jdbc_table->jdbc_max_idle_time();
- _jdbc_param.max_wait_time = jdbc_table->jdbc_max_wait_time();
- _jdbc_param.keep_alive = jdbc_table->jdbc_keep_alive();
+ _jdbc_param.connection_pool_min_size = jdbc_table->connection_pool_min_size();
+ _jdbc_param.connection_pool_max_size = jdbc_table->connection_pool_max_size();
+ _jdbc_param.connection_pool_max_life_time = jdbc_table->connection_pool_max_life_time();
+ _jdbc_param.connection_pool_max_wait_time = jdbc_table->connection_pool_max_wait_time();
+ _jdbc_param.connection_pool_keep_alive = jdbc_table->connection_pool_keep_alive();
if (get_parent() != nullptr) {
get_parent()->_scanner_profile->add_info_string("JdbcDriverClass",
diff --git a/be/src/vec/exec/vjdbc_connector.cpp b/be/src/vec/exec/vjdbc_connector.cpp
index f20df0af98f..e6419ec95e7 100644
--- a/be/src/vec/exec/vjdbc_connector.cpp
+++ b/be/src/vec/exec/vjdbc_connector.cpp
@@ -135,6 +135,7 @@ Status JdbcConnector::open(RuntimeState* state, bool read) {
TJdbcExecutorCtorParams ctor_params;
ctor_params.__set_statement(_sql_str);
+ ctor_params.__set_catalog_id(_conn_param.catalog_id);
ctor_params.__set_jdbc_url(_conn_param.jdbc_url);
ctor_params.__set_jdbc_user(_conn_param.user);
ctor_params.__set_jdbc_password(_conn_param.passwd);
@@ -143,11 +144,13 @@ Status JdbcConnector::open(RuntimeState* state, bool read) {
ctor_params.__set_batch_size(read ? state->batch_size() : 0);
ctor_params.__set_op(read ? TJdbcOperation::READ : TJdbcOperation::WRITE);
ctor_params.__set_table_type(_conn_param.table_type);
- ctor_params.__set_min_pool_size(_conn_param.min_pool_size);
- ctor_params.__set_max_pool_size(_conn_param.max_pool_size);
- ctor_params.__set_max_idle_time(_conn_param.max_idle_time);
- ctor_params.__set_max_wait_time(_conn_param.max_wait_time);
- ctor_params.__set_keep_alive(_conn_param.keep_alive);
+ ctor_params.__set_connection_pool_min_size(_conn_param.connection_pool_min_size);
+ ctor_params.__set_connection_pool_max_size(_conn_param.connection_pool_max_size);
+ ctor_params.__set_connection_pool_max_wait_time(_conn_param.connection_pool_max_wait_time);
+ ctor_params.__set_connection_pool_max_life_time(_conn_param.connection_pool_max_life_time);
+ ctor_params.__set_connection_pool_cache_clear_time(
+ config::jdbc_connection_pool_cache_clear_time_sec);
+ ctor_params.__set_connection_pool_keep_alive(_conn_param.connection_pool_keep_alive);
jbyteArray ctor_params_bytes;
// Pushed frame will be popped when jni_frame goes out-of-scope.
diff --git a/be/src/vec/exec/vjdbc_connector.h b/be/src/vec/exec/vjdbc_connector.h
index 5d8ac121323..2ecdf210fac 100644
--- a/be/src/vec/exec/vjdbc_connector.h
+++ b/be/src/vec/exec/vjdbc_connector.h
@@ -43,6 +43,7 @@ class IColumn;
class VExprContext;
struct JdbcConnectorParam {
+ int64_t catalog_id;
std::string driver_path;
std::string driver_class;
std::string resource_name;
@@ -54,11 +55,11 @@ struct JdbcConnectorParam {
std::string table_name;
bool use_transaction;
TOdbcTableType::type table_type;
- int32_t min_pool_size;
- int32_t max_pool_size;
- int32_t max_idle_time;
- int32_t max_wait_time;
- bool keep_alive;
+ int32_t connection_pool_min_size;
+ int32_t connection_pool_max_size;
+ int32_t connection_pool_max_wait_time;
+ int32_t connection_pool_max_life_time;
+ bool connection_pool_keep_alive;
const TupleDescriptor* tuple_desc = nullptr;
};
diff --git a/be/src/vec/sink/writer/vjdbc_table_writer.cpp b/be/src/vec/sink/writer/vjdbc_table_writer.cpp
index f7e49418923..9493bfbf072 100644
--- a/be/src/vec/sink/writer/vjdbc_table_writer.cpp
+++ b/be/src/vec/sink/writer/vjdbc_table_writer.cpp
@@ -35,6 +35,7 @@ JdbcConnectorParam VJdbcTableWriter::create_connect_param(const doris::TDataSink
JdbcConnectorParam jdbc_param;
+ jdbc_param.catalog_id = t_jdbc_sink.jdbc_table.catalog_id;
jdbc_param.jdbc_url = t_jdbc_sink.jdbc_table.jdbc_url;
jdbc_param.user = t_jdbc_sink.jdbc_table.jdbc_user;
jdbc_param.passwd = t_jdbc_sink.jdbc_table.jdbc_password;
@@ -46,11 +47,11 @@ JdbcConnectorParam VJdbcTableWriter::create_connect_param(const doris::TDataSink
jdbc_param.query_string = t_jdbc_sink.insert_sql;
jdbc_param.table_name = t_jdbc_sink.jdbc_table.jdbc_table_name;
jdbc_param.use_transaction = t_jdbc_sink.use_transaction;
- jdbc_param.min_pool_size = t_jdbc_sink.jdbc_table.jdbc_min_pool_size;
- jdbc_param.max_pool_size = t_jdbc_sink.jdbc_table.jdbc_max_pool_size;
- jdbc_param.max_idle_time = t_jdbc_sink.jdbc_table.jdbc_max_idle_time;
- jdbc_param.max_wait_time = t_jdbc_sink.jdbc_table.jdbc_max_wait_time;
- jdbc_param.keep_alive = t_jdbc_sink.jdbc_table.jdbc_keep_alive;
+ jdbc_param.connection_pool_min_size = t_jdbc_sink.jdbc_table.connection_pool_min_size;
+ jdbc_param.connection_pool_max_size = t_jdbc_sink.jdbc_table.connection_pool_max_size;
+ jdbc_param.connection_pool_max_wait_time = t_jdbc_sink.jdbc_table.connection_pool_max_wait_time;
+ jdbc_param.connection_pool_max_life_time = t_jdbc_sink.jdbc_table.connection_pool_max_life_time;
+ jdbc_param.connection_pool_keep_alive = t_jdbc_sink.jdbc_table.connection_pool_keep_alive;
return jdbc_param;
}
diff --git a/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/JdbcDataSource.java b/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/JdbcDataSource.java
index 2fd0acf436d..3c8ac38cf7d 100644
--- a/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/JdbcDataSource.java
+++ b/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/JdbcDataSource.java
@@ -18,27 +18,77 @@
package org.apache.doris.jdbc;
import com.alibaba.druid.pool.DruidDataSource;
+import org.apache.log4j.Logger;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
public class JdbcDataSource {
+ private static final Logger LOG = Logger.getLogger(JdbcDataSource.class);
private static final JdbcDataSource jdbcDataSource = new JdbcDataSource();
private final Map<String, DruidDataSource> sourcesMap = new ConcurrentHashMap<>();
+ private final Map<String, Long> lastAccessTimeMap = new ConcurrentHashMap<>();
+ private final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
+ private long cleanupInterval = 8 * 60 * 60 * 1000; // 8 hours
+ private ScheduledFuture<?> cleanupTask = null;
+
+ private JdbcDataSource() {
+ startCleanupTask();
+ }
public static JdbcDataSource getDataSource() {
return jdbcDataSource;
}
public DruidDataSource getSource(String cacheKey) {
+ lastAccessTimeMap.put(cacheKey, System.currentTimeMillis());
return sourcesMap.get(cacheKey);
}
public void putSource(String cacheKey, DruidDataSource ds) {
sourcesMap.put(cacheKey, ds);
+ lastAccessTimeMap.put(cacheKey, System.currentTimeMillis());
}
public Map<String, DruidDataSource> getSourcesMap() {
return sourcesMap;
}
+
+ public void setCleanupInterval(long interval) {
+ this.cleanupInterval = interval * 1000L;
+ restartCleanupTask();
+ }
+
+ private synchronized void restartCleanupTask() {
+ if (cleanupTask != null && !cleanupTask.isCancelled()) {
+ cleanupTask.cancel(false);
+ }
+ cleanupTask = executor.scheduleAtFixedRate(() -> {
+ try {
+ long now = System.currentTimeMillis();
+ lastAccessTimeMap.forEach((key, lastAccessTime) -> {
+ if (now - lastAccessTime > cleanupInterval) {
+ DruidDataSource ds = sourcesMap.remove(key);
+ if (ds != null) {
+ ds.close();
+ }
+ lastAccessTimeMap.remove(key);
+ LOG.info("remove jdbc data source: " + key.split("jdbc")[0]);
+ }
+ });
+ } catch (Exception e) {
+ LOG.error("failed to cleanup jdbc data source", e);
+ }
+ }, cleanupInterval, cleanupInterval, TimeUnit.MILLISECONDS);
+ }
+
+ private void startCleanupTask() {
+ if (cleanupTask == null || cleanupTask.isCancelled()) {
+ restartCleanupTask();
+ }
+ }
}
diff --git a/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/JdbcDataSourceConfig.java b/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/JdbcDataSourceConfig.java
index be32568bd2e..dcf576986fe 100644
--- a/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/JdbcDataSourceConfig.java
+++ b/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/JdbcDataSourceConfig.java
@@ -21,6 +21,7 @@ import org.apache.doris.thrift.TJdbcOperation;
import org.apache.doris.thrift.TOdbcTableType;
public class JdbcDataSourceConfig {
+ private Long catalogId;
private String jdbcUrl;
private String jdbcUser;
private String jdbcPassword;
@@ -29,16 +30,25 @@ public class JdbcDataSourceConfig {
private int batchSize;
private TJdbcOperation op;
private TOdbcTableType tableType;
- private int minPoolSize;
- private int maxPoolSize;
- private int minIdleSize;
- private int maxIdleTime;
- private int maxWaitTime;
- private boolean keepAlive;
+ private int connectionPoolMinSize;
+ private int connectionPoolMaxSize;
+ private int connectionPoolMaxWaitTime;
+ private int connectionPoolMaxLifeTime;
+ private boolean connectionPoolKeepAlive;
public String createCacheKey() {
- return jdbcUrl + jdbcUser + jdbcPassword + jdbcDriverUrl + jdbcDriverClass
- + minPoolSize + maxPoolSize + minIdleSize + maxIdleTime + maxWaitTime + keepAlive;
+ return catalogId + jdbcUrl + jdbcUser + jdbcPassword + jdbcDriverUrl + jdbcDriverClass
+ + connectionPoolMinSize + connectionPoolMaxSize + connectionPoolMaxLifeTime + connectionPoolMaxWaitTime
+ + connectionPoolKeepAlive;
+ }
+
+ public long getCatalogId() {
+ return catalogId;
+ }
+
+ public JdbcDataSourceConfig setCatalogId(long catalogId) {
+ this.catalogId = catalogId;
+ return this;
}
public String getJdbcUrl() {
@@ -113,57 +123,48 @@ public class JdbcDataSourceConfig {
return this;
}
- public int getMinPoolSize() {
- return minPoolSize;
- }
-
- public JdbcDataSourceConfig setMinPoolSize(int minPoolSize) {
- this.minPoolSize = minPoolSize;
- return this;
- }
-
- public int getMaxPoolSize() {
- return maxPoolSize;
+ public int getConnectionPoolMinSize() {
+ return connectionPoolMinSize;
}
- public JdbcDataSourceConfig setMaxPoolSize(int maxPoolSize) {
- this.maxPoolSize = maxPoolSize;
+ public JdbcDataSourceConfig setConnectionPoolMinSize(int connectionPoolMinSize) {
+ this.connectionPoolMinSize = connectionPoolMinSize;
return this;
}
- public int getMinIdleSize() {
- return minIdleSize;
+ public int getConnectionPoolMaxSize() {
+ return connectionPoolMaxSize;
}
- public JdbcDataSourceConfig setMinIdleSize(int minIdleSize) {
- this.minIdleSize = minIdleSize;
+ public JdbcDataSourceConfig setConnectionPoolMaxSize(int connectionPoolMaxSize) {
+ this.connectionPoolMaxSize = connectionPoolMaxSize;
return this;
}
- public int getMaxIdleTime() {
- return maxIdleTime;
+ public int getConnectionPoolMaxWaitTime() {
+ return connectionPoolMaxWaitTime;
}
- public JdbcDataSourceConfig setMaxIdleTime(int maxIdleTime) {
- this.maxIdleTime = maxIdleTime;
+ public JdbcDataSourceConfig setConnectionPoolMaxWaitTime(int connectionPoolMaxWaitTime) {
+ this.connectionPoolMaxWaitTime = connectionPoolMaxWaitTime;
return this;
}
- public int getMaxWaitTime() {
- return maxWaitTime;
+ public int getConnectionPoolMaxLifeTime() {
+ return connectionPoolMaxLifeTime;
}
- public JdbcDataSourceConfig setMaxWaitTime(int maxWaitTime) {
- this.maxWaitTime = maxWaitTime;
+ public JdbcDataSourceConfig setConnectionPoolMaxLifeTime(int connectionPoolMaxLifeTime) {
+ this.connectionPoolMaxLifeTime = connectionPoolMaxLifeTime;
return this;
}
- public boolean isKeepAlive() {
- return keepAlive;
+ public boolean isConnectionPoolKeepAlive() {
+ return connectionPoolKeepAlive;
}
- public JdbcDataSourceConfig setKeepAlive(boolean keepAlive) {
- this.keepAlive = keepAlive;
+ public JdbcDataSourceConfig setConnectionPoolKeepAlive(boolean connectionPoolKeepAlive) {
+ this.connectionPoolKeepAlive = connectionPoolKeepAlive;
return this;
}
}
diff --git a/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/JdbcExecutor.java b/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/JdbcExecutor.java
index 73773cd1b04..8c684219af3 100644
--- a/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/JdbcExecutor.java
+++ b/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/JdbcExecutor.java
@@ -93,7 +93,7 @@ public class JdbcExecutor {
private int curBlockRows = 0;
private static final byte[] emptyBytes = new byte[0];
private DruidDataSource druidDataSource = null;
- private byte[] druidDataSourceLock = new byte[0];
+ private final byte[] druidDataSourceLock = new byte[0];
private TOdbcTableType tableType;
private JdbcDataSourceConfig config;
@@ -107,6 +107,7 @@ public class JdbcExecutor {
}
tableType = request.table_type;
this.config = new JdbcDataSourceConfig()
+ .setCatalogId(request.catalog_id)
.setJdbcUser(request.jdbc_user)
.setJdbcPassword(request.jdbc_password)
.setJdbcUrl(request.jdbc_url)
@@ -115,42 +116,54 @@ public class JdbcExecutor {
.setBatchSize(request.batch_size)
.setOp(request.op)
.setTableType(request.table_type)
- .setMinPoolSize(request.min_pool_size)
- .setMaxPoolSize(request.max_pool_size)
- .setMaxIdleTime(request.max_idle_time)
- .setMaxWaitTime(request.max_wait_time)
- .setMinIdleSize(request.min_pool_size > 0 ? 1 : 0)
- .setKeepAlive(request.keep_alive);
+ .setConnectionPoolMinSize(request.connection_pool_min_size)
+ .setConnectionPoolMaxSize(request.connection_pool_max_size)
+ .setConnectionPoolMaxWaitTime(request.connection_pool_max_wait_time)
+ .setConnectionPoolMaxLifeTime(request.connection_pool_max_life_time)
+ .setConnectionPoolKeepAlive(request.connection_pool_keep_alive);
+ JdbcDataSource.getDataSource().setCleanupInterval(request.connection_pool_cache_clear_time);
init(config, request.statement);
}
public void close() throws Exception {
try {
if (stmt != null) {
- stmt.cancel();
+ try {
+ stmt.cancel();
+ } catch (SQLException e) {
+ LOG.error("Error cancelling statement", e);
+ }
}
if (conn != null && resultSet != null) {
abortReadConnection(conn, resultSet, tableType);
- }
- if (config.getMinIdleSize() == 0) {
- // it can be immediately closed if there is no need to maintain the cache of datasource
- druidDataSource.close();
- JdbcDataSource.getDataSource().getSourcesMap().clear();
- druidDataSource = null;
+ try {
+ resultSet.close();
+ } catch (SQLException e) {
+ LOG.error("Error closing resultSet", e);
+ }
+ try {
+ stmt.close();
+ } catch (SQLException e) {
+ LOG.error("Error closing statement", e);
+ }
}
} finally {
- if (stmt != null) {
- stmt.close();
- }
- if (resultSet != null) {
- resultSet.close();
+ if (conn != null && !conn.isClosed()) {
+ try {
+ conn.close();
+ } catch (SQLException e) {
+ LOG.error("Error closing connection", e);
+ }
}
- if (conn != null) {
- conn.close();
+ }
+
+ if (config.getConnectionPoolMinSize() == 0) {
+ // Close and remove the datasource if necessary
+ if (druidDataSource != null) {
+ druidDataSource.close();
+ JdbcDataSource.getDataSource().getSourcesMap().remove(config.createCacheKey());
+ druidDataSource = null;
}
- resultSet = null;
- stmt = null;
- conn = null;
}
}
@@ -322,26 +335,30 @@ public class JdbcExecutor {
ds.setUrl(config.getJdbcUrl());
ds.setUsername(config.getJdbcUser());
ds.setPassword(config.getJdbcPassword());
- ds.setMinIdle(config.getMinIdleSize());
- ds.setInitialSize(config.getMinPoolSize());
- ds.setMaxActive(config.getMaxPoolSize());
- ds.setMaxWait(config.getMaxWaitTime());
+ ds.setMinIdle(config.getConnectionPoolMinSize()); // default 1
+ ds.setInitialSize(config.getConnectionPoolMinSize()); // default 1
+ ds.setMaxActive(config.getConnectionPoolMaxSize()); // default 10
+ ds.setMaxWait(config.getConnectionPoolMaxWaitTime()); // default 5000
ds.setTestWhileIdle(true);
ds.setTestOnBorrow(false);
setValidationQuery(ds, config.getTableType());
- ds.setTimeBetweenEvictionRunsMillis(config.getMaxIdleTime() / 5);
- ds.setMinEvictableIdleTimeMillis(config.getMaxIdleTime());
- ds.setKeepAlive(config.isKeepAlive());
+ // default 3 min
+ ds.setTimeBetweenEvictionRunsMillis(config.getConnectionPoolMaxLifeTime() / 10L);
+ // default 15 min
+ ds.setMinEvictableIdleTimeMillis(config.getConnectionPoolMaxLifeTime() / 2L);
+ // default 30 min
+ ds.setMaxEvictableIdleTimeMillis(config.getConnectionPoolMaxLifeTime());
+ ds.setKeepAlive(config.isConnectionPoolKeepAlive());
+ // default 6 min
+ ds.setKeepAliveBetweenTimeMillis(config.getConnectionPoolMaxLifeTime() / 5L);
druidDataSource = ds;
- // and the default datasource init = 1, min = 1, max = 100, if one of connection idle
- // time greater than 10 minutes. then connection will be retrieved.
JdbcDataSource.getDataSource().putSource(druidDataSourceKey, ds);
- LOG.info("JdbcExecutor set minPoolSize = " + config.getMinPoolSize()
- + ", maxPoolSize = " + config.getMaxPoolSize()
- + ", maxIdleTime = " + config.getMaxIdleTime()
- + ", maxWaitTime = " + config.getMaxWaitTime()
- + ", minIdleSize = " + config.getMinIdleSize()
- + ", keepAlive = " + config.isKeepAlive());
+ LOG.info("JdbcClient set"
+ + " ConnectionPoolMinSize = " + config.getConnectionPoolMinSize()
+ + ", ConnectionPoolMaxSize = " + config.getConnectionPoolMaxSize()
+ + ", ConnectionPoolMaxWaitTime = " + config.getConnectionPoolMaxWaitTime()
+ + ", ConnectionPoolMaxLifeTime = " + config.getConnectionPoolMaxLifeTime()
+ + ", ConnectionPoolKeepAlive = " + config.isConnectionPoolKeepAlive());
LOG.info("init datasource [" + (config.getJdbcUrl() + config.getJdbcUser()) + "] cost: " + (
System.currentTimeMillis() - start) + " ms");
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/JdbcResource.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/JdbcResource.java
index ce0805bfb7d..d95f77b0b7e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/JdbcResource.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/JdbcResource.java
@@ -40,12 +40,14 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
import java.util.Map;
/**
* External JDBC Catalog resource for external table query.
- *
+ * <p>
* create external resource jdbc_mysql
* properties (
* "type"="jdbc",
@@ -55,7 +57,7 @@ import java.util.Map;
* "driver_url"="http://127.0.0.1:8888/mysql-connector-java-5.1.47.jar",
* "driver_class"="com.mysql.jdbc.Driver"
* );
- *
+ * <p>
* DROP RESOURCE "jdbc_mysql";
*/
public class JdbcResource extends Resource {
@@ -94,12 +96,13 @@ public class JdbcResource extends Resource {
public static final String TYPE = "type";
public static final String ONLY_SPECIFIED_DATABASE = "only_specified_database";
public static final String LOWER_CASE_TABLE_NAMES = "lower_case_table_names";
- public static final String MIN_POOL_SIZE = "min_pool_size";
- public static final String MAX_POOL_SIZE = "max_pool_size";
- public static final String MAX_IDLE_TIME = "max_idle_time";
- public static final String MAX_WAIT_TIME = "max_wait_time";
- public static final String KEEP_ALIVE = "keep_alive";
+ public static final String CONNECTION_POOL_MIN_SIZE = "connection_pool_min_size";
+ public static final String CONNECTION_POOL_MAX_SIZE = "connection_pool_max_size";
+ public static final String CONNECTION_POOL_MAX_WAIT_TIME = "connection_pool_max_wait_time";
+ public static final String CONNECTION_POOL_MAX_LIFE_TIME = "connection_pool_max_life_time";
+ public static final String CONNECTION_POOL_KEEP_ALIVE = "connection_pool_keep_alive";
public static final String CHECK_SUM = "checksum";
+ public static final String CREATE_TIME = "create_time";
private static final ImmutableList<String> ALL_PROPERTIES = new ImmutableList.Builder<String>().add(
JDBC_URL,
USER,
@@ -107,21 +110,27 @@ public class JdbcResource extends Resource {
DRIVER_CLASS,
DRIVER_URL,
TYPE,
+ CREATE_TIME,
ONLY_SPECIFIED_DATABASE,
LOWER_CASE_TABLE_NAMES,
INCLUDE_DATABASE_LIST,
- EXCLUDE_DATABASE_LIST
+ EXCLUDE_DATABASE_LIST,
+ CONNECTION_POOL_MIN_SIZE,
+ CONNECTION_POOL_MAX_SIZE,
+ CONNECTION_POOL_MAX_LIFE_TIME,
+ CONNECTION_POOL_MAX_WAIT_TIME,
+ CONNECTION_POOL_KEEP_ALIVE
).build();
private static final ImmutableList<String> OPTIONAL_PROPERTIES = new ImmutableList.Builder<String>().add(
ONLY_SPECIFIED_DATABASE,
LOWER_CASE_TABLE_NAMES,
INCLUDE_DATABASE_LIST,
EXCLUDE_DATABASE_LIST,
- MIN_POOL_SIZE,
- MAX_POOL_SIZE,
- MAX_IDLE_TIME,
- MAX_WAIT_TIME,
- KEEP_ALIVE
+ CONNECTION_POOL_MIN_SIZE,
+ CONNECTION_POOL_MAX_SIZE,
+ CONNECTION_POOL_MAX_LIFE_TIME,
+ CONNECTION_POOL_MAX_WAIT_TIME,
+ CONNECTION_POOL_KEEP_ALIVE
).build();
// The default value of optional properties
@@ -133,11 +142,11 @@ public class JdbcResource extends Resource {
OPTIONAL_PROPERTIES_DEFAULT_VALUE.put(LOWER_CASE_TABLE_NAMES, "false");
OPTIONAL_PROPERTIES_DEFAULT_VALUE.put(INCLUDE_DATABASE_LIST, "");
OPTIONAL_PROPERTIES_DEFAULT_VALUE.put(EXCLUDE_DATABASE_LIST, "");
- OPTIONAL_PROPERTIES_DEFAULT_VALUE.put(MIN_POOL_SIZE, "1");
- OPTIONAL_PROPERTIES_DEFAULT_VALUE.put(MAX_POOL_SIZE, "100");
- OPTIONAL_PROPERTIES_DEFAULT_VALUE.put(MAX_IDLE_TIME, "30000");
- OPTIONAL_PROPERTIES_DEFAULT_VALUE.put(MAX_WAIT_TIME, "5000");
- OPTIONAL_PROPERTIES_DEFAULT_VALUE.put(KEEP_ALIVE, "false");
+ OPTIONAL_PROPERTIES_DEFAULT_VALUE.put(CONNECTION_POOL_MIN_SIZE, "1");
+ OPTIONAL_PROPERTIES_DEFAULT_VALUE.put(CONNECTION_POOL_MAX_SIZE, "10");
+ OPTIONAL_PROPERTIES_DEFAULT_VALUE.put(CONNECTION_POOL_MAX_LIFE_TIME, "1800000");
+ OPTIONAL_PROPERTIES_DEFAULT_VALUE.put(CONNECTION_POOL_MAX_WAIT_TIME, "5000");
+ OPTIONAL_PROPERTIES_DEFAULT_VALUE.put(CONNECTION_POOL_KEEP_ALIVE, "false");
}
// timeout for both connection and read. 10 seconds is long enough.
@@ -153,7 +162,7 @@ public class JdbcResource extends Resource {
this(name, Maps.newHashMap());
}
- private JdbcResource(String name, Map<String, String> configs) {
+ public JdbcResource(String name, Map<String, String> configs) {
super(name, ResourceType.JDBC);
this.configs = configs;
}
@@ -183,13 +192,11 @@ public class JdbcResource extends Resource {
@Override
protected void setProperties(Map<String, String> properties) throws DdlException {
Preconditions.checkState(properties != null);
- for (String key : properties.keySet()) {
- if (!ALL_PROPERTIES.contains(key)) {
- throw new DdlException("JDBC resource Property of " + key + " is unknown");
- }
- }
+ validateProperties(properties);
configs = properties;
- handleOptionalArguments();
+ applyDefaultProperties();
+ String currentDateTime = LocalDateTime.now(ZoneId.systemDefault()).toString().replace("T", " ");
+ configs.put(CREATE_TIME, currentDateTime);
// check properties
for (String property : ALL_PROPERTIES) {
String value = configs.get(property);
@@ -205,7 +212,9 @@ public class JdbcResource extends Resource {
* This function used to handle optional arguments
* eg: only_specified_database、lower_case_table_names
*/
- private void handleOptionalArguments() {
+
+ @Override
+ public void applyDefaultProperties() {
for (String s : OPTIONAL_PROPERTIES) {
if (!configs.containsKey(s)) {
configs.put(s, OPTIONAL_PROPERTIES_DEFAULT_VALUE.get(s));
@@ -245,7 +254,7 @@ public class JdbcResource extends Resource {
String fullDriverUrl = getFullDriverUrl(driverPath);
try (InputStream inputStream =
- Util.getInputStreamFromUrl(fullDriverUrl, null, HTTP_TIMEOUT_MS, HTTP_TIMEOUT_MS)) {
+ Util.getInputStreamFromUrl(fullDriverUrl, null, HTTP_TIMEOUT_MS, HTTP_TIMEOUT_MS)) {
MessageDigest digest = MessageDigest.getInstance("MD5");
byte[] buf = new byte[4096];
int bytesRead = 0;
@@ -399,4 +408,56 @@ public class JdbcResource extends Resource {
}
}
+ public static String getDefaultPropertyValue(String propertyName) {
+ return OPTIONAL_PROPERTIES_DEFAULT_VALUE.getOrDefault(propertyName, "");
+ }
+
+ public static void validateProperties(Map<String, String> properties) throws DdlException {
+ for (String key : properties.keySet()) {
+ if (!ALL_PROPERTIES.contains(key)) {
+ throw new DdlException("JDBC resource Property of " + key + " is unknown");
+ }
+ }
+ }
+
+ public static void checkBooleanProperty(String propertyName, String propertyValue) throws DdlException {
+ if (!propertyValue.equalsIgnoreCase("true") && !propertyValue.equalsIgnoreCase("false")) {
+ throw new DdlException(propertyName + " must be true or false");
+ }
+ }
+
+ public static void checkDatabaseListProperties(String onlySpecifiedDatabase,
+ Map<String, Boolean> includeDatabaseList, Map<String, Boolean> excludeDatabaseList) throws DdlException {
+ if (!onlySpecifiedDatabase.equalsIgnoreCase("true")) {
+ if ((includeDatabaseList != null && !includeDatabaseList.isEmpty()) || (excludeDatabaseList != null
+ && !excludeDatabaseList.isEmpty())) {
+ throw new DdlException(
+ "include_database_list and exclude_database_list "
+ + "cannot be set when only_specified_database is false");
+ }
+ }
+ }
+
+ public static void checkConnectionPoolProperties(int minSize, int maxSize, int maxWaitTime, int maxLifeTime)
+ throws DdlException {
+ if (minSize < 0) {
+ throw new DdlException("connection_pool_min_size must be greater than or equal to 0");
+ }
+ if (maxSize < 1) {
+ throw new DdlException("connection_pool_max_size must be greater than or equal to 1");
+ }
+ if (maxSize < minSize) {
+ throw new DdlException(
+ "connection_pool_max_size must be greater than or equal to connection_pool_min_size");
+ }
+ if (maxWaitTime < 0) {
+ throw new DdlException("connection_pool_max_wait_time must be greater than or equal to 0");
+ }
+ if (maxWaitTime > 30000) {
+ throw new DdlException("connection_pool_max_wait_time must be less than or equal to 30000");
+ }
+ if (maxLifeTime < 150000) {
+ throw new DdlException("connection_pool_max_life_time must be greater than or equal to 150000");
+ }
+ }
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/JdbcTable.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/JdbcTable.java
index 06d42b158f8..38aa8a73bdd 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/JdbcTable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/JdbcTable.java
@@ -51,6 +51,7 @@ public class JdbcTable extends Table {
private static final ObjectMapper objectMapper = new ObjectMapper();
+ private static final String CATALOG_ID = "catalog_id";
private static final String TABLE = "table";
private static final String REAL_DATABASE = "real_database";
private static final String REAL_TABLE = "real_table";
@@ -81,11 +82,13 @@ public class JdbcTable extends Table {
private String driverUrl;
private String checkSum;
- private int minPoolSize = 1;
- private int maxPoolSize = 100;
- private int maxIdleTime = 30000;
- private int maxWaitTime = 5000;
- private boolean keepAlive = false;
+ private long catalogId = -1;
+
+ private int connectionPoolMinSize;
+ private int connectionPoolMaxSize;
+ private int connectionPoolMaxWaitTime;
+ private int connectionPoolMaxLifeTime;
+ private boolean connectionPoolKeepAlive;
static {
Map<String, TOdbcTableType> tempMap = new CaseInsensitiveMap();
@@ -169,24 +172,33 @@ public class JdbcTable extends Table {
return getFromJdbcResourceOrDefault(JdbcResource.DRIVER_URL, driverUrl);
}
- public int getMinPoolSize() {
- return Integer.parseInt(getFromJdbcResourceOrDefault(JdbcResource.MIN_POOL_SIZE, String.valueOf(minPoolSize)));
+ public long getCatalogId() {
+ return catalogId;
+ }
+
+ public int getConnectionPoolMinSize() {
+ return Integer.parseInt(getFromJdbcResourceOrDefault(JdbcResource.CONNECTION_POOL_MIN_SIZE,
+ String.valueOf(connectionPoolMinSize)));
}
- public int getMaxPoolSize() {
- return Integer.parseInt(getFromJdbcResourceOrDefault(JdbcResource.MAX_POOL_SIZE, String.valueOf(maxPoolSize)));
+ public int getConnectionPoolMaxSize() {
+ return Integer.parseInt(getFromJdbcResourceOrDefault(JdbcResource.CONNECTION_POOL_MAX_SIZE,
+ String.valueOf(connectionPoolMaxSize)));
}
- public int getMaxIdleTime() {
- return Integer.parseInt(getFromJdbcResourceOrDefault(JdbcResource.MAX_IDLE_TIME, String.valueOf(maxIdleTime)));
+ public int getConnectionPoolMaxWaitTime() {
+ return Integer.parseInt(getFromJdbcResourceOrDefault(JdbcResource.CONNECTION_POOL_MAX_WAIT_TIME,
+ String.valueOf(connectionPoolMaxWaitTime)));
}
- public int getMaxWaitTime() {
- return Integer.parseInt(getFromJdbcResourceOrDefault(JdbcResource.MAX_WAIT_TIME, String.valueOf(maxWaitTime)));
+ public int getConnectionPoolMaxLifeTime() {
+ return Integer.parseInt(getFromJdbcResourceOrDefault(JdbcResource.CONNECTION_POOL_MAX_LIFE_TIME,
+ String.valueOf(connectionPoolMaxLifeTime)));
}
- public boolean getKeepAlive() {
- return Boolean.parseBoolean(getFromJdbcResourceOrDefault(JdbcResource.KEEP_ALIVE, String.valueOf(keepAlive)));
+ public boolean isConnectionPoolKeepAlive() {
+ return Boolean.parseBoolean(getFromJdbcResourceOrDefault(JdbcResource.CONNECTION_POOL_KEEP_ALIVE,
+ String.valueOf(connectionPoolKeepAlive)));
}
private String getFromJdbcResourceOrDefault(String key, String defaultVal) {
@@ -203,6 +215,7 @@ public class JdbcTable extends Table {
@Override
public TTableDescriptor toThrift() {
TJdbcTable tJdbcTable = new TJdbcTable();
+ tJdbcTable.setCatalogId(catalogId);
tJdbcTable.setJdbcUrl(getJdbcUrl());
tJdbcTable.setJdbcUser(getJdbcUser());
tJdbcTable.setJdbcPassword(getJdbcPasswd());
@@ -211,11 +224,11 @@ public class JdbcTable extends Table {
tJdbcTable.setJdbcDriverUrl(getDriverUrl());
tJdbcTable.setJdbcResourceName(resourceName);
tJdbcTable.setJdbcDriverChecksum(checkSum);
- tJdbcTable.setJdbcMinPoolSize(getMinPoolSize());
- tJdbcTable.setJdbcMaxPoolSize(getMaxPoolSize());
- tJdbcTable.setJdbcMaxIdleTime(getMaxIdleTime());
- tJdbcTable.setJdbcMaxWaitTime(getMaxWaitTime());
- tJdbcTable.setJdbcKeepAlive(getKeepAlive());
+ tJdbcTable.setConnectionPoolMinSize(getConnectionPoolMinSize());
+ tJdbcTable.setConnectionPoolMaxSize(getConnectionPoolMaxSize());
+ tJdbcTable.setConnectionPoolMaxWaitTime(getConnectionPoolMaxWaitTime());
+ tJdbcTable.setConnectionPoolMaxLifeTime(getConnectionPoolMaxLifeTime());
+ tJdbcTable.setConnectionPoolKeepAlive(isConnectionPoolKeepAlive());
TTableDescriptor tTableDescriptor = new TTableDescriptor(getId(), TTableType.JDBC_TABLE, fullSchema.size(), 0,
getName(), "");
tTableDescriptor.setJdbcTable(tJdbcTable);
@@ -226,6 +239,7 @@ public class JdbcTable extends Table {
public void write(DataOutput out) throws IOException {
super.write(out);
Map<String, String> serializeMap = Maps.newHashMap();
+ serializeMap.put(CATALOG_ID, String.valueOf(catalogId));
serializeMap.put(TABLE, externalTableName);
serializeMap.put(RESOURCE, resourceName);
serializeMap.put(TABLE_TYPE, jdbcTypeName);
@@ -263,6 +277,7 @@ public class JdbcTable extends Table {
String value = Text.readString(in);
serializeMap.put(key, value);
}
+ catalogId = serializeMap.get(CATALOG_ID) != null ? Long.parseLong(serializeMap.get(CATALOG_ID)) : -1;
externalTableName = serializeMap.get(TABLE);
resourceName = serializeMap.get(RESOURCE);
jdbcTypeName = serializeMap.get(TABLE_TYPE);
@@ -393,6 +408,14 @@ public class JdbcTable extends Table {
driverClass = jdbcResource.getProperty(DRIVER_CLASS);
driverUrl = jdbcResource.getProperty(DRIVER_URL);
checkSum = jdbcResource.getProperty(CHECK_SUM);
+ connectionPoolMinSize = Integer.parseInt(jdbcResource.getProperty(JdbcResource.CONNECTION_POOL_MIN_SIZE));
+ connectionPoolMaxSize = Integer.parseInt(jdbcResource.getProperty(JdbcResource.CONNECTION_POOL_MAX_SIZE));
+ connectionPoolMaxWaitTime = Integer.parseInt(
+ jdbcResource.getProperty(JdbcResource.CONNECTION_POOL_MAX_WAIT_TIME));
+ connectionPoolMaxLifeTime = Integer.parseInt(
+ jdbcResource.getProperty(JdbcResource.CONNECTION_POOL_MAX_LIFE_TIME));
+ connectionPoolKeepAlive = Boolean.parseBoolean(
+ jdbcResource.getProperty(JdbcResource.CONNECTION_POOL_KEEP_ALIVE));
String urlType = jdbcUrl.split(":")[1];
if (!jdbcTypeName.equalsIgnoreCase(urlType)) {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Resource.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Resource.java
index 781c5fb3f61..1a51d42f57a 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Resource.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Resource.java
@@ -296,4 +296,6 @@ public abstract class Resource implements Writable, GsonPostProcessable {
}
});
}
+
+ public void applyDefaultProperties() {}
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/ResourceMgr.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/ResourceMgr.java
index 0a0b43adf60..34dfb3fa919 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/ResourceMgr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/ResourceMgr.java
@@ -96,6 +96,7 @@ public class ResourceMgr implements Writable {
}
public void replayCreateResource(Resource resource) {
+ resource.applyDefaultProperties();
nameToResource.put(resource.getName(), resource);
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/external/JdbcExternalTable.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/external/JdbcExternalTable.java
index 100fa228098..b0a0654e908 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/external/JdbcExternalTable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/external/JdbcExternalTable.java
@@ -82,6 +82,7 @@ public class JdbcExternalTable extends ExternalTable {
JdbcExternalCatalog jdbcCatalog = (JdbcExternalCatalog) catalog;
String fullDbName = this.dbName + "." + this.name;
JdbcTable jdbcTable = new JdbcTable(this.id, fullDbName, schema, TableType.JDBC_EXTERNAL_TABLE);
+ jdbcTable.setCatalogId(jdbcCatalog.getId());
jdbcTable.setExternalTableName(fullDbName);
jdbcTable.setRealDatabaseName(((JdbcExternalCatalog) catalog).getJdbcClient().getRealDatabaseName(this.dbName));
jdbcTable.setRealTableName(
@@ -96,11 +97,11 @@ public class JdbcExternalTable extends ExternalTable {
jdbcTable.setDriverUrl(jdbcCatalog.getDriverUrl());
jdbcTable.setResourceName(jdbcCatalog.getResource());
jdbcTable.setCheckSum(jdbcCatalog.getCheckSum());
- jdbcTable.setMinPoolSize(jdbcCatalog.getMinPoolSize());
- jdbcTable.setMaxPoolSize(jdbcCatalog.getMaxPoolSize());
- jdbcTable.setMaxIdleTime(jdbcCatalog.getMaxIdleTime());
- jdbcTable.setMaxWaitTime(jdbcCatalog.getMaxWaitTime());
- jdbcTable.setKeepAlive(jdbcCatalog.getKeepAlive());
+ jdbcTable.setConnectionPoolMinSize(jdbcCatalog.getConnectionPoolMinSize());
+ jdbcTable.setConnectionPoolMaxSize(jdbcCatalog.getConnectionPoolMaxSize());
+ jdbcTable.setConnectionPoolMaxLifeTime(jdbcCatalog.getConnectionPoolMaxLifeTime());
+ jdbcTable.setConnectionPoolMaxWaitTime(jdbcCatalog.getConnectionPoolMaxWaitTime());
+ jdbcTable.setConnectionPoolKeepAlive(jdbcCatalog.isConnectionPoolKeepAlive());
return jdbcTable;
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/JdbcExternalCatalog.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/JdbcExternalCatalog.java
index c5b33f7200e..e99174c1c20 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/JdbcExternalCatalog.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/JdbcExternalCatalog.java
@@ -65,6 +65,17 @@ public class JdbcExternalCatalog extends ExternalCatalog {
throw new DdlException("Required property '" + requiredProperty + "' is missing");
}
}
+
+ Map<String, String> propertiesWithoutCheckSum = Maps.newHashMap(catalogProperty.getProperties());
+ propertiesWithoutCheckSum.remove(JdbcResource.CHECK_SUM);
+ JdbcResource.validateProperties(propertiesWithoutCheckSum);
+
+ JdbcResource.checkBooleanProperty(JdbcResource.ONLY_SPECIFIED_DATABASE, getOnlySpecifiedDatabase());
+ JdbcResource.checkBooleanProperty(JdbcResource.LOWER_CASE_TABLE_NAMES, getLowerCaseTableNames());
+ JdbcResource.checkDatabaseListProperties(getOnlySpecifiedDatabase(), getIncludeDatabaseMap(),
+ getExcludeDatabaseMap());
+ JdbcResource.checkConnectionPoolProperties(getConnectionPoolMinSize(), getConnectionPoolMaxSize(),
+ getConnectionPoolMaxWaitTime(), getConnectionPoolMaxLifeTime());
}
@Override
@@ -130,7 +141,8 @@ public class JdbcExternalCatalog extends ExternalCatalog {
}
public String getOnlySpecifiedDatabase() {
- return catalogProperty.getOrDefault(JdbcResource.ONLY_SPECIFIED_DATABASE, "false");
+ return catalogProperty.getOrDefault(JdbcResource.ONLY_SPECIFIED_DATABASE, JdbcResource.getDefaultPropertyValue(
+ JdbcResource.ONLY_SPECIFIED_DATABASE));
}
public String getLowerCaseTableNames() {
@@ -140,27 +152,33 @@ public class JdbcExternalCatalog extends ExternalCatalog {
}
// Otherwise, it defaults to false
- return catalogProperty.getOrDefault(JdbcResource.LOWER_CASE_TABLE_NAMES, "false");
+ return catalogProperty.getOrDefault(JdbcResource.LOWER_CASE_TABLE_NAMES, JdbcResource.getDefaultPropertyValue(
+ JdbcResource.LOWER_CASE_TABLE_NAMES));
}
- public int getMinPoolSize() {
- return Integer.parseInt(catalogProperty.getOrDefault(JdbcResource.MIN_POOL_SIZE, "1"));
+ public int getConnectionPoolMinSize() {
+ return Integer.parseInt(catalogProperty.getOrDefault(JdbcResource.CONNECTION_POOL_MIN_SIZE, JdbcResource
+ .getDefaultPropertyValue(JdbcResource.CONNECTION_POOL_MIN_SIZE)));
}
- public int getMaxPoolSize() {
- return Integer.parseInt(catalogProperty.getOrDefault(JdbcResource.MAX_POOL_SIZE, "100"));
+ public int getConnectionPoolMaxSize() {
+ return Integer.parseInt(catalogProperty.getOrDefault(JdbcResource.CONNECTION_POOL_MAX_SIZE, JdbcResource
+ .getDefaultPropertyValue(JdbcResource.CONNECTION_POOL_MAX_SIZE)));
}
- public int getMaxIdleTime() {
- return Integer.parseInt(catalogProperty.getOrDefault(JdbcResource.MAX_IDLE_TIME, "300000"));
+ public int getConnectionPoolMaxWaitTime() {
+ return Integer.parseInt(catalogProperty.getOrDefault(JdbcResource.CONNECTION_POOL_MAX_WAIT_TIME, JdbcResource
+ .getDefaultPropertyValue(JdbcResource.CONNECTION_POOL_MAX_WAIT_TIME)));
}
- public int getMaxWaitTime() {
- return Integer.parseInt(catalogProperty.getOrDefault(JdbcResource.MAX_WAIT_TIME, "5000"));
+ public int getConnectionPoolMaxLifeTime() {
+ return Integer.parseInt(catalogProperty.getOrDefault(JdbcResource.CONNECTION_POOL_MAX_LIFE_TIME, JdbcResource
+ .getDefaultPropertyValue(JdbcResource.CONNECTION_POOL_MAX_LIFE_TIME)));
}
- public boolean getKeepAlive() {
- return Boolean.parseBoolean(catalogProperty.getOrDefault(JdbcResource.KEEP_ALIVE, "false"));
+ public boolean isConnectionPoolKeepAlive() {
+ return Boolean.parseBoolean(catalogProperty.getOrDefault(JdbcResource.CONNECTION_POOL_KEEP_ALIVE, JdbcResource
+ .getDefaultPropertyValue(JdbcResource.CONNECTION_POOL_KEEP_ALIVE)));
}
@Override
@@ -176,12 +194,11 @@ public class JdbcExternalCatalog extends ExternalCatalog {
.setIsLowerCaseTableNames(getLowerCaseTableNames())
.setIncludeDatabaseMap(getIncludeDatabaseMap())
.setExcludeDatabaseMap(getExcludeDatabaseMap())
- .setMinPoolSize(getMinPoolSize())
- .setMaxPoolSize(getMaxPoolSize())
- .setMinIdleSize(getMinPoolSize() > 0 ? 1 : 0)
- .setMaxIdleTime(getMaxIdleTime())
- .setMaxWaitTime(getMaxWaitTime())
- .setKeepAlive(getKeepAlive());
+ .setConnectionPoolMinSize(getConnectionPoolMinSize())
+ .setConnectionPoolMaxSize(getConnectionPoolMaxSize())
+ .setConnectionPoolMaxLifeTime(getConnectionPoolMaxLifeTime())
+ .setConnectionPoolMaxWaitTime(getConnectionPoolMaxWaitTime())
+ .setConnectionPoolKeepAlive(isConnectionPoolKeepAlive());
jdbcClient = JdbcClient.createJdbcClient(jdbcClientConfig);
}
@@ -219,27 +236,11 @@ public class JdbcExternalCatalog extends ExternalCatalog {
properties.put(JdbcResource.CHECK_SUM,
JdbcResource.computeObjectChecksum(properties.get(JdbcResource.DRIVER_URL)));
}
- String onlySpecifiedDatabase = getOnlySpecifiedDatabase();
- if (!onlySpecifiedDatabase.equalsIgnoreCase("true") && !onlySpecifiedDatabase.equalsIgnoreCase("false")) {
- throw new DdlException("only_specified_database must be true or false");
- }
- String lowerCaseTableNames = getLowerCaseTableNames();
- if (!lowerCaseTableNames.equalsIgnoreCase("true") && !lowerCaseTableNames.equalsIgnoreCase("false")) {
- throw new DdlException("lower_case_table_names must be true or false");
- }
- if (!onlySpecifiedDatabase.equalsIgnoreCase("true")) {
- Map<String, Boolean> includeDatabaseList = getIncludeDatabaseMap();
- Map<String, Boolean> excludeDatabaseList = getExcludeDatabaseMap();
- if ((includeDatabaseList != null && !includeDatabaseList.isEmpty())
- || (excludeDatabaseList != null && !excludeDatabaseList.isEmpty())) {
- throw new DdlException("include_database_list and exclude_database_list can not be set when "
- + "only_specified_database is false");
- }
- }
}
/**
* Execute stmt direct via jdbc
+ *
* @param stmt, the raw stmt string
*/
public void executeStmt(String stmt) {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/client/JdbcClient.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/client/JdbcClient.java
index 3e1f5a73f69..7851b708d36 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/client/JdbcClient.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/client/JdbcClient.java
@@ -135,24 +135,23 @@ public abstract class JdbcClient {
dataSource.setUrl(config.getJdbcUrl());
dataSource.setUsername(config.getUser());
dataSource.setPassword(config.getPassword());
- dataSource.setMinIdle(config.getMinIdleSize());
- dataSource.setInitialSize(config.getMinPoolSize());
- dataSource.setMaxActive(config.getMaxPoolSize());
- dataSource.setTimeBetweenEvictionRunsMillis(config.getMaxIdleTime() * 2L);
- dataSource.setMinEvictableIdleTimeMillis(config.getMaxIdleTime());
+ dataSource.setMinIdle(config.getConnectionPoolMinSize()); // default 1
+ dataSource.setInitialSize(config.getConnectionPoolMinSize()); // default 1
+ dataSource.setMaxActive(config.getConnectionPoolMaxSize()); // default 10
// set connection timeout to 5s.
// The default is 30s, which is too long.
// Because when querying information_schema db, BE will call thrift rpc(default timeout is 30s)
// to FE to get schema info, and may create connection here, if we set it too long and the url is invalid,
// it may cause the thrift rpc timeout.
- dataSource.setMaxWait(config.getMaxWaitTime());
- dataSource.setKeepAlive(config.isKeepAlive());
- LOG.info("JdbcExecutor set minPoolSize = " + config.getMinPoolSize()
- + ", maxPoolSize = " + config.getMaxPoolSize()
- + ", maxIdleTime = " + config.getMaxIdleTime()
- + ", maxWaitTime = " + config.getMaxWaitTime()
- + ", minIdleSize = " + config.getMinIdleSize()
- + ", keepAlive = " + config.isKeepAlive());
+ dataSource.setMaxWait(config.getConnectionPoolMaxWaitTime()); // default 5000
+ dataSource.setTimeBetweenEvictionRunsMillis(config.getConnectionPoolMaxLifeTime() / 10L); // default 3 min
+ dataSource.setMinEvictableIdleTimeMillis(config.getConnectionPoolMaxLifeTime() / 2L); // default 15 min
+ dataSource.setMaxEvictableIdleTimeMillis(config.getConnectionPoolMaxLifeTime()); // default 30 min
+ LOG.info("JdbcClient set"
+ + " ConnectionPoolMinSize = " + config.getConnectionPoolMinSize()
+ + ", ConnectionPoolMaxSize = " + config.getConnectionPoolMaxSize()
+ + ", ConnectionPoolMaxWaitTime = " + config.getConnectionPoolMaxWaitTime()
+ + ", ConnectionPoolMaxLifeTime = " + config.getConnectionPoolMaxLifeTime());
} catch (MalformedURLException e) {
throw new JdbcClientException("MalformedURLException to load class about " + config.getDriverUrl(), e);
} finally {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/client/JdbcClientConfig.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/client/JdbcClientConfig.java
index ff080f8c875..41fac872e46 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/client/JdbcClientConfig.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/client/JdbcClientConfig.java
@@ -18,6 +18,8 @@
package org.apache.doris.datasource.jdbc.client;
+import org.apache.doris.catalog.JdbcResource;
+
import com.google.common.collect.Maps;
import java.util.Map;
@@ -31,22 +33,44 @@ public class JdbcClientConfig implements Cloneable {
private String driverClass;
private String onlySpecifiedDatabase;
private String isLowerCaseTableNames;
- private int minPoolSize = 1;
- private int maxPoolSize = 100;
- private int minIdleSize = 1;
- private int maxIdleTime = 300000;
- private int maxWaitTime = 5000;
- private boolean keepAlive = false;
-
- private Map<String, Boolean> includeDatabaseMap = Maps.newHashMap();
- private Map<String, Boolean> excludeDatabaseMap = Maps.newHashMap();
- private Map<String, String> customizedProperties = Maps.newHashMap();
+ private int connectionPoolMinSize;
+ private int connectionPoolMaxSize;
+ private int connectionPoolMaxWaitTime;
+ private int connectionPoolMaxLifeTime;
+ private boolean connectionPoolKeepAlive;
+
+ private Map<String, Boolean> includeDatabaseMap;
+ private Map<String, Boolean> excludeDatabaseMap;
+ private Map<String, String> customizedProperties;
+
+ public JdbcClientConfig() {
+ this.onlySpecifiedDatabase = JdbcResource.getDefaultPropertyValue(JdbcResource.ONLY_SPECIFIED_DATABASE);
+ this.isLowerCaseTableNames = JdbcResource.getDefaultPropertyValue(JdbcResource.LOWER_CASE_TABLE_NAMES);
+ this.connectionPoolMinSize = Integer.parseInt(
+ JdbcResource.getDefaultPropertyValue(JdbcResource.CONNECTION_POOL_MIN_SIZE));
+ this.connectionPoolMaxSize = Integer.parseInt(
+ JdbcResource.getDefaultPropertyValue(JdbcResource.CONNECTION_POOL_MAX_SIZE));
+ this.connectionPoolMaxWaitTime = Integer.parseInt(
+ JdbcResource.getDefaultPropertyValue(JdbcResource.CONNECTION_POOL_MAX_WAIT_TIME));
+ this.connectionPoolMaxLifeTime = Integer.parseInt(
+ JdbcResource.getDefaultPropertyValue(JdbcResource.CONNECTION_POOL_MAX_LIFE_TIME));
+ this.connectionPoolKeepAlive = Boolean.parseBoolean(
+ JdbcResource.getDefaultPropertyValue(JdbcResource.CONNECTION_POOL_KEEP_ALIVE));
+ this.includeDatabaseMap = Maps.newHashMap();
+ this.excludeDatabaseMap = Maps.newHashMap();
+ this.customizedProperties = Maps.newHashMap();
+ }
@Override
public JdbcClientConfig clone() {
try {
JdbcClientConfig cloned = (JdbcClientConfig) super.clone();
+ cloned.connectionPoolMinSize = connectionPoolMinSize;
+ cloned.connectionPoolMaxSize = connectionPoolMaxSize;
+ cloned.connectionPoolMaxLifeTime = connectionPoolMaxLifeTime;
+ cloned.connectionPoolMaxWaitTime = connectionPoolMaxWaitTime;
+ cloned.connectionPoolKeepAlive = connectionPoolKeepAlive;
cloned.includeDatabaseMap = Maps.newHashMap(includeDatabaseMap);
cloned.excludeDatabaseMap = Maps.newHashMap(excludeDatabaseMap);
cloned.customizedProperties = Maps.newHashMap(customizedProperties);
@@ -128,57 +152,48 @@ public class JdbcClientConfig implements Cloneable {
return this;
}
- public int getMinPoolSize() {
- return minPoolSize;
- }
-
- public JdbcClientConfig setMinPoolSize(int minPoolSize) {
- this.minPoolSize = minPoolSize;
- return this;
- }
-
- public int getMaxPoolSize() {
- return maxPoolSize;
+ public int getConnectionPoolMinSize() {
+ return connectionPoolMinSize;
}
- public JdbcClientConfig setMaxPoolSize(int maxPoolSize) {
- this.maxPoolSize = maxPoolSize;
+ public JdbcClientConfig setConnectionPoolMinSize(int connectionPoolMinSize) {
+ this.connectionPoolMinSize = connectionPoolMinSize;
return this;
}
- public int getMinIdleSize() {
- return minIdleSize;
+ public int getConnectionPoolMaxSize() {
+ return connectionPoolMaxSize;
}
- public JdbcClientConfig setMinIdleSize(int minIdleSize) {
- this.minIdleSize = minIdleSize;
+ public JdbcClientConfig setConnectionPoolMaxSize(int connectionPoolMaxSize) {
+ this.connectionPoolMaxSize = connectionPoolMaxSize;
return this;
}
- public int getMaxIdleTime() {
- return maxIdleTime;
+ public int getConnectionPoolMaxLifeTime() {
+ return connectionPoolMaxLifeTime;
}
- public JdbcClientConfig setMaxIdleTime(int maxIdleTime) {
- this.maxIdleTime = maxIdleTime;
+ public JdbcClientConfig setConnectionPoolMaxLifeTime(int connectionPoolMaxLifeTime) {
+ this.connectionPoolMaxLifeTime = connectionPoolMaxLifeTime;
return this;
}
- public int getMaxWaitTime() {
- return maxWaitTime;
+ public int getConnectionPoolMaxWaitTime() {
+ return connectionPoolMaxWaitTime;
}
- public JdbcClientConfig setMaxWaitTime(int maxWaitTime) {
- this.maxWaitTime = maxWaitTime;
+ public JdbcClientConfig setConnectionPoolMaxWaitTime(int connectionPoolMaxWaitTime) {
+ this.connectionPoolMaxWaitTime = connectionPoolMaxWaitTime;
return this;
}
- public boolean isKeepAlive() {
- return keepAlive;
+ public boolean isConnectionPoolKeepAlive() {
+ return connectionPoolKeepAlive;
}
- public JdbcClientConfig setKeepAlive(boolean keepAlive) {
- this.keepAlive = keepAlive;
+ public JdbcClientConfig setConnectionPoolKeepAlive(boolean connectionPoolKeepAlive) {
+ this.connectionPoolKeepAlive = connectionPoolKeepAlive;
return this;
}
diff --git a/fe/fe-core/src/test/java/org/apache/doris/catalog/JdbcResourceTest.java b/fe/fe-core/src/test/java/org/apache/doris/catalog/JdbcResourceTest.java
index e91898fb82d..ee0d1949be2 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/catalog/JdbcResourceTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/catalog/JdbcResourceTest.java
@@ -17,13 +17,154 @@
package org.apache.doris.catalog;
+import org.apache.doris.analysis.AccessTestUtil;
+import org.apache.doris.analysis.Analyzer;
+import org.apache.doris.analysis.CreateResourceStmt;
import org.apache.doris.common.DdlException;
+import org.apache.doris.common.FeConstants;
+import org.apache.doris.common.UserException;
+import org.apache.doris.mysql.privilege.AccessControllerManager;
+import org.apache.doris.mysql.privilege.PrivPredicate;
+import org.apache.doris.qe.ConnectContext;
+import com.google.common.collect.Maps;
+import mockit.Expectations;
+import mockit.Injectable;
+import mockit.Mocked;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
+import java.util.Map;
+
public class JdbcResourceTest {
+ private final ResourceMgr resourceMgr = new ResourceMgr();
+
+ private Map<String, String> jdbcProperties;
+
+ private Analyzer analyzer;
+
+ @Before
+ public void setUp() {
+ FeConstants.runningUnitTest = true;
+ analyzer = AccessTestUtil.fetchAdminAnalyzer(true);
+ jdbcProperties = Maps.newHashMap();
+ jdbcProperties.put("type", "jdbc");
+ jdbcProperties.put("user", "postgres");
+ jdbcProperties.put("password", "");
+ jdbcProperties.put("jdbc_url", "jdbc:postgresql://127.0.0.1:5432/postgres?currentSchema=doris_test");
+ jdbcProperties.put("driver_url", "postgresql-42.5.0.jar");
+ jdbcProperties.put("driver_class", "org.postgresql.Driver");
+ jdbcProperties.put("checksum", "20c8228267b6c9ce620fddb39467d3eb");
+ }
+
+ @Test
+ public void testJdbcResourceCreateWithDefaultProperties(@Mocked Env env,
+ @Injectable AccessControllerManager accessManager)
+ throws UserException {
+ new Expectations() {
+ {
+ env.getAccessManager();
+ result = accessManager;
+ accessManager.checkGlobalPriv((ConnectContext) any, PrivPredicate.ADMIN);
+ result = true;
+ }
+ };
+
+ jdbcProperties.remove("checksum");
+
+ CreateResourceStmt stmt = new CreateResourceStmt(true, false, "jdbc_resource_pg_14", jdbcProperties);
+
+ stmt.analyze(analyzer);
+
+ resourceMgr.createResource(stmt);
+
+ JdbcResource jdbcResource = (JdbcResource) resourceMgr.getResource("jdbc_resource_pg_14");
+
+
+ // Verify the default properties were applied during the replay
+ Map<String, String> properties = jdbcResource.getCopiedProperties();
+ Assert.assertEquals("1", properties.get("connection_pool_min_size"));
+ Assert.assertEquals("10", properties.get("connection_pool_max_size"));
+ Assert.assertEquals("1800000", properties.get("connection_pool_max_life_time"));
+ Assert.assertEquals("5000", properties.get("connection_pool_max_wait_time"));
+ Assert.assertEquals("false", properties.get("connection_pool_keep_alive"));
+ }
+
+ @Test
+ public void testJdbcResourceReplayWithDefaultProperties() {
+
+ JdbcResource jdbcResource = new JdbcResource("jdbc_resource_pg_14", jdbcProperties);
+
+ // Replay the resource creation to simulate the edit log replay
+ resourceMgr.replayCreateResource(jdbcResource);
+
+ // Retrieve the replayed resource
+ Resource replayedResource = resourceMgr.getResource("jdbc_resource_pg_14");
+
+ Assert.assertNotNull(replayedResource);
+ Assert.assertTrue(replayedResource instanceof JdbcResource);
+
+ // Verify the default properties were applied during the replay
+ Map<String, String> properties = replayedResource.getCopiedProperties();
+ Assert.assertEquals("1", properties.get("connection_pool_min_size"));
+ Assert.assertEquals("10", properties.get("connection_pool_max_size"));
+ Assert.assertEquals("1800000", properties.get("connection_pool_max_life_time"));
+ Assert.assertEquals("5000", properties.get("connection_pool_max_wait_time"));
+ Assert.assertEquals("false", properties.get("connection_pool_keep_alive"));
+ }
+
+ @Test
+ public void testJdbcResourceReplayWithSetProperties() {
+
+ // Add some properties to the JDBC properties
+ jdbcProperties.put("connection_pool_min_size", "2");
+ jdbcProperties.put("connection_pool_max_size", "20");
+ jdbcProperties.put("connection_pool_max_life_time", "3600000");
+ jdbcProperties.put("connection_pool_max_wait_time", "10000");
+ jdbcProperties.put("connection_pool_keep_alive", "true");
+
+ JdbcResource jdbcResource = new JdbcResource("jdbc_resource_pg_14", jdbcProperties);
+
+ // Replay the resource creation to simulate the edit log replay
+ resourceMgr.replayCreateResource(jdbcResource);
+
+ // Retrieve the replayed resource
+ Resource replayedResource = resourceMgr.getResource("jdbc_resource_pg_14");
+
+ Assert.assertNotNull(replayedResource);
+ Assert.assertTrue(replayedResource instanceof JdbcResource);
+
+ // Verify the modified properties were applied during the replay
+ Map<String, String> properties = replayedResource.getCopiedProperties();
+ Assert.assertEquals("2", properties.get("connection_pool_min_size"));
+ Assert.assertEquals("20", properties.get("connection_pool_max_size"));
+ Assert.assertEquals("3600000", properties.get("connection_pool_max_life_time"));
+ Assert.assertEquals("10000", properties.get("connection_pool_max_wait_time"));
+ Assert.assertEquals("true", properties.get("connection_pool_keep_alive"));
+ }
+
+ @Test
+ public void testJdbcResourceReplayWithModifiedAfterSetDefaultProperties() throws DdlException {
+ JdbcResource jdbcResource = new JdbcResource("jdbc_resource_pg_14", jdbcProperties);
+
+ // Replay the resource creation to simulate the edit log replay
+ resourceMgr.replayCreateResource(jdbcResource);
+
+ // Retrieve the replayed resource
+ Resource replayedResource = resourceMgr.getResource("jdbc_resource_pg_14");
+ Map<String, String> newProperties = Maps.newHashMap();
+ newProperties.put(JdbcResource.CONNECTION_POOL_MIN_SIZE, "2");
+ replayedResource.modifyProperties(newProperties);
+ Map<String, String> properties = replayedResource.getCopiedProperties();
+ Assert.assertEquals("2", properties.get("connection_pool_min_size"));
+ resourceMgr.replayCreateResource(replayedResource);
+ Resource replayedResource2 = resourceMgr.getResource("jdbc_resource_pg_14");
+ Map<String, String> properties2 = replayedResource2.getCopiedProperties();
+ Assert.assertEquals("2", properties2.get("connection_pool_min_size"));
+ }
+
@Test
public void testHandleJdbcUrlForMySql() throws DdlException {
String inputUrl = "jdbc:mysql://127.0.0.1:3306/test";
@@ -36,7 +177,7 @@ public class JdbcResourceTest {
@Test
public void testHandleJdbcUrlForSqlServerWithoutParams() throws DdlException {
- String inputUrl = "jdbc:sqlserver://43.129.237.12:1433;databaseName=doris_test";
+ String inputUrl = "jdbc:sqlserver://127.0.0.1:1433;databaseName=doris_test";
String resultUrl = JdbcResource.handleJdbcUrl(inputUrl);
// Ensure that the result URL for SQL Server doesn't have '?' or '&'
@@ -49,7 +190,8 @@ public class JdbcResourceTest {
@Test
public void testHandleJdbcUrlForSqlServerWithParams() throws DdlException {
- String inputUrl = "jdbc:sqlserver://43.129.237.12:1433;encrypt=false;databaseName=doris_test;trustServerCertificate=false";
+ String inputUrl
+ = "jdbc:sqlserver://127.0.0.1:1433;encrypt=false;databaseName=doris_test;trustServerCertificate=false";
String resultUrl = JdbcResource.handleJdbcUrl(inputUrl);
// Ensure that the result URL for SQL Server doesn't have '?' or '&'
diff --git a/fe/fe-core/src/test/java/org/apache/doris/datasource/jdbc/JdbcExternalCatalogTest.java b/fe/fe-core/src/test/java/org/apache/doris/datasource/jdbc/JdbcExternalCatalogTest.java
index 0f2977a9886..7bc268b6421 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/datasource/jdbc/JdbcExternalCatalogTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/datasource/jdbc/JdbcExternalCatalogTest.java
@@ -20,10 +20,12 @@ package org.apache.doris.datasource.jdbc;
import org.apache.doris.catalog.JdbcResource;
import org.apache.doris.common.DdlException;
import org.apache.doris.common.FeConstants;
+import org.apache.doris.datasource.CatalogFactory;
+import com.google.common.collect.Maps;
import org.junit.Assert;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
+import org.junit.Before;
+import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
@@ -31,32 +33,53 @@ import java.util.Map;
public class JdbcExternalCatalogTest {
private JdbcExternalCatalog jdbcExternalCatalog;
- @BeforeEach
+ @Before
public void setUp() throws DdlException {
FeConstants.runningUnitTest = true;
Map<String, String> properties = new HashMap<>();
+ properties.put("type", "jdbc");
properties.put(JdbcResource.DRIVER_URL, "ojdbc8.jar");
properties.put(JdbcResource.JDBC_URL, "jdbc:oracle:thin:@127.0.0.1:1521:XE");
properties.put(JdbcResource.DRIVER_CLASS, "oracle.jdbc.driver.OracleDriver");
- jdbcExternalCatalog = new JdbcExternalCatalog(1L, "testCatalog", "testResource", properties, "testComment");
+ jdbcExternalCatalog = new JdbcExternalCatalog(1L, "testCatalog", null, properties, "testComment");
}
@Test
- public void setDefaultPropsWhenCreatingTest() {
+ public void replayJdbcCatalogTest() throws DdlException {
+ jdbcExternalCatalog.getCatalogProperty().addProperty(JdbcResource.CONNECTION_POOL_MIN_SIZE, "1");
+ JdbcExternalCatalog replayJdbcCatalog = (JdbcExternalCatalog) CatalogFactory.createFromLog(
+ jdbcExternalCatalog.constructEditLog());
+ Map<String, String> properties = replayJdbcCatalog.getProperties();
+ Assert.assertEquals("1", properties.get("connection_pool_min_size"));
+ Map<String, String> newProperties = Maps.newHashMap();
+ newProperties.put(JdbcResource.CONNECTION_POOL_MIN_SIZE, "2");
+ jdbcExternalCatalog.getCatalogProperty().modifyCatalogProps(newProperties);
+ JdbcExternalCatalog replayJdbcCatalog2 = (JdbcExternalCatalog) CatalogFactory.createFromLog(
+ jdbcExternalCatalog.constructEditLog());
+ Map<String, String> properties2 = replayJdbcCatalog2.getProperties();
+ Assert.assertEquals("2", properties2.get("connection_pool_min_size"));
+ }
+
+ @Test
+ public void checkPropertiesTest() {
jdbcExternalCatalog.getCatalogProperty().addProperty(JdbcResource.ONLY_SPECIFIED_DATABASE, "1");
- Exception exception1 = Assert.assertThrows(DdlException.class, () -> jdbcExternalCatalog.setDefaultPropsWhenCreating(false));
- Assert.assertEquals("errCode = 2, detailMessage = only_specified_database must be true or false", exception1.getMessage());
+ Exception exception1 = Assert.assertThrows(DdlException.class, () -> jdbcExternalCatalog.checkProperties());
+ Assert.assertEquals("errCode = 2, detailMessage = only_specified_database must be true or false",
+ exception1.getMessage());
jdbcExternalCatalog.getCatalogProperty().addProperty(JdbcResource.ONLY_SPECIFIED_DATABASE, "true");
jdbcExternalCatalog.getCatalogProperty().addProperty(JdbcResource.LOWER_CASE_TABLE_NAMES, "1");
- Exception exception2 = Assert.assertThrows(DdlException.class, () -> jdbcExternalCatalog.setDefaultPropsWhenCreating(false));
- Assert.assertEquals("errCode = 2, detailMessage = lower_case_table_names must be true or false", exception2.getMessage());
+ Exception exception2 = Assert.assertThrows(DdlException.class, () -> jdbcExternalCatalog.checkProperties());
+ Assert.assertEquals("errCode = 2, detailMessage = lower_case_table_names must be true or false",
+ exception2.getMessage());
jdbcExternalCatalog.getCatalogProperty().addProperty(JdbcResource.ONLY_SPECIFIED_DATABASE, "false");
jdbcExternalCatalog.getCatalogProperty().addProperty(JdbcResource.LOWER_CASE_TABLE_NAMES, "false");
jdbcExternalCatalog.getCatalogProperty().addProperty(JdbcResource.INCLUDE_DATABASE_LIST, "db1,db2");
- DdlException exceptione3 = Assert.assertThrows(DdlException.class, () -> jdbcExternalCatalog.setDefaultPropsWhenCreating(false));
- Assert.assertEquals("errCode = 2, detailMessage = include_database_list and exclude_database_list can not be set when only_specified_database is false", exceptione3.getMessage());
+ DdlException exceptione3 = Assert.assertThrows(DdlException.class, () -> jdbcExternalCatalog.checkProperties());
+ Assert.assertEquals(
+ "errCode = 2, detailMessage = include_database_list and exclude_database_list cannot be set when only_specified_database is false",
+ exceptione3.getMessage());
}
}
diff --git a/fe/pom.xml b/fe/pom.xml
index f64538fecba..9561f27fe71 100644
--- a/fe/pom.xml
+++ b/fe/pom.xml
@@ -251,7 +251,7 @@ under the License.
<commons-io.version>2.7</commons-io.version>
<json-simple.version>1.1.1</json-simple.version>
<junit.version>5.8.2</junit.version>
- <druid.version>1.2.5</druid.version>
+ <druid.version>1.2.20</druid.version>
<clickhouse.version>0.4.6</clickhouse.version>
<thrift.version>0.16.0</thrift.version>
<tomcat-embed-core.version>8.5.86</tomcat-embed-core.version>
diff --git a/gensrc/thrift/Descriptors.thrift b/gensrc/thrift/Descriptors.thrift
index 16a37d1393a..c720a402dd4 100644
--- a/gensrc/thrift/Descriptors.thrift
+++ b/gensrc/thrift/Descriptors.thrift
@@ -324,11 +324,12 @@ struct TJdbcTable {
6: optional string jdbc_resource_name
7: optional string jdbc_driver_class
8: optional string jdbc_driver_checksum
- 9: optional i32 jdbc_min_pool_size
- 10: optional i32 jdbc_max_pool_size
- 11: optional i32 jdbc_max_idle_time
- 12: optional i32 jdbc_max_wait_time
- 13: optional bool jdbc_keep_alive
+ 9: optional i32 connection_pool_min_size
+ 10: optional i32 connection_pool_max_size
+ 11: optional i32 connection_pool_max_wait_time
+ 12: optional i32 connection_pool_max_life_time
+ 13: optional bool connection_pool_keep_alive
+ 14: optional i64 catalog_id
}
struct TMCTable {
diff --git a/gensrc/thrift/Types.thrift b/gensrc/thrift/Types.thrift
index df9bac013a9..e3b48c66b87 100644
--- a/gensrc/thrift/Types.thrift
+++ b/gensrc/thrift/Types.thrift
@@ -425,11 +425,13 @@ struct TJdbcExecutorCtorParams {
9: optional TOdbcTableType table_type
- 10: optional i32 min_pool_size
- 11: optional i32 max_pool_size
- 12: optional i32 max_idle_time
- 13: optional i32 max_wait_time
- 14: optional bool keep_alive
+ 10: optional i32 connection_pool_min_size
+ 11: optional i32 connection_pool_max_size
+ 12: optional i32 connection_pool_max_wait_time
+ 13: optional i32 connection_pool_max_life_time
+ 14: optional i32 connection_pool_cache_clear_time
+ 15: optional bool connection_pool_keep_alive
+ 16: optional i64 catalog_id
}
struct TJavaUdfExecutorCtorParams {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 15/24: [enhancement](Nereids): datetime support microsecond overflow (#30744)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 8a0ea4b6515c06e54816e2b58f866dae6cffab6d
Author: jakevin <ja...@gmail.com>
AuthorDate: Fri Feb 2 23:05:52 2024 +0800
[enhancement](Nereids): datetime support microsecond overflow (#30744)
---
.../trees/expressions/literal/DateLiteral.java | 14 +++++----
.../trees/expressions/literal/DateTimeLiteral.java | 16 +++++++++-
.../expressions/literal/DateTimeV2Literal.java | 9 ++++--
.../apache/doris/nereids/types/DateTimeV2Type.java | 5 +++-
.../doris/nereids/util/DateTimeFormatterUtils.java | 5 ++--
.../rules/SimplifyComparisonPredicateSqlTest.java | 9 ------
.../trees/expressions/literal/DateLiteralTest.java | 10 +------
.../expressions/literal/DateTimeLiteralTest.java | 34 ++++++++++++++++++----
.../nereids/util/DateTimeFormatterUtilsTest.java | 4 +--
.../data/nereids_syntax_p0/test_literal.out | 22 ++++++++++++++
.../suites/nereids_syntax_p0/test_literal.groovy | 28 ++++++++++++++++++
11 files changed, 120 insertions(+), 36 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateLiteral.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateLiteral.java
index 955522c9797..c0c1b18488f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateLiteral.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateLiteral.java
@@ -183,9 +183,9 @@ public class DateLiteral extends Literal {
// normalize leading 0 for date and time
// date and time contains 6 number part at most, so we just need normal 6 number part
int partNumber = 0;
- while (i < s.length()) {
+ while (i < s.length() && partNumber < 6) {
char c = s.charAt(i);
- if (Character.isDigit(c) && partNumber < 6) {
+ if (Character.isDigit(c)) {
// find consecutive digit
int j = i + 1;
while (j < s.length() && Character.isDigit(s.charAt(j))) {
@@ -234,11 +234,14 @@ public class DateLiteral extends Literal {
}
// parse MicroSecond
+ // Keep up to 7 digits at most, 7th digit is use for overflow.
if (partNumber == 6 && i < s.length() && s.charAt(i) == '.') {
sb.append(s.charAt(i));
i += 1;
while (i < s.length() && Character.isDigit(s.charAt(i))) {
- sb.append(s.charAt(i));
+ if (i - 19 <= 7) {
+ sb.append(s.charAt(i));
+ }
i += 1;
}
}
@@ -266,11 +269,12 @@ public class DateLiteral extends Literal {
try {
TemporalAccessor dateTime;
- // remove suffix ' '
+ // remove suffix/prefix ' '
s = s.trim();
// parse condition without '-' and ':'
boolean containsPunctuation = false;
- for (int i = 0; i < s.length(); i++) {
+ int len = Math.min(s.length(), 11);
+ for (int i = 0; i < len; i++) {
if (isPunctuation(s.charAt(i))) {
containsPunctuation = true;
break;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateTimeLiteral.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateTimeLiteral.java
index 36131db238f..3f96ef52e68 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateTimeLiteral.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateTimeLiteral.java
@@ -136,7 +136,6 @@ public class DateTimeLiteral extends DateLiteral {
hour = DateUtils.getOrDefault(temporal, ChronoField.HOUR_OF_DAY);
minute = DateUtils.getOrDefault(temporal, ChronoField.MINUTE_OF_HOUR);
second = DateUtils.getOrDefault(temporal, ChronoField.SECOND_OF_MINUTE);
- microSecond = DateUtils.getOrDefault(temporal, ChronoField.MICRO_OF_SECOND);
ZoneId zoneId = temporal.query(TemporalQueries.zone());
if (zoneId != null) {
@@ -153,6 +152,21 @@ public class DateTimeLiteral extends DateLiteral {
}
}
+ microSecond = DateUtils.getOrDefault(temporal, ChronoField.NANO_OF_SECOND) / 100L;
+ // Microseconds have 7 digits.
+ long sevenDigit = microSecond % 10;
+ microSecond = microSecond / 10;
+ if (sevenDigit >= 5 && this instanceof DateTimeV2Literal) {
+ DateTimeV2Literal result = (DateTimeV2Literal) ((DateTimeV2Literal) this).plusMicroSeconds(1);
+ this.second = result.second;
+ this.minute = result.minute;
+ this.hour = result.hour;
+ this.day = result.day;
+ this.month = result.month;
+ this.year = result.year;
+ this.microSecond = result.microSecond;
+ }
+
if (checkRange() || checkDate()) {
throw new AnalysisException("datetime literal [" + s + "] is out of range");
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateTimeV2Literal.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateTimeV2Literal.java
index 069e53f1416..061666c681f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateTimeV2Literal.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateTimeV2Literal.java
@@ -66,7 +66,7 @@ public class DateTimeV2Literal extends DateTimeLiteral {
if (this.microSecond >= 1000000) {
LocalDateTime localDateTime = DateUtils.getTime(StandardDateFormat.DATE_TIME_FORMATTER_TO_MICRO_SECOND,
- getStringValue()).plusSeconds(1);
+ getStringValue()).plusSeconds(1);
this.year = localDateTime.getYear();
this.month = localDateTime.getMonthValue();
this.day = localDateTime.getDayOfMonth();
@@ -77,6 +77,11 @@ public class DateTimeV2Literal extends DateTimeLiteral {
}
}
+ public String getFullMicroSecondValue() {
+ return String.format("%04d-%02d-%02d %02d:%02d:%02d.%06d",
+ year, month, day, hour, minute, second, microSecond);
+ }
+
@Override
public DateTimeV2Type getDataType() throws UnboundException {
return (DateTimeV2Type) super.getDataType();
@@ -165,7 +170,7 @@ public class DateTimeV2Literal extends DateTimeLiteral {
public Expression plusMicroSeconds(long microSeconds) {
return fromJavaDateType(
- DateUtils.getTime(StandardDateFormat.DATE_TIME_FORMATTER_TO_MICRO_SECOND, getStringValue())
+ DateUtils.getTime(StandardDateFormat.DATE_TIME_FORMATTER_TO_MICRO_SECOND, getFullMicroSecondValue())
.plusNanos(microSeconds * 1000L), getDataType().getScale());
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DateTimeV2Type.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DateTimeV2Type.java
index b804815eb6c..94de55aea61 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DateTimeV2Type.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DateTimeV2Type.java
@@ -84,10 +84,13 @@ public class DateTimeV2Type extends DateLikeType {
/**
* return proper type of datetimev2 for String
- * may be we need to check for validity?
+ * maybe we need to check for validity?
*/
public static DateTimeV2Type forTypeFromString(String s) {
int scale = DateTimeLiteral.determineScale(s);
+ if (scale > MAX_SCALE) {
+ scale = MAX_SCALE;
+ }
return DateTimeV2Type.of(scale);
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/util/DateTimeFormatterUtils.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/util/DateTimeFormatterUtils.java
index e88aabc018b..50d0f7169a5 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/util/DateTimeFormatterUtils.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/util/DateTimeFormatterUtils.java
@@ -56,8 +56,9 @@ public class DateTimeFormatterUtils {
.appendValue(ChronoField.HOUR_OF_DAY, 2)
.appendLiteral(':').appendValue(ChronoField.MINUTE_OF_HOUR, 2)
.appendLiteral(':').appendValue(ChronoField.SECOND_OF_MINUTE, 2)
+ // microsecond maxWidth is 7, we may need 7th digit to judge overflow
.appendOptional(new DateTimeFormatterBuilder()
- .appendFraction(ChronoField.MICRO_OF_SECOND, 1, 6, true).toFormatter())
+ .appendFraction(ChronoField.NANO_OF_SECOND, 1, 7, true).toFormatter())
.toFormatter().withResolverStyle(ResolverStyle.STRICT);
// Time without delimiter: HHmmss[.microsecond]
private static final DateTimeFormatter BASIC_TIME_FORMATTER = new DateTimeFormatterBuilder()
@@ -65,7 +66,7 @@ public class DateTimeFormatterUtils {
.appendValue(ChronoField.MINUTE_OF_HOUR, 2)
.appendValue(ChronoField.SECOND_OF_MINUTE, 2)
.appendOptional(new DateTimeFormatterBuilder()
- .appendFraction(ChronoField.MICRO_OF_SECOND, 1, 6, true).toFormatter())
+ .appendFraction(ChronoField.NANO_OF_SECOND, 1, 7, true).toFormatter())
.toFormatter().withResolverStyle(ResolverStyle.STRICT);
// yyyymmdd
private static final DateTimeFormatter BASIC_DATE_FORMATTER = new DateTimeFormatterBuilder()
diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicateSqlTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicateSqlTest.java
index ad384942a1e..517b4828798 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicateSqlTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicateSqlTest.java
@@ -116,15 +116,6 @@ class SimplifyComparisonPredicateSqlTest extends TestWithFeService implements Me
)
);
- PlanChecker.from(connectContext)
- .analyze("select CONVERT('2021-01-30 00:00:00.0000001', DATETIME(6))")
- .rewrite()
- .matches(
- logicalResultSink(
- logicalOneRowRelation().when(p -> p.getProjects().get(0).child(0).equals(new NullLiteral(DateTimeV2Type.of(6))))
- )
- );
-
PlanChecker.from(connectContext)
.analyze("select CONVERT_TZ('2021-01-32 00:00:00', '+08:00', 'America/London') = '2021-01-30'")
.rewrite()
diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/literal/DateLiteralTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/literal/DateLiteralTest.java
index 4212d892760..3430676b14d 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/literal/DateLiteralTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/literal/DateLiteralTest.java
@@ -28,14 +28,6 @@ import java.util.function.Consumer;
class DateLiteralTest {
@Test
void reject() {
- // TODO: reject them.
- // Now parse them as date + offset.
- // PG parse them as date + offset, MySQL parse them as date + time (rubbish behavior!)
- // So strange! reject these strange case.
- // Assertions.assertThrows(AnalysisException.class, () -> new DateLiteral("2022-01-01-01"));
- // Assertions.assertThrows(AnalysisException.class, () -> new DateLiteral("2022-01-01-1"));
- // Assertions.assertThrows(AnalysisException.class, () -> new DateLiteral("2022-01-01+01"));
- // Assertions.assertThrows(AnalysisException.class, () -> new DateLiteral("2022-01-01+1"));
Assertions.assertThrows(AnalysisException.class, () -> new DateLiteral("2022-01-01 01:00:00.000000"));
Assertions.assertThrows(AnalysisException.class, () -> new DateLiteral("2022-01-01 00:01:00.000000"));
Assertions.assertThrows(AnalysisException.class, () -> new DateLiteral("2022-01-01 00:00:01.000000"));
@@ -212,7 +204,7 @@ class DateLiteralTest {
new DateLiteral("2020.02.01 00.00.00");
new DateTimeV2Literal("2020.02.01 00.00.00.1");
new DateTimeV2Literal("2020.02.01 00.00.00.000001");
- Assertions.assertThrows(AnalysisException.class, () -> new DateTimeV2Literal("2020.02.01 00.00.00.0000001"));
+ new DateTimeV2Literal("2020.02.01 00.00.00.0000001");
}
@Test
diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/literal/DateTimeLiteralTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/literal/DateTimeLiteralTest.java
index 3cfaf485bf6..8c636e9eca4 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/literal/DateTimeLiteralTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/literal/DateTimeLiteralTest.java
@@ -41,13 +41,14 @@ class DateTimeLiteralTest {
Assertions.assertEquals(1, datetime.day);
Assertions.assertEquals(1, datetime.hour);
Assertions.assertEquals(1, datetime.minute);
- Assertions.assertEquals(1, datetime.second);
+ Assertions.assertEquals(2, datetime.second);
};
- assertFunc.accept(new DateTimeV2Literal("20220801010101"));
- assertFunc.accept(new DateTimeV2Literal("20220801T010101"));
- assertFunc.accept(new DateTimeV2Literal("220801010101"));
- assertFunc.accept(new DateTimeV2Literal("220801T010101"));
+ assertFunc.accept(new DateTimeV2Literal("20220801010102"));
+ assertFunc.accept(new DateTimeV2Literal("20220801T010102"));
+ assertFunc.accept(new DateTimeV2Literal("220801010102"));
+ assertFunc.accept(new DateTimeV2Literal("220801T010102"));
+ assertFunc.accept(new DateTimeV2Literal("20220801010101.9999999"));
}
@Test
@@ -386,6 +387,29 @@ class DateTimeLiteralTest {
// Testing with microsecond of length 6
new DateTimeV2Literal("2016-07-02 01:01:01.123456");
new DateTimeV2Literal("2016-7-02 01:01:01.123456");
+
+ // Testing with microsecond of length 7
+ DateTimeV2Literal literal = new DateTimeV2Literal("2016-07-02 01:01:01.12345678");
+ Assertions.assertEquals(123457, literal.microSecond);
+
+ literal = new DateTimeV2Literal("2016-07-02 01:01:01.44444444");
+ Assertions.assertEquals(444444, literal.microSecond);
+
+ literal = new DateTimeV2Literal("2016-07-02 01:01:01.44444445");
+ Assertions.assertEquals(444444, literal.microSecond);
+
+ literal = new DateTimeV2Literal("2016-07-02 01:01:01.4444445");
+ Assertions.assertEquals(444445, literal.microSecond);
+
+ literal = new DateTimeV2Literal("2016-07-02 01:01:01.9999995");
+ Assertions.assertEquals(0, literal.microSecond);
+ Assertions.assertEquals(2, literal.second);
+
+ literal = new DateTimeV2Literal("2021-01-01 23:59:59.9999995");
+ Assertions.assertEquals(0, literal.microSecond);
+ Assertions.assertEquals(0, literal.second);
+ Assertions.assertEquals(0, literal.minute);
+ Assertions.assertEquals(0, literal.hour);
}
@Test
diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/util/DateTimeFormatterUtilsTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/util/DateTimeFormatterUtilsTest.java
index 853c8e11b41..8437fdb0092 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/nereids/util/DateTimeFormatterUtilsTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/util/DateTimeFormatterUtilsTest.java
@@ -70,6 +70,8 @@ class DateTimeFormatterUtilsTest {
assertDatePart(dateTime);
dateTime = formatter.parse("20200219T010101.1");
assertDatePart(dateTime);
+ dateTime = formatter.parse("20200219T010101.0000001");
+ assertDatePart(dateTime);
// failed case
DateTimeFormatter withT = DateTimeFormatterUtils.BASIC_DATE_TIME_FORMATTER;
@@ -77,11 +79,9 @@ class DateTimeFormatterUtilsTest {
Assertions.assertThrows(DateTimeParseException.class, () -> withT.parse("20200219010101."));
Assertions.assertThrows(DateTimeParseException.class, () -> withT.parse("20200219010101.0000001"));
Assertions.assertThrows(DateTimeParseException.class, () -> withT.parse("20200219T010101."));
- Assertions.assertThrows(DateTimeParseException.class, () -> withT.parse("20200219T010101.0000001"));
DateTimeFormatter withoutT = DateTimeFormatterUtils.BASIC_FORMATTER_WITHOUT_T;
Assertions.assertThrows(DateTimeParseException.class, () -> withoutT.parse("20200219 010101"));
Assertions.assertThrows(DateTimeParseException.class, () -> withoutT.parse("20200219010101."));
- Assertions.assertThrows(DateTimeParseException.class, () -> withoutT.parse("20200219010101.0000001"));
Assertions.assertThrows(DateTimeParseException.class, () -> withoutT.parse("20200219T010101."));
Assertions.assertThrows(DateTimeParseException.class, () -> withoutT.parse("20200219T010101.0000001"));
}
diff --git a/regression-test/data/nereids_syntax_p0/test_literal.out b/regression-test/data/nereids_syntax_p0/test_literal.out
new file mode 100644
index 00000000000..eb56075f6b2
--- /dev/null
+++ b/regression-test/data/nereids_syntax_p0/test_literal.out
@@ -0,0 +1,22 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !date1 --
+2016-07-03
+
+-- !date2 --
+2016-07-03
+
+-- !datetime1 --
+2016-07-02T23:59:59.990
+
+-- !datetime2 --
+2016-07-03T00:00
+
+-- !datetime3 --
+2016-07-03T00:00
+
+-- !datetime4 --
+2020-02-19T01:01:01
+
+-- !datetime5 --
+2021-01-30T00:00
+
diff --git a/regression-test/suites/nereids_syntax_p0/test_literal.groovy b/regression-test/suites/nereids_syntax_p0/test_literal.groovy
index d3ed7d44098..340c254fdc8 100644
--- a/regression-test/suites/nereids_syntax_p0/test_literal.groovy
+++ b/regression-test/suites/nereids_syntax_p0/test_literal.groovy
@@ -24,4 +24,32 @@ suite("test_literal") {
sql """
select {}, [], [[[null]], [[1, 2, 3]]], {1:[null], 3:[3]};
"""
+
+ qt_date1 """
+ select cast('20160702235959.9999999' as date);
+ """
+
+ qt_date2 """
+ select cast('2016-07-02 23:59:59.9999999' as date);
+ """
+
+ qt_datetime1 """
+ select timestamp'2016-07-02 23:59:59.99';
+ """
+
+ qt_datetime2 """
+ select cast('20160702235959.9999999' as datetime);
+ """
+
+ qt_datetime3 """
+ select cast('2016-07-02 23:59:59.9999999' as datetime);
+ """
+
+ qt_datetime4 """
+ select timestamp'20200219010101.0000001';
+ """
+
+ qt_datetime5 """
+ select CONVERT('2021-01-30 00:00:00.0000001', DATETIME(6))
+ """
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 14/24: [test](Nereids): add push_down_distinct_through_join regression test (#30760)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 151735748bf86566fd9dd171dfb2a37f7f894d30
Author: jakevin <ja...@gmail.com>
AuthorDate: Fri Feb 2 23:04:22 2024 +0800
[test](Nereids): add push_down_distinct_through_join regression test (#30760)
---
.../push_down_distinct_through_join.out | 42 +++++++++++++
.../push_down_distinct_through_join.groovy | 70 ++++++++++++++++++++++
2 files changed, 112 insertions(+)
diff --git a/regression-test/data/nereids_rules_p0/push_down_distinct_through_join/push_down_distinct_through_join.out b/regression-test/data/nereids_rules_p0/push_down_distinct_through_join/push_down_distinct_through_join.out
new file mode 100644
index 00000000000..1e6ea0878c7
--- /dev/null
+++ b/regression-test/data/nereids_rules_p0/push_down_distinct_through_join/push_down_distinct_through_join.out
@@ -0,0 +1,42 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !basic_not --
+PhysicalResultSink
+--hashAgg[LOCAL]
+----hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=()
+------PhysicalOlapScan[t]
+------PhysicalOlapScan[t]
+
+-- !basic --
+PhysicalResultSink
+--hashAgg[LOCAL]
+----hashJoin[INNER_JOIN] hashCondition=((t1.id = t3.id)) otherCondition=()
+------hashAgg[LOCAL]
+--------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=()
+----------PhysicalOlapScan[t]
+----------PhysicalOlapScan[t]
+------PhysicalOlapScan[t]
+
+-- !basic_sql --
+1
+10
+2
+3
+4
+5
+6
+7
+8
+9
+
+-- !basic_sql_disable --
+1
+10
+2
+3
+4
+5
+6
+7
+8
+9
+
diff --git a/regression-test/suites/nereids_rules_p0/push_down_distinct_through_join/push_down_distinct_through_join.groovy b/regression-test/suites/nereids_rules_p0/push_down_distinct_through_join/push_down_distinct_through_join.groovy
new file mode 100644
index 00000000000..1903f99e7a2
--- /dev/null
+++ b/regression-test/suites/nereids_rules_p0/push_down_distinct_through_join/push_down_distinct_through_join.groovy
@@ -0,0 +1,70 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("push_down_distinct_through_join") {
+ sql "SET enable_nereids_planner=true"
+ sql "set runtime_filter_mode=OFF"
+ sql "SET enable_fallback_to_original_planner=false"
+ sql "SET ignore_shape_nodes='PhysicalDistribute,PhysicalProject'"
+ sql "SET disable_join_reorder=true"
+
+ sql """
+ DROP TABLE IF EXISTS t;
+ """
+
+ sql """
+ CREATE TABLE IF NOT EXISTS t(
+ `id` int(32),
+ `score` int(64) NULL,
+ `name` varchar(64) NULL
+ ) ENGINE = OLAP
+ DISTRIBUTED BY HASH(id) BUCKETS 4
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1"
+ );
+ """
+
+ sql "insert into t values (1, 1, 'a')"
+ sql "insert into t values (2, null, 'a')"
+ sql "insert into t values (3, 1, null)"
+ sql "insert into t values (4, 2, 'b')"
+ sql "insert into t values (5, null, 'b')"
+ sql "insert into t values (6, 2, null)"
+ sql "insert into t values (7, 3, 'c')"
+ sql "insert into t values (8, null, 'c')"
+ sql "insert into t values (9, 3, null)"
+ sql "insert into t values (10, null, null)"
+
+ sql "SET ENABLE_NEREIDS_RULES=push_down_distinct_through_join"
+
+ qt_basic_not """
+ explain shape plan select distinct * from (select t1.id from t t1 join t t2 on t1.id = t2.id) t;
+ """
+
+ qt_basic """
+ explain shape plan select distinct * from (select t1.id from t t1 join t t2 on t1.id = t2.id join t t3 on t1.id = t3.id) t;
+ """
+
+ order_qt_basic_sql """
+ select distinct * from (select t1.id from t t1 join t t2 on t1.id = t2.id join t t3 on t1.id = t3.id) t;
+ """
+
+ sql "SET ENABLE_NEREIDS_RULES=''"
+ order_qt_basic_sql_disable """
+ select distinct * from (select t1.id from t t1 join t t2 on t1.id = t2.id join t t3 on t1.id = t3.id) t;
+ """
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org