You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Benchao Li (Jira)" <ji...@apache.org> on 2022/12/03 12:14:00 UTC
[jira] [Resolved] (CALCITE-5410) Assertion error on PERCENT_REMAINDER operator with DECIMAL type
[ https://issues.apache.org/jira/browse/CALCITE-5410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Benchao Li resolved CALCITE-5410.
---------------------------------
Fix Version/s: 1.33.0
Resolution: Fixed
Fixed via [https://github.com/apache/calcite/commit/33ca193095fcd0db46b88a270bca8d8cd569b31a]
[~alex_pl] thanks for reporting and fixing this.
> 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
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.33.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> 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)