Search code examples
pyflink

udf map function returns a table with unnamed schema


code:

func = udf(log_parser, result_type=DataTypes.ROW(
                                     [DataTypes.FIELD("ts", DataTypes.TIMESTAMP(precision=3)),
                                      DataTypes.FIELD("clientip", DataTypes.STRING()),
                                      DataTypes.FIELD("recordtime", DataTypes.STRING())]))
table = table.map(func)
table.print_schema()

output:

(
  `_c0` TIMESTAMP(3),
  `_c1` STRING,
  `_c2` STRING
)

This looks strange to me, shouldn't it print a schema with defined column names?


Solution

  • This is a known issue and should have be addressed in FLINK-27282. It's fixed recently and so still not released.