Skip to content

Commit 5460a26

Browse files
fix: Replace checkArgument with SemanticException for result type validation
1 parent 2534344 commit 5460a26

File tree

1 file changed

+9
-2
lines changed
  • iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner

1 file changed

+9
-2
lines changed

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/IrTypeAnalyzer.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,10 @@ protected Type visitSearchedCaseExpression(SearchedCaseExpression node, Context
241241
})
242242
.collect(Collectors.toSet());
243243

244-
checkArgument(resultTypes.size() == 1, "All result types must be the same: %s", resultTypes);
244+
if (resultTypes.size() != 1) {
245+
throw new SemanticException(
246+
String.format("All result types must be the same: %s", resultTypes));
247+
}
245248
Type resultType = resultTypes.iterator().next();
246249
node.getDefaultValue()
247250
.ifPresent(
@@ -275,7 +278,11 @@ protected Type visitSimpleCaseExpression(SimpleCaseExpression node, Context cont
275278
})
276279
.collect(Collectors.toSet());
277280

278-
checkArgument(resultTypes.size() == 1, "All result types must be the same: %s", resultTypes);
281+
if (resultTypes.size() != 1) {
282+
throw new SemanticException(
283+
String.format("All result types must be the same: %s", resultTypes));
284+
}
285+
279286
Type resultType = resultTypes.iterator().next();
280287
node.getDefaultValue()
281288
.ifPresent(

0 commit comments

Comments
 (0)