[
https://issues.apache.org/jira/browse/FLINK-26829?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17511542#comment-17511542
]
xuyang commented on FLINK-26829:
--------------------------------
I'll try to fix it
> 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
> 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)