FearfulTomcat27 opened a new pull request, #16073:
URL: https://github.com/apache/iotdb/pull/16073

   This pull request refactors the error handling in the `IrTypeAnalyzer` class 
to improve clarity and replace the use of `checkArgument` with explicit 
exception handling. The changes ensure that semantic validation errors are 
consistently reported using `SemanticException`.
   
   ### Refactoring of error handling:
   
   * Replaced `checkArgument` with explicit `if` conditions and 
`SemanticException` for validating that `WHEN` clause operands in 
`SearchedCaseExpression` are of type `BOOLEAN`. 
(`iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/IrTypeAnalyzer.java`,
 
[iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/IrTypeAnalyzer.javaL236-R239](diffhunk://#diff-13930271f6daa99066c9dfe57eb9ba951f2d76eadbefc9523851080ecbaca476L236-R239))
   * Replaced `checkArgument` with explicit `if` conditions and 
`SemanticException` for ensuring the default result type matches the `WHEN` 
result types in `SearchedCaseExpression`. 
(`iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/IrTypeAnalyzer.java`,
 
[iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/IrTypeAnalyzer.javaL253-R258](diffhunk://#diff-13930271f6daa99066c9dfe57eb9ba951f2d76eadbefc9523851080ecbaca476L253-R258))
   * Updated `SimpleCaseExpression` to throw `SemanticException` when `WHEN` 
clause operand types do not match the `CASE` operand type, replacing 
`checkArgument`. 
(`iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/IrTypeAnalyzer.java`,
 
[iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/IrTypeAnalyzer.javaL272-R278](diffhunk://#diff-13930271f6daa99066c9dfe57eb9ba951f2d76eadbefc9523851080ecbaca476L272-R278))
   * Changed the validation of default result types in `SimpleCaseExpression` 
to use `SemanticException` instead of `checkArgument` for type mismatch errors. 
(`iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/IrTypeAnalyzer.java`,
 
[iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/IrTypeAnalyzer.javaL291-R298](diffhunk://#diff-13930271f6daa99066c9dfe57eb9ba951f2d76eadbefc9523851080ecbaca476L291-R298))


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to