You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Yong (Jira)" <ji...@apache.org> on 2022/12/19 00:58:00 UTC
[jira] [Updated] (FLINK-30448) "filter(Objects::nonNull)" will bring down task with failure cause: ClassCastException
[ https://issues.apache.org/jira/browse/FLINK-30448?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Yong updated FLINK-30448:
-------------------------
Description:
Attached an *all-in-one* java program, which can run locally in DEV environment(e.g. IntelliJ IDEA->run), consuming from elements stream objects, the object schema is a parent containing two childs(Child1 and Child2) fields, I use *side-output* to map and split out two different sub-streams, each for one child. I put '{*}filter(Objects:nonNUll){*}' for each sub-stream to ignore null objects. When comming from stream the parent record {*}containing any one of child is null{*}, the program will bring down the task and produce below error:
......
switched from RUNNING to FAILED with failure cause: java.lang.{*}ClassCastException{*}: mytest.TestSideOutput$Child2 cannot be cast to mytest.TestSideOutput$Child1. Failed to push OutputTag with id 'child2' to operator. This can occur when multiple OutputTags with different types but identical names are being used.
at org.apache.flink.streaming.runtime.tasks.CopyingChainingOutput.pushToOperator(CopyingChainingOutput.java:88)
......
However, if I replace '{*}filter(Objects:nonNull){*}' (at line #71 and #90) with logically equivalent '{*}filter(x->x!=null){*}‘ (at line #70 and #89), everythink will be OK.
was:
Attached an *all-in-one* java program, whick can run locally in DEV environment(e.g. IntelliJ IDEA), consuming from elements stream objects, the object schema is a parent containing two childs, I use *side-output* to map and split out two different sub-streams for each child. I put '{*}filter(Objects:nonNUll){*}' for each sub-stream to ignore null objects. When comming from stream the parent record {*}containing any one of child is null{*}, the program will bring down the task and produce below error:
......
switched from RUNNING to FAILED with failure cause: java.lang.{*}ClassCastException{*}: mytest.TestSideOutput$Child2 cannot be cast to mytest.TestSideOutput$Child1. Failed to push OutputTag with id 'child2' to operator. This can occur when multiple OutputTags with different types but identical names are being used.
at org.apache.flink.streaming.runtime.tasks.CopyingChainingOutput.pushToOperator(CopyingChainingOutput.java:88)
......
However, if I replace '{*}filter(Objects:nonNull){*}' (at line #71 and #90) with equivalent '{*}filter(x->x!=null){*}‘ (at line #70 and #89), everythink will be OK.
> "filter(Objects::nonNull)" will bring down task with failure cause: ClassCastException
> --------------------------------------------------------------------------------------
>
> Key: FLINK-30448
> URL: https://issues.apache.org/jira/browse/FLINK-30448
> Project: Flink
> Issue Type: Bug
> Components: API / DataStream
> Environment: test both on flink 1.15.1 and flink 1.16.0
> Intellij-Idea dev environment run
> Reporter: Yong
> Priority: Major
> Attachments: TestSideOutput.java
>
>
> Attached an *all-in-one* java program, which can run locally in DEV environment(e.g. IntelliJ IDEA->run), consuming from elements stream objects, the object schema is a parent containing two childs(Child1 and Child2) fields, I use *side-output* to map and split out two different sub-streams, each for one child. I put '{*}filter(Objects:nonNUll){*}' for each sub-stream to ignore null objects. When comming from stream the parent record {*}containing any one of child is null{*}, the program will bring down the task and produce below error:
> ......
> switched from RUNNING to FAILED with failure cause: java.lang.{*}ClassCastException{*}: mytest.TestSideOutput$Child2 cannot be cast to mytest.TestSideOutput$Child1. Failed to push OutputTag with id 'child2' to operator. This can occur when multiple OutputTags with different types but identical names are being used.
> at org.apache.flink.streaming.runtime.tasks.CopyingChainingOutput.pushToOperator(CopyingChainingOutput.java:88)
> ......
>
> However, if I replace '{*}filter(Objects:nonNull){*}' (at line #71 and #90) with logically equivalent '{*}filter(x->x!=null){*}‘ (at line #70 and #89), everythink will be OK.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)