You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Jiajun Xie (Jira)" <ji...@apache.org> on 2022/10/28 11:43:00 UTC
[jira] [Closed] (CALCITE-3332) Query failed with AssertionError: cannot cast null as class java.math.BigDecimal
[ https://issues.apache.org/jira/browse/CALCITE-3332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jiajun Xie closed CALCITE-3332.
-------------------------------
Fix Version/s: 1.26.0
Resolution: Fixed
> Query failed with AssertionError: cannot cast null as class java.math.BigDecimal
> --------------------------------------------------------------------------------
>
> Key: CALCITE-3332
> URL: https://issues.apache.org/jira/browse/CALCITE-3332
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.21.0
> Reporter: Feng Zhu
> Assignee: Feng Zhu
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.26.0
>
> Time Spent: 2.5h
> Remaining Estimate: 0h
>
> The problem can be reproduced by the following test case in ReflectiveSchemaTest
> {code:java}
> @Test public void testDivideNull() {
> final CalciteAssert.AssertThat with =
> CalciteAssert.that().withSchema("s", CATCHALL);
> with.query("select \"wrapperLong\" / null as c\n"
> + " from \"s\".\"everyTypes\"")
> .runs();
> }{code}
> The stacktrace is
> {code:java}
> java.lang.AssertionError: cannot cast null as class java.math.BigDecimal
> at org.apache.calcite.sql.SqlLiteral.getValueAs(SqlLiteral.java:351)
> at org.apache.calcite.sql.SqlCallBinding.getOperandLiteralValue(SqlCallBinding.java:217)
> at org.apache.calcite.sql.SqlBinaryOperator.getMonotonicity(SqlBinaryOperator.java:190)
> at org.apache.calcite.sql.SqlCall.getMonotonicity(SqlCall.java:182)
> at org.apache.calcite.sql.SqlCallBinding.getOperandMonotonicity(SqlCallBinding.java:188)
> at org.apache.calcite.sql.SqlAsOperator.getMonotonicity(SqlAsOperator.java:139)
> at org.apache.calcite.sql.SqlCall.getMonotonicity(SqlCall.java:182)
> at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectList(SqlToRelConverter.java:3961)
> at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectImpl(SqlToRelConverter.java:670)
> at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:627)
> at org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:3180)
> at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:563)
> .......................................
> {code}
> When SqlBinaryOperator figuring out its {{Monotonicity}}, if the second operand is a Literal, it will cast the literal into BigDecimal. But the {{Null}} Literal is not properly handled.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)