Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

执行pyflink报错 py4j.protocol.Py4JError #24

Open
JTjeff opened this issue Feb 20, 2023 · 0 comments
Open

执行pyflink报错 py4j.protocol.Py4JError #24

JTjeff opened this issue Feb 20, 2023 · 0 comments

Comments

@JTjeff
Copy link

JTjeff commented Feb 20, 2023

py4j.protocol.Py4JError: org.apache.flink.streaming.api.utils.PythonTypeUtils.getCollectionInputFormat does not exist in the JVM

我不知道这种报错到底什么意思,初学者,py文件如下:
from pyflink.common.typeinfo import Types
from pyflink.datastream import StreamExecutionEnvironment

def data_stream_api_demo():
env = StreamExecutionEnvironment.get_execution_environment()
env.set_parallelism(4)
ds = env.from_collection(collection=[(1, 'aaa|bb'), (2, 'bb|a'), (3, 'aaa|a')],type_info=Types.ROW([Types.INT(), Types.STRING()]))
def split(s):
splits = s[1].split("|")
for sp in splits:
yield s[0], sp
ds = ds.map(lambda i: (i[0] + 1, i[1])).flat_map(split).key_by(lambda i: i[1]).reduce(lambda i, j: (i[0] + j[0], i[1]))
ds.print()
env.execute()

if name == 'main':
data_stream_api_demo()

应该是我使用的有问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant