You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Enter (Jira)" <ji...@apache.org> on 2020/12/22 09:35:00 UTC

[jira] [Created] (FLINK-20715) pyflink DataStream filter error.

Enter created FLINK-20715:
-----------------------------

             Summary: 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


```
 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)