This is an automated email from the ASF dual-hosted git repository.

lihaopeng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 967ce393d2e [chore](errmsg) Fix confusing error message and clang tidy 
hints (#33893)
967ce393d2e is described below

commit 967ce393d2e1ff1f0d11fbaa0438b7bdfc7fb39b
Author: zclllyybb <[email protected]>
AuthorDate: Fri Apr 19 21:25:07 2024 +0800

    [chore](errmsg) Fix confusing error message and clang tidy hints (#33893)
---
 .clang-tidy                                                    |  2 ++
 .../src/main/java/org/apache/doris/analysis/PartitionDesc.java | 10 +++++++---
 .../org/apache/doris/nereids/parser/PartitionTableInfo.java    | 10 +++++++---
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/.clang-tidy b/.clang-tidy
index f572f100cec..1f77a9e3164 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -23,6 +23,8 @@ Checks: |
   -readability-inconsistent-declaration-parameter-name,
   -readability-isolate-declaration,
   -readability-named-parameter,
+  -readability-avoid-const-params-in-decls,
+  -readability-convert-member-functions-to-static,
   portability-simd-intrinsics,
   performance-type-promotion-in-math-fn,
   performance-faster-string-find,
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/PartitionDesc.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/PartitionDesc.java
index 697394b3203..81bec358884 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/PartitionDesc.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/PartitionDesc.java
@@ -185,9 +185,13 @@ public class PartitionDesc {
             boolean found = false;
             for (ColumnDef columnDef : columnDefs) {
                 if (columnDef.getName().equals(partitionCol)) {
-                    if (!columnDef.isKey() && (columnDef.getAggregateType() != 
AggregateType.NONE
-                            || enableUniqueKeyMergeOnWrite)) {
-                        throw new AnalysisException("The partition column 
could not be aggregated column");
+                    if (!columnDef.isKey()) {
+                        if (columnDef.getAggregateType() != 
AggregateType.NONE) {
+                            throw new AnalysisException("The partition column 
could not be aggregated column");
+                        }
+                        if (enableUniqueKeyMergeOnWrite) {
+                            throw new AnalysisException("Merge-on-Write 
table's partition column must be KEY column");
+                        }
                     }
                     if (columnDef.getType().isFloatingPointType()) {
                         throw new AnalysisException("Floating point type 
column can not be partition column");
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/PartitionTableInfo.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/PartitionTableInfo.java
index dee77d5ad85..616b077cb19 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/PartitionTableInfo.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/PartitionTableInfo.java
@@ -121,9 +121,13 @@ public class PartitionTableInfo {
 
     private void validatePartitionColumn(ColumnDefinition column, 
ConnectContext ctx,
                                          boolean isEnableMergeOnWrite, boolean 
isExternal) {
-        if (!column.isKey()
-                && (!column.getAggType().equals(AggregateType.NONE) || 
isEnableMergeOnWrite)) {
-            throw new AnalysisException("The partition column could not be 
aggregated column");
+        if (!column.isKey()) { // value column
+            if (!column.getAggType().equals(AggregateType.NONE)) { // agg 
column
+                throw new AnalysisException("The partition column could not be 
aggregated column");
+            }
+            if (isEnableMergeOnWrite) { // MoW table
+                throw new AnalysisException("Merge-on-Write table's partition 
column must be KEY column");
+            }
         }
         if (column.getType().isFloatLikeType()) {
             throw new AnalysisException("Floating point type column can not be 
partition column");


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to