Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Queries like:
SELECT 1.0 % 2
Fail on planning with:
java.lang.AssertionError: Conversion to relational algebra failed to preserve datatypes: validated type: RecordType(INTEGER NOT NULL EXPR$0) NOT NULL converted type: RecordType(DECIMAL(2, 1) NOT NULL EXPR$0) NOT NULL at org.apache.calcite.sql2rel.SqlToRelConverter.checkConvertedType(SqlToRelConverter.java:494) at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:609) at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:257)
It happens because PERCENT_REMAINDER operator replaced with MOD operator by StandardConvertletTable and these two operators have different return-type inference settings. So, different types are inferenced at SQL validation phase and SqlToRel converter phase.
Attachments
Issue Links
- relates to
-
IGNITE-18274 Exception on modulus operator in SQL
- Resolved
- links to