[ 
https://issues.apache.org/jira/browse/FLINK-22982?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Flink Jira Bot updated FLINK-22982:
-----------------------------------
    Labels: pull-request-available stale-critical  (was: pull-request-available)

I am the [Flink Jira Bot|https://github.com/apache/flink-jira-bot/] and I help 
the community manage its development. I see this issues has been marked as 
Critical but is unassigned and neither itself nor its Sub-Tasks have been 
updated for 7 days. I have gone ahead and marked it "stale-critical". If this 
ticket is critical, please either assign yourself or give an update. 
Afterwards, please remove the label or in 7 days the issue will be 
deprioritized.


> java.lang.ClassCastException when using Python UDF
> --------------------------------------------------
>
>                 Key: FLINK-22982
>                 URL: https://issues.apache.org/jira/browse/FLINK-22982
>             Project: Flink
>          Issue Type: Bug
>          Components: API / Python
>    Affects Versions: 1.13.1
>            Reporter: Maciej Bryński
>            Priority: Critical
>              Labels: pull-request-available, stale-critical
>             Fix For: 1.14.0, 1.13.2
>
>
> Hi,
> I'm trying to use Python UDF with logical condition as argument.
>  
> {code:java}
> log = logging.getLogger()
> @udf(result_type=DataTypes.BOOLEAN())
> def trace(message, condition):
>     if condition:
>         log.warn(message)
>     return condition
> table_env.create_temporary_function('trace', trace)
> table_env.execute_sql("""
> CREATE TABLE datagen (
>     n int
> ) WITH (
>     'connector' = 'datagen',
>     'number-of-rows' = '10'
> )
> """)
> result = table_env.sql_query("""
> SELECT * 
> FROM datagen
> WHERE trace(n, n < 0)
> """)
> for r in result.execute().collect():
>     print(r){code}
>  
> As a result I'm getting exception:
> {code:java}
> Py4JJavaError: An error occurred while calling o135.execute.
> : java.lang.ClassCastException: class org.apache.calcite.rex.RexInputRef 
> cannot be cast to class org.apache.calcite.rex.RexCall 
> (org.apache.calcite.rex.RexInputRef and org.apache.calcite.rex.RexCall are in 
> unnamed module of loader 'app')
>       at 
> org.apache.flink.table.planner.plan.rules.logical.PythonMapMergeRule.matches(PythonMapMergeRule.java:70)
>       at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:538)
>       at 
> org.apache.calcite.plan.hep.HepPlanner.applyRules(HepPlanner.java:407)
>       at 
> org.apache.calcite.plan.hep.HepPlanner.executeInstruction(HepPlanner.java:243)
>       at 
> org.apache.calcite.plan.hep.HepInstruction$RuleInstance.execute(HepInstruction.java:127)
>       at 
> org.apache.calcite.plan.hep.HepPlanner.executeProgram(HepPlanner.java:202)
>       at 
> org.apache.calcite.plan.hep.HepPlanner.findBestExp(HepPlanner.java:189)
>       at 
> org.apache.flink.table.planner.plan.optimize.program.FlinkHepProgram.optimize(FlinkHepProgram.scala:69)
>       at 
> org.apache.flink.table.planner.plan.optimize.program.FlinkHepRuleSetProgram.optimize(FlinkHepRuleSetProgram.scala:87)
>       at 
> org.apache.flink.table.planner.plan.optimize.program.FlinkChainedProgram$$anonfun$optimize$1.apply(FlinkChainedProgram.scala:62)
>       at 
> org.apache.flink.table.planner.plan.optimize.program.FlinkChainedProgram$$anonfun$optimize$1.apply(FlinkChainedProgram.scala:58)
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to