You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "godfrey he (Jira)" <ji...@apache.org> on 2022/04/12 03:50:00 UTC
[jira] [Assigned] (FLINK-26829) ClassCastException will be thrown when the second operand of divide is a function call
[ https://issues.apache.org/jira/browse/FLINK-26829?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
godfrey he reassigned FLINK-26829:
----------------------------------
Assignee: luoyuxia
> ClassCastException will be thrown when the second operand of divide is a function call
> ---------------------------------------------------------------------------------------
>
> Key: FLINK-26829
> URL: https://issues.apache.org/jira/browse/FLINK-26829
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Planner
> Affects Versions: 1.15.0
> Reporter: luoyuxia
> Assignee: luoyuxia
> Priority: Major
> Fix For: 1.16.0
>
>
> Can be reproduced by add the following code in SqlExpressionTest#testDivideFunctions
> {code:java}
> testExpectedSqlException(
> "1/POWER(5, 5)", divisorZeroException, classOf[ArithmeticException]) {code}
> Then the method ExpressionReducer#skipAndValidateExprs will throw the exception:
> {code:java}
> java.lang.ClassCastException: org.apache.calcite.rex.RexCall cannot be cast to org.apache.calcite.rex.RexLiteral {code}
> The following code will cast the DEVIDE's second op to RexLiteral, but it maybe a function call.
> {code:java}
> // according to BuiltInFunctionDefinitions, the DEVIDE's second op must be numeric
> assert(RexUtil.isDeterministic(divisionLiteral))
> val divisionComparable = {
> divisionLiteral.asInstanceOf[RexLiteral].getValue.asInstanceOf[Comparable[Any]]
> } {code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)