查询Flink SQL 1.11中的嵌套字段



我有一个模式,看起来像这样:表:org_table

`transaction_amt` VARCHAR(64) NOT NULL,
`transaction_adj_amt` BIGINT NOT NULL ,
`event_time` TIMESTAMP(3),
`fd_output` ROW<`restime`  BIGINT `outcome` VARCHAR(64)>,

当我像这样查询该表时:

SELECT transaction_amt, transaction_adj_amt, event_time, fd_output.restime as response_time, fd_output.outcome as outcome,  YEAR(event_time), MONTH(event_time) 
FROM org_table

在表上运行上面的查询时,我得到一个错误。我是不是漏掉了什么?

scala.MatchError: CAST (of class org.apache.calcite.sql.fun.SqlCastFunction

也许你需要注意Flink内置函数的输入参数,比如YEAR和MONTH函数,它们的输入参数都是日期类型

Flink内置功能说明可参考https://ci.apache.org/projects/flink/flink - docs -释放- 1.13 -/- docs/dev/table/functions/systemfunctions/

尝试fd_output.get(0)访问restime,fd_output.get(1)获取结果

最新更新