Skip to content

Commit 57e248e

Browse files
authored
[feature-wip](unique-key-merge-on-write) check whether the partition column is a key column when create table for MOW table (#13490)
1 parent 2cf89c5 commit 57e248e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

fe/fe-core/src/main/java/org/apache/doris/analysis/PartitionDesc.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.apache.doris.catalog.PrimitiveType;
2525
import org.apache.doris.common.AnalysisException;
2626
import org.apache.doris.common.DdlException;
27+
import org.apache.doris.common.util.PropertyAnalyzer;
2728
import org.apache.doris.qe.ConnectContext;
2829

2930
import com.google.common.collect.Lists;
@@ -63,6 +64,13 @@ public void analyze(List<ColumnDef> columnDefs, Map<String, String> otherPropert
6364
throw new AnalysisException("No partition columns.");
6465
}
6566

67+
// `analyzeUniqueKeyMergeOnWrite` would modify `properties`, which will be used later,
68+
// so we just clone a properties map here.
69+
boolean enableUniqueKeyMergeOnWrite = false;
70+
if (otherProperties != null) {
71+
enableUniqueKeyMergeOnWrite =
72+
PropertyAnalyzer.analyzeUniqueKeyMergeOnWrite(Maps.newHashMap(otherProperties));
73+
}
6674
Set<String> partColNames = Sets.newTreeSet(String.CASE_INSENSITIVE_ORDER);
6775
for (String partitionCol : partitionColNames) {
6876
if (!partColNames.add(partitionCol)) {
@@ -72,7 +80,8 @@ public void analyze(List<ColumnDef> columnDefs, Map<String, String> otherPropert
7280
boolean found = false;
7381
for (ColumnDef columnDef : columnDefs) {
7482
if (columnDef.getName().equals(partitionCol)) {
75-
if (!columnDef.isKey() && columnDef.getAggregateType() != AggregateType.NONE) {
83+
if (!columnDef.isKey() && (columnDef.getAggregateType() != AggregateType.NONE
84+
|| enableUniqueKeyMergeOnWrite)) {
7685
throw new AnalysisException("The partition column could not be aggregated column");
7786
}
7887
if (columnDef.getType().isFloatingPointType()) {

0 commit comments

Comments
 (0)