mralfredgui
06/15/2023, 4:09 PMkey_by and reduce operators when locally running pyflink 1.13. Here is the code:
env = StreamExecutionEnvironment.get_execution_environment()
env.set_parallelism(1)
ds = env.from_collection(
collection=[(1, 2), (2, 3), (1, 3), (2, 4)],
type_info=Types.ROW([<http://Types.INT|Types.INT>(), <http://Types.INT|Types.INT>()]))
concat_stream = ds.key_by(lambda x: x[0], key_type=<http://Types.INT|Types.INT>()).reduce(lambda a, b: (a[0], a[1] + b[1]))
concat_stream.print()
env.execute("tutorial_job")
This is the key error message:
AttributeError: 'tuple' object has no attribute 'get_fields_by_names'
is there anything wrong with the code?Dian Fu
06/16/2023, 5:32 AMTypes.ROW to Types.TUPLE as the data is indeed tuple instead of row.Alessio Marinelli
06/16/2023, 7:09 AMDian Fu
06/16/2023, 8:13 AMAlessio Marinelli
06/16/2023, 8:45 AMmralfredgui
06/16/2023, 1:40 PM