'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?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source