Skip to content

Commit

Permalink
[chore](errmsg) Fix confusing error message and clang tidy hints (apa…
Browse files Browse the repository at this point in the history
  • Loading branch information
zclllyybb authored Apr 19, 2024
1 parent 516fc4a commit 967ce39
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,13 @@ public void analyze(List<ColumnDef> columnDefs, Map<String, String> otherPropert
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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,13 @@ private boolean checkPartitionsTypes() {

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");
Expand Down

0 comments on commit 967ce39

Please sign in to comment.