[
https://issues.apache.org/jira/browse/FLINK-20715?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Enter closed FLINK-20715.
-------------------------
Resolution: Not A Bug
> pyflink DataStream filter error.
> --------------------------------
>
> Key: FLINK-20715
> URL: https://issues.apache.org/jira/browse/FLINK-20715
> Project: Flink
> Issue Type: Bug
> Components: API / DataStream, API / Python
> Affects Versions: 1.12.0
> Environment: Flink 1.12
> Reporter: Enter
> Priority: Major
> Attachments: image-2020-12-23-09-36-54-530.png
>
>
> ```
> class MyFilterFunction(FilterFunction):
> def filter(self, value):
> return value[0] % 2 == 0
> def demo_stream():
> see = StreamExecutionEnvironment.get_execution_environment()
> see.set_parallelism(1)
> ds = see.from_collection([(1, 'Hi', 'Hello'), (2, 'Hello', 'Hi')],
> type_info=Types.ROW(
> [Types.INT(), Types.STRING(), Types.STRING()])
> )
> ds.filter(MyFilterFunction()).print()
> ds.print()
> # 执行任务;
> see.execute('job1')
> if __name__ == '__main__':
> demo_stream()
> ```
>
> raise Py4JError( raise Py4JError(py4j.protocol.Py4JError: An error
> occurred while calling o0.__getstate__.
> Trace:org.apache.flink.api.python.shaded.py4j.Py4JException: Method
> __getstate__([]) does not exist at
> org.apache.flink.api.python.shaded.py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:318)
> at
> org.apache.flink.api.python.shaded.py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:326)
> at org.apache.flink.api.python.shaded.py4j.Gateway.invoke(Gateway.java:274)
> at
> org.apache.flink.api.python.shaded.py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
> at
> org.apache.flink.api.python.shaded.py4j.commands.CallCommand.execute(CallCommand.java:79)
> at
> org.apache.flink.api.python.shaded.py4j.GatewayConnection.run(GatewayConnection.java:238)
> at java.lang.Thread.run(Thread.java:748)
--
This message was sent by Atlassian Jira
(v8.3.4#803005)