[chore](errmsg) Fix confusing error message and clang tidy hints (#33893)

This commit is contained in:
zclllyybb
2024-04-19 21:25:07 +08:00
committed by yiguolei
parent 42e91149e4
commit 5bddbcd933
3 changed files with 16 additions and 6 deletions

View File

@ -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,

View File

@ -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");

View File

@ -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");