Fix throw exception when compare with null #14074
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request primarily focuses on enhancing the handling of
null
values in the query engine and transformation logic, and includes several new test cases to validate these changes. The most important changes include new methods for detectingnull
values in comparisons and calculations, additional imports, and modifications to the transformation logic to handlenull
values correctly.Enhancements for handling
null
values:iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableMetadataImpl.java
: Added methodsisCompareWithNull
andisCalculateWithNull
to handlenull
values in comparisons and calculations. [1] [2]iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableMetadataImpl.java
: ModifiedgetOperatorReturnType
to return appropriate types whennull
values are involved.iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableMetadataImpl.java
: AddedisUnknownType
method to identifynull
values.Additional imports:
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableMetadataImpl.java
: Added imports forEQUAL
,LESS_THAN
,LESS_THAN_OR_EQUAL
, andUNKNOWN
types. [1] [2]Transformation logic adjustments:
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/unary/scalar/AbstractCastFunctionColumnTransformer.java
: Updated transformation methods to handle columns withnull
values properly. [1] [2] [3]New test cases:
integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/IoTDBFilterTableIT.java
: Added test casestestCompareWithNull
andtestCalculateWithNull
to verify the newnull
handling logic.