开发者社区> 问答> 正文

sql 内嵌josn数组解析报 类型转换报错

hi all我这边有个嵌套的json数组,报类型转换错误(ts AS CAST(FROM_UNIXTIME(hiido_time) AS TIMESTAMP(3)),这里报错),是不是不能这么写

create table hiido_push_sdk_mq (

datas   ARRAY<ROW<from string,hdid string,event string,hiido_time bigint,ts AS CAST(FROM_UNIXTIME(hiido_time) AS TIMESTAMP(3)),WATERMARK FOR ts AS ts - INTERVAL '5' MINUTE>>

) with (

'connector' = 'kafka',

'topic' = 'hiido_pushsdk_event',

'properties.bootstrap.servers' = 'kafkafs002-core001.yy.com:8103,kafkafs002-core002.yy.com:8103,kafkafs002-core003.yy.com:8103',

'properties.group.id' = 'push_click_sql_version_consumer',

'scan.startup.mode' = 'latest-offset',

'format.type' = 'json');

错误如下:

[ERROR] 2020-07-17 20:17:50,640(562284338) --> [http-nio-8080-exec-10] com.yy.push.flink.sql.gateway.sql.parse.SqlCommandParser.parseBySqlParser(SqlCommandParser.java:77): parseBySqlParser, parse: com.yy.push.flink.sql.gateway.context.JobContext$1@5d5f32d1, stmt: create table hiido_push_sdk_mq (    datas   ARRAY<ROW<from string,hdid string,event string,hiido_time bigint,ts AS CAST(FROM_UNIXTIME(hiido_time) AS TIMESTAMP(3)),WATERMARK FOR ts AS ts - INTERVAL '5' MINUTE>>) with ('connector' = 'kafka','topic' = 'hiido_pushsdk_event','properties.bootstrap.servers' = 'kafkafs002-core001.yy.com:8103,kafkafs002-core002.yy.com:8103,kafkafs002-core003.yy.com:8103','properties.group.id' = 'push_click_sql_version_consumer','scan.startup.mode' = 'latest-offset','format.type' = 'json'), error info: SQL parse failed. Encountered "AS" at line 1, column 115.

Was expecting one of:

    "ROW" ...

    <BRACKET_QUOTED_IDENTIFIER> ...

    <QUOTED_IDENTIFIER> ...

    <BACK_QUOTED_IDENTIFIER> ...

    <IDENTIFIER> ...

    <UNICODE_QUOTED_IDENTIFIER> ...

    "STRING" ...

    "BYTES" ...

    "ARRAY" ...

    "MULTISET" ...

    "RAW" ...

    "BOOLEAN" ...

    "INTEGER" ...

    "INT" ...

    "TINYINT" ...

    "SMALLINT" ...

    "BIGINT" ...

    "REAL" ...

    "DOUBLE" ...

    "FLOAT" ...

    "BINARY" ...

    "VARBINARY" ...

    "DECIMAL" ...

    "DEC" ...

    "NUMERIC" ...

    "ANY" ...

    "CHARACTER" ...

    "CHAR" ...

    "VARCHAR" ...

    "DATE" ...

    "TIME" ...

    "TIMESTAMP" ...

*来自志愿者整理的flink邮件归档

展开
收起
小阿矿 2021-12-06 16:39:58 925 0
1 条回答
写回答
取消 提交回答
  • 计算列只能写在最外层,不能在嵌套类型里面有计算列。

    *来自志愿者整理的flink邮件归档

    2021-12-07 10:04:38
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
神龙云服务器产品及技术深度解析 立即下载
弹性创造价值:基于ECS的最佳性价比实践解析 立即下载
又快又稳:阿里云下一代虚拟交换机解析 立即下载

相关镜像