You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Aleksey Plekhanov (Jira)" <ji...@apache.org> on 2022/12/01 07:52:00 UTC
[jira] [Created] (CALCITE-5410) Assertion error on PERCENT_REMAINDER operator with DECIMAL type
Aleksey Plekhanov created CALCITE-5410:
------------------------------------------
Summary: Assertion error on PERCENT_REMAINDER operator with DECIMAL type
Key: CALCITE-5410
URL: https://issues.apache.org/jira/browse/CALCITE-5410
Project: Calcite
Issue Type: Bug
Reporter: Aleksey Plekhanov
Assignee: Aleksey Plekhanov
Queries like:
{code:java}
SELECT 1.0 % 2 {code}
Fail on planning with:
{noformat}
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){noformat}
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.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)