24
24
import org .apache .doris .catalog .PrimitiveType ;
25
25
import org .apache .doris .common .AnalysisException ;
26
26
import org .apache .doris .common .DdlException ;
27
+ import org .apache .doris .common .util .PropertyAnalyzer ;
27
28
import org .apache .doris .qe .ConnectContext ;
28
29
29
30
import com .google .common .collect .Lists ;
@@ -63,6 +64,13 @@ public void analyze(List<ColumnDef> columnDefs, Map<String, String> otherPropert
63
64
throw new AnalysisException ("No partition columns." );
64
65
}
65
66
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
+ }
66
74
Set <String > partColNames = Sets .newTreeSet (String .CASE_INSENSITIVE_ORDER );
67
75
for (String partitionCol : partitionColNames ) {
68
76
if (!partColNames .add (partitionCol )) {
@@ -72,7 +80,8 @@ public void analyze(List<ColumnDef> columnDefs, Map<String, String> otherPropert
72
80
boolean found = false ;
73
81
for (ColumnDef columnDef : columnDefs ) {
74
82
if (columnDef .getName ().equals (partitionCol )) {
75
- if (!columnDef .isKey () && columnDef .getAggregateType () != AggregateType .NONE ) {
83
+ if (!columnDef .isKey () && (columnDef .getAggregateType () != AggregateType .NONE
84
+ || enableUniqueKeyMergeOnWrite )) {
76
85
throw new AnalysisException ("The partition column could not be aggregated column" );
77
86
}
78
87
if (columnDef .getType ().isFloatingPointType ()) {
0 commit comments