[ https://issues.apache.org/jira/browse/FLINK-26829?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martijn Visser updated FLINK-26829: ----------------------------------- Fix Version/s: (was: 1.16.0) > 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 > > 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.10#820010)