From 06551da1fa395ea1e37d518aa6441d685146d74f Mon Sep 17 00:00:00 2001 From: zhangdong <zhangdong@selectdb.com> Date: Mon, 25 Nov 2024 17:29:03 +0800 Subject: [PATCH 1/3] 1 --- .../suites/sql_block_rule_p0/test_sql_block_rule.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regression-test/suites/sql_block_rule_p0/test_sql_block_rule.groovy b/regression-test/suites/sql_block_rule_p0/test_sql_block_rule.groovy index 13b83d272decdb..001c64fbc0d0ad 100644 --- a/regression-test/suites/sql_block_rule_p0/test_sql_block_rule.groovy +++ b/regression-test/suites/sql_block_rule_p0/test_sql_block_rule.groovy @@ -107,7 +107,7 @@ suite("test_sql_block_rule", "nonConcurrent") { PROPERTIES("sql"="SELECT \\\\* FROM table_2", "global"= "true", "enable"= "true") """ - qt_select4_exist """ + order_qt_select4_exist """ SHOW SQL_BLOCK_RULE """ From 7338c3defe9381c6f9cc55aca5478ba6abb853a1 Mon Sep 17 00:00:00 2001 From: zhangdong <zhangdong@selectdb.com> Date: Mon, 25 Nov 2024 18:41:16 +0800 Subject: [PATCH 2/3] 1 --- .../java/org/apache/doris/catalog/OlapTable.java | 14 +++++++++++++- .../doris/datasource/hive/HMSExternalTable.java | 16 ++++++++++++++-- .../datasource/paimon/PaimonExternalTable.java | 6 +++--- .../doris/mtmv/MTMVPartitionExprDateTrunc.java | 3 ++- .../org/apache/doris/mtmv/MTMVPartitionInfo.java | 3 ++- .../org/apache/doris/mtmv/MTMVPartitionUtil.java | 2 +- .../MTMVRelatedPartitionDescRollUpGenerator.java | 3 ++- .../apache/doris/mtmv/MTMVRelatedTableIf.java | 9 ++++++--- .../exploration/mv/MaterializedViewUtils.java | 5 +++-- .../plans/commands/info/CreateMTMVInfo.java | 3 ++- .../commands/info/MTMVPartitionDefinition.java | 3 ++- 11 files changed, 50 insertions(+), 17 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java index 547a520a061e63..8cf203d6816324 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java @@ -1048,7 +1048,6 @@ public PartitionInfo getPartitionInfo() { return partitionInfo; } - @Override public Set<String> getPartitionColumnNames() throws DdlException { Set<String> partitionColumnNames = Sets.newHashSet(); if (partitionInfo instanceof SinglePartitionInfo) { @@ -1066,6 +1065,11 @@ public Set<String> getPartitionColumnNames() throws DdlException { } } + @Override + public Set<String> getPartitionColumnNames(OptionalLong snapshotId) throws DdlException { + return getPartitionColumnNames(); + } + public DistributionInfo getDefaultDistributionInfo() { return defaultDistributionInfo; } @@ -3256,6 +3260,10 @@ public long getVisibleVersionTime() { } @Override + public PartitionType getPartitionType(OptionalLong snapshotId) { + return getPartitionType(); + } + public PartitionType getPartitionType() { return partitionInfo.getType(); } @@ -3280,6 +3288,10 @@ public Map<String, PartitionItem> getAndCopyPartitionItems(OptionalLong snapshot } @Override + public List<Column> getPartitionColumns(OptionalLong snapshotId) { + return getPartitionColumns(); + } + public List<Column> getPartitionColumns() { return getPartitionInfo().getPartitionColumns(); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java index 98984467d75b5c..dfad89bc0b4433 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java @@ -289,7 +289,6 @@ public List<Type> getPartitionColumnTypes() { .orElse(Collections.emptyList()); } - @Override public List<Column> getPartitionColumns() { makeSureInitialized(); Optional<SchemaCacheValue> schemaCacheValue = getSchemaCacheValue(); @@ -297,6 +296,11 @@ public List<Column> getPartitionColumns() { .orElse(Collections.emptyList()); } + @Override + public List<Column> getPartitionColumns(OptionalLong snapshotId) { + return getPartitionColumns(); + } + public SelectedPartitions getAllPartitions() { if (CollectionUtils.isEmpty(this.getPartitionColumns())) { return SelectedPartitions.NOT_PRUNED; @@ -738,16 +742,24 @@ public Set<String> getDistributionColumnNames() { } @Override + public PartitionType getPartitionType(OptionalLong snapshotId) { + return getPartitionType(); + } + public PartitionType getPartitionType() { return getPartitionColumns().size() > 0 ? PartitionType.LIST : PartitionType.UNPARTITIONED; } - @Override public Set<String> getPartitionColumnNames() { return getPartitionColumns().stream() .map(c -> c.getName().toLowerCase()).collect(Collectors.toSet()); } + @Override + public Set<String> getPartitionColumnNames(OptionalLong snapshotId) { + return getPartitionColumnNames(); + } + @Override public Map<String, PartitionItem> getAndCopyPartitionItems(OptionalLong snapshotId) { HiveMetaStoreCache cache = Env.getCurrentEnv().getExtMetaCacheMgr() diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonExternalTable.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonExternalTable.java index 632a0da0ebd316..8f760ad616bbb2 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonExternalTable.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonExternalTable.java @@ -318,18 +318,18 @@ public Map<String, PartitionItem> getAndCopyPartitionItems(OptionalLong snapshot } @Override - public PartitionType getPartitionType() { + public PartitionType getPartitionType(OptionalLong snapshotId) { return getPartitionColumnsFromCache().size() > 0 ? PartitionType.LIST : PartitionType.UNPARTITIONED; } @Override - public Set<String> getPartitionColumnNames() { + public Set<String> getPartitionColumnNames(OptionalLong snapshotId) { return getPartitionColumnsFromCache().stream() .map(c -> c.getName().toLowerCase()).collect(Collectors.toSet()); } @Override - public List<Column> getPartitionColumns() { + public List<Column> getPartitionColumns(OptionalLong snapshotId) { return getPartitionColumnsFromCache(); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionExprDateTrunc.java b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionExprDateTrunc.java index ea15c84d1b925d..e4a0625044ef07 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionExprDateTrunc.java +++ b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionExprDateTrunc.java @@ -44,6 +44,7 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import java.util.OptionalLong; import java.util.Set; public class MTMVPartitionExprDateTrunc implements MTMVPartitionExprService { @@ -69,7 +70,7 @@ public void analyze(MTMVPartitionInfo mvPartitionInfo) throws AnalysisException String.format("timeUnit not support: %s, only support: %s", this.timeUnit, timeUnits)); } MTMVRelatedTableIf relatedTable = mvPartitionInfo.getRelatedTable(); - PartitionType partitionType = relatedTable.getPartitionType(); + PartitionType partitionType = relatedTable.getPartitionType(OptionalLong.empty()); if (partitionType == PartitionType.RANGE) { Type partitionColumnType = MTMVPartitionUtil .getPartitionColumnType(mvPartitionInfo.getRelatedTable(), mvPartitionInfo.getRelatedCol()); diff --git a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionInfo.java b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionInfo.java index b3cd239269abc7..7e4ec9a7393cbf 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionInfo.java +++ b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionInfo.java @@ -25,6 +25,7 @@ import com.google.gson.annotations.SerializedName; import java.util.List; +import java.util.OptionalLong; /** * MTMVPartitionInfo @@ -115,7 +116,7 @@ public int getRelatedColPos() throws AnalysisException { if (partitionType == MTMVPartitionType.SELF_MANAGE) { throw new AnalysisException("partitionType is: " + partitionType); } - List<Column> partitionColumns = getRelatedTable().getPartitionColumns(); + List<Column> partitionColumns = getRelatedTable().getPartitionColumns(OptionalLong.empty()); for (int i = 0; i < partitionColumns.size(); i++) { if (partitionColumns.get(i).getName().equalsIgnoreCase(relatedCol)) { return i; diff --git a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionUtil.java b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionUtil.java index 1bbc51fb004c57..8f9f5974393f31 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionUtil.java +++ b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionUtil.java @@ -504,7 +504,7 @@ private static MTMVRefreshPartitionSnapshot generatePartitionSnapshot(MTMVRefres } public static Type getPartitionColumnType(MTMVRelatedTableIf relatedTable, String col) throws AnalysisException { - List<Column> partitionColumns = relatedTable.getPartitionColumns(); + List<Column> partitionColumns = relatedTable.getPartitionColumns(OptionalLong.empty()); for (Column column : partitionColumns) { if (column.getName().equals(col)) { return column.getType(); diff --git a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelatedPartitionDescRollUpGenerator.java b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelatedPartitionDescRollUpGenerator.java index 76e20ef70f5d92..3863f565cacdbc 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelatedPartitionDescRollUpGenerator.java +++ b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelatedPartitionDescRollUpGenerator.java @@ -31,6 +31,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.OptionalLong; import java.util.Set; /** @@ -45,7 +46,7 @@ public void apply(MTMVPartitionInfo mvPartitionInfo, Map<String, String> mvPrope return; } MTMVRelatedTableIf relatedTable = mvPartitionInfo.getRelatedTable(); - PartitionType partitionType = relatedTable.getPartitionType(); + PartitionType partitionType = relatedTable.getPartitionType(OptionalLong.empty()); if (partitionType == PartitionType.RANGE) { lastResult.setDescs(rollUpRange(lastResult.getDescs(), mvPartitionInfo)); } else if (partitionType == PartitionType.LIST) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelatedTableIf.java b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelatedTableIf.java index e18784ae253a0f..58ff05bc5999da 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelatedTableIf.java +++ b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelatedTableIf.java @@ -47,24 +47,27 @@ public interface MTMVRelatedTableIf extends TableIf { /** * getPartitionType LIST/RANGE/UNPARTITIONED * + * @param snapshotId * @return */ - PartitionType getPartitionType(); + PartitionType getPartitionType(OptionalLong snapshotId); /** * getPartitionColumnNames * + * @param snapshotId * @return * @throws DdlException */ - Set<String> getPartitionColumnNames() throws DdlException; + Set<String> getPartitionColumnNames(OptionalLong snapshotId) throws DdlException; /** * getPartitionColumns * + * @param snapshotId * @return */ - List<Column> getPartitionColumns(); + List<Column> getPartitionColumns(OptionalLong snapshotId); /** * getPartitionSnapshot diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/MaterializedViewUtils.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/MaterializedViewUtils.java index a659c2f9990a3f..e6dc565df5c9f9 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/MaterializedViewUtils.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/MaterializedViewUtils.java @@ -90,6 +90,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.OptionalLong; import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; @@ -481,13 +482,13 @@ public Void visitLogicalRelation(LogicalRelation relation, IncrementCheckerConte return null; } MTMVRelatedTableIf relatedTable = (MTMVRelatedTableIf) table; - PartitionType type = relatedTable.getPartitionType(); + PartitionType type = relatedTable.getPartitionType(OptionalLong.empty()); if (PartitionType.UNPARTITIONED.equals(type)) { context.addFailReason(String.format("related base table is not partition table, the table is %s", table.getName())); return null; } - Set<Column> partitionColumnSet = new HashSet<>(relatedTable.getPartitionColumns()); + Set<Column> partitionColumnSet = new HashSet<>(relatedTable.getPartitionColumns(OptionalLong.empty())); Column mvReferenceColumn = contextPartitionColumn.getColumn().get(); Expr definExpr = mvReferenceColumn.getDefineExpr(); if (definExpr instanceof SlotRef) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateMTMVInfo.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateMTMVInfo.java index de5e188d5a65bf..2149bbf9faae27 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateMTMVInfo.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateMTMVInfo.java @@ -94,6 +94,7 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import java.util.OptionalLong; import java.util.Set; import java.util.TreeMap; import java.util.stream.Collectors; @@ -351,7 +352,7 @@ private PartitionDesc generatePartitionDesc(ConnectContext ctx) { allPartitionDescs.size(), ctx.getSessionVariable().getCreateTablePartitionMaxNum())); } try { - PartitionType type = relatedTable.getPartitionType(); + PartitionType type = relatedTable.getPartitionType(OptionalLong.empty()); if (type == PartitionType.RANGE) { return new RangePartitionDesc(Lists.newArrayList(mvPartitionInfo.getPartitionCol()), allPartitionDescs); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/MTMVPartitionDefinition.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/MTMVPartitionDefinition.java index 427e2368e7ab2b..556399aa6de301 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/MTMVPartitionDefinition.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/MTMVPartitionDefinition.java @@ -54,6 +54,7 @@ import com.google.common.collect.Sets; import java.util.List; +import java.util.OptionalLong; import java.util.Set; import java.util.stream.Collectors; @@ -147,7 +148,7 @@ private RelatedTableInfo getRelatedTableInfo(NereidsPlanner planner, ConnectCont MTMVRelatedTableIf mtmvBaseRealtedTable = MTMVUtil.getRelatedTable(relatedTableInfo.getTableInfo()); Set<String> partitionColumnNames = Sets.newTreeSet(String.CASE_INSENSITIVE_ORDER); try { - partitionColumnNames.addAll(mtmvBaseRealtedTable.getPartitionColumnNames()); + partitionColumnNames.addAll(mtmvBaseRealtedTable.getPartitionColumnNames(OptionalLong.empty())); } catch (DdlException e) { throw new AnalysisException(e.getMessage(), e); } From 495e8a5609b5f8fb48699db3c3f3194c5fdf5cf4 Mon Sep 17 00:00:00 2001 From: zhangdong <zhangdong@selectdb.com> Date: Mon, 25 Nov 2024 18:45:50 +0800 Subject: [PATCH 3/3] Revert "1" This reverts commit 7338c3defe9381c6f9cc55aca5478ba6abb853a1. --- .../java/org/apache/doris/catalog/OlapTable.java | 14 +------------- .../doris/datasource/hive/HMSExternalTable.java | 16 ++-------------- .../datasource/paimon/PaimonExternalTable.java | 6 +++--- .../doris/mtmv/MTMVPartitionExprDateTrunc.java | 3 +-- .../org/apache/doris/mtmv/MTMVPartitionInfo.java | 3 +-- .../org/apache/doris/mtmv/MTMVPartitionUtil.java | 2 +- .../MTMVRelatedPartitionDescRollUpGenerator.java | 3 +-- .../apache/doris/mtmv/MTMVRelatedTableIf.java | 9 +++------ .../exploration/mv/MaterializedViewUtils.java | 5 ++--- .../plans/commands/info/CreateMTMVInfo.java | 3 +-- .../commands/info/MTMVPartitionDefinition.java | 3 +-- 11 files changed, 17 insertions(+), 50 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java index 8cf203d6816324..547a520a061e63 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java @@ -1048,6 +1048,7 @@ public PartitionInfo getPartitionInfo() { return partitionInfo; } + @Override public Set<String> getPartitionColumnNames() throws DdlException { Set<String> partitionColumnNames = Sets.newHashSet(); if (partitionInfo instanceof SinglePartitionInfo) { @@ -1065,11 +1066,6 @@ public Set<String> getPartitionColumnNames() throws DdlException { } } - @Override - public Set<String> getPartitionColumnNames(OptionalLong snapshotId) throws DdlException { - return getPartitionColumnNames(); - } - public DistributionInfo getDefaultDistributionInfo() { return defaultDistributionInfo; } @@ -3260,10 +3256,6 @@ public long getVisibleVersionTime() { } @Override - public PartitionType getPartitionType(OptionalLong snapshotId) { - return getPartitionType(); - } - public PartitionType getPartitionType() { return partitionInfo.getType(); } @@ -3288,10 +3280,6 @@ public Map<String, PartitionItem> getAndCopyPartitionItems(OptionalLong snapshot } @Override - public List<Column> getPartitionColumns(OptionalLong snapshotId) { - return getPartitionColumns(); - } - public List<Column> getPartitionColumns() { return getPartitionInfo().getPartitionColumns(); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java index dfad89bc0b4433..98984467d75b5c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java @@ -289,6 +289,7 @@ public List<Type> getPartitionColumnTypes() { .orElse(Collections.emptyList()); } + @Override public List<Column> getPartitionColumns() { makeSureInitialized(); Optional<SchemaCacheValue> schemaCacheValue = getSchemaCacheValue(); @@ -296,11 +297,6 @@ public List<Column> getPartitionColumns() { .orElse(Collections.emptyList()); } - @Override - public List<Column> getPartitionColumns(OptionalLong snapshotId) { - return getPartitionColumns(); - } - public SelectedPartitions getAllPartitions() { if (CollectionUtils.isEmpty(this.getPartitionColumns())) { return SelectedPartitions.NOT_PRUNED; @@ -742,24 +738,16 @@ public Set<String> getDistributionColumnNames() { } @Override - public PartitionType getPartitionType(OptionalLong snapshotId) { - return getPartitionType(); - } - public PartitionType getPartitionType() { return getPartitionColumns().size() > 0 ? PartitionType.LIST : PartitionType.UNPARTITIONED; } + @Override public Set<String> getPartitionColumnNames() { return getPartitionColumns().stream() .map(c -> c.getName().toLowerCase()).collect(Collectors.toSet()); } - @Override - public Set<String> getPartitionColumnNames(OptionalLong snapshotId) { - return getPartitionColumnNames(); - } - @Override public Map<String, PartitionItem> getAndCopyPartitionItems(OptionalLong snapshotId) { HiveMetaStoreCache cache = Env.getCurrentEnv().getExtMetaCacheMgr() diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonExternalTable.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonExternalTable.java index 8f760ad616bbb2..632a0da0ebd316 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonExternalTable.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonExternalTable.java @@ -318,18 +318,18 @@ public Map<String, PartitionItem> getAndCopyPartitionItems(OptionalLong snapshot } @Override - public PartitionType getPartitionType(OptionalLong snapshotId) { + public PartitionType getPartitionType() { return getPartitionColumnsFromCache().size() > 0 ? PartitionType.LIST : PartitionType.UNPARTITIONED; } @Override - public Set<String> getPartitionColumnNames(OptionalLong snapshotId) { + public Set<String> getPartitionColumnNames() { return getPartitionColumnsFromCache().stream() .map(c -> c.getName().toLowerCase()).collect(Collectors.toSet()); } @Override - public List<Column> getPartitionColumns(OptionalLong snapshotId) { + public List<Column> getPartitionColumns() { return getPartitionColumnsFromCache(); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionExprDateTrunc.java b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionExprDateTrunc.java index e4a0625044ef07..ea15c84d1b925d 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionExprDateTrunc.java +++ b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionExprDateTrunc.java @@ -44,7 +44,6 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; -import java.util.OptionalLong; import java.util.Set; public class MTMVPartitionExprDateTrunc implements MTMVPartitionExprService { @@ -70,7 +69,7 @@ public void analyze(MTMVPartitionInfo mvPartitionInfo) throws AnalysisException String.format("timeUnit not support: %s, only support: %s", this.timeUnit, timeUnits)); } MTMVRelatedTableIf relatedTable = mvPartitionInfo.getRelatedTable(); - PartitionType partitionType = relatedTable.getPartitionType(OptionalLong.empty()); + PartitionType partitionType = relatedTable.getPartitionType(); if (partitionType == PartitionType.RANGE) { Type partitionColumnType = MTMVPartitionUtil .getPartitionColumnType(mvPartitionInfo.getRelatedTable(), mvPartitionInfo.getRelatedCol()); diff --git a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionInfo.java b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionInfo.java index 7e4ec9a7393cbf..b3cd239269abc7 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionInfo.java +++ b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionInfo.java @@ -25,7 +25,6 @@ import com.google.gson.annotations.SerializedName; import java.util.List; -import java.util.OptionalLong; /** * MTMVPartitionInfo @@ -116,7 +115,7 @@ public int getRelatedColPos() throws AnalysisException { if (partitionType == MTMVPartitionType.SELF_MANAGE) { throw new AnalysisException("partitionType is: " + partitionType); } - List<Column> partitionColumns = getRelatedTable().getPartitionColumns(OptionalLong.empty()); + List<Column> partitionColumns = getRelatedTable().getPartitionColumns(); for (int i = 0; i < partitionColumns.size(); i++) { if (partitionColumns.get(i).getName().equalsIgnoreCase(relatedCol)) { return i; diff --git a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionUtil.java b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionUtil.java index 8f9f5974393f31..1bbc51fb004c57 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionUtil.java +++ b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionUtil.java @@ -504,7 +504,7 @@ private static MTMVRefreshPartitionSnapshot generatePartitionSnapshot(MTMVRefres } public static Type getPartitionColumnType(MTMVRelatedTableIf relatedTable, String col) throws AnalysisException { - List<Column> partitionColumns = relatedTable.getPartitionColumns(OptionalLong.empty()); + List<Column> partitionColumns = relatedTable.getPartitionColumns(); for (Column column : partitionColumns) { if (column.getName().equals(col)) { return column.getType(); diff --git a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelatedPartitionDescRollUpGenerator.java b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelatedPartitionDescRollUpGenerator.java index 3863f565cacdbc..76e20ef70f5d92 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelatedPartitionDescRollUpGenerator.java +++ b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelatedPartitionDescRollUpGenerator.java @@ -31,7 +31,6 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.OptionalLong; import java.util.Set; /** @@ -46,7 +45,7 @@ public void apply(MTMVPartitionInfo mvPartitionInfo, Map<String, String> mvPrope return; } MTMVRelatedTableIf relatedTable = mvPartitionInfo.getRelatedTable(); - PartitionType partitionType = relatedTable.getPartitionType(OptionalLong.empty()); + PartitionType partitionType = relatedTable.getPartitionType(); if (partitionType == PartitionType.RANGE) { lastResult.setDescs(rollUpRange(lastResult.getDescs(), mvPartitionInfo)); } else if (partitionType == PartitionType.LIST) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelatedTableIf.java b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelatedTableIf.java index 58ff05bc5999da..e18784ae253a0f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelatedTableIf.java +++ b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelatedTableIf.java @@ -47,27 +47,24 @@ public interface MTMVRelatedTableIf extends TableIf { /** * getPartitionType LIST/RANGE/UNPARTITIONED * - * @param snapshotId * @return */ - PartitionType getPartitionType(OptionalLong snapshotId); + PartitionType getPartitionType(); /** * getPartitionColumnNames * - * @param snapshotId * @return * @throws DdlException */ - Set<String> getPartitionColumnNames(OptionalLong snapshotId) throws DdlException; + Set<String> getPartitionColumnNames() throws DdlException; /** * getPartitionColumns * - * @param snapshotId * @return */ - List<Column> getPartitionColumns(OptionalLong snapshotId); + List<Column> getPartitionColumns(); /** * getPartitionSnapshot diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/MaterializedViewUtils.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/MaterializedViewUtils.java index e6dc565df5c9f9..a659c2f9990a3f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/MaterializedViewUtils.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/MaterializedViewUtils.java @@ -90,7 +90,6 @@ import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.OptionalLong; import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; @@ -482,13 +481,13 @@ public Void visitLogicalRelation(LogicalRelation relation, IncrementCheckerConte return null; } MTMVRelatedTableIf relatedTable = (MTMVRelatedTableIf) table; - PartitionType type = relatedTable.getPartitionType(OptionalLong.empty()); + PartitionType type = relatedTable.getPartitionType(); if (PartitionType.UNPARTITIONED.equals(type)) { context.addFailReason(String.format("related base table is not partition table, the table is %s", table.getName())); return null; } - Set<Column> partitionColumnSet = new HashSet<>(relatedTable.getPartitionColumns(OptionalLong.empty())); + Set<Column> partitionColumnSet = new HashSet<>(relatedTable.getPartitionColumns()); Column mvReferenceColumn = contextPartitionColumn.getColumn().get(); Expr definExpr = mvReferenceColumn.getDefineExpr(); if (definExpr instanceof SlotRef) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateMTMVInfo.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateMTMVInfo.java index 2149bbf9faae27..de5e188d5a65bf 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateMTMVInfo.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateMTMVInfo.java @@ -94,7 +94,6 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; -import java.util.OptionalLong; import java.util.Set; import java.util.TreeMap; import java.util.stream.Collectors; @@ -352,7 +351,7 @@ private PartitionDesc generatePartitionDesc(ConnectContext ctx) { allPartitionDescs.size(), ctx.getSessionVariable().getCreateTablePartitionMaxNum())); } try { - PartitionType type = relatedTable.getPartitionType(OptionalLong.empty()); + PartitionType type = relatedTable.getPartitionType(); if (type == PartitionType.RANGE) { return new RangePartitionDesc(Lists.newArrayList(mvPartitionInfo.getPartitionCol()), allPartitionDescs); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/MTMVPartitionDefinition.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/MTMVPartitionDefinition.java index 556399aa6de301..427e2368e7ab2b 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/MTMVPartitionDefinition.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/MTMVPartitionDefinition.java @@ -54,7 +54,6 @@ import com.google.common.collect.Sets; import java.util.List; -import java.util.OptionalLong; import java.util.Set; import java.util.stream.Collectors; @@ -148,7 +147,7 @@ private RelatedTableInfo getRelatedTableInfo(NereidsPlanner planner, ConnectCont MTMVRelatedTableIf mtmvBaseRealtedTable = MTMVUtil.getRelatedTable(relatedTableInfo.getTableInfo()); Set<String> partitionColumnNames = Sets.newTreeSet(String.CASE_INSENSITIVE_ORDER); try { - partitionColumnNames.addAll(mtmvBaseRealtedTable.getPartitionColumnNames(OptionalLong.empty())); + partitionColumnNames.addAll(mtmvBaseRealtedTable.getPartitionColumnNames()); } catch (DdlException e) { throw new AnalysisException(e.getMessage(), e); }