PyFlink-UNNEST问题:查询使用了不受支持的SQL功能?

时间:2020-11-01 21:18:46

标签: apache-flink pyflink

我正在尝试使用Table API中的UNNEST函数展平数组。

我做错了什么,或者它不是受支持的功能?该页面建议使用:https://ci.apache.org/projects/flink/flink-docs-master/dev/table/sql/queries.html

谢谢!

代码

Python udf

n

处理

@udf(input_types=DataTypes.STRING(), result_type=DataTypes.ARRAY(DataTypes.STRING()))
def explode(s):
    return 3*[s]

t_env.register_function("explode", explode)

执行

tab = t_env.from_path('mySource').select("id, explode(dummy) as dummy_list")
t_env.register_table("temp_table", tab)
t_env.sql_query("SELECT t.item as dummy_item FROM UNNEST(select dummy_list from temp_table) AS t(item)").insert_into("mySink")

错误

t_env.execute("dummy_unnest")

1 个答案:

答案 0 :(得分:0)

我认为您可以将查询更改为

d