flink之坑-sink表字段为/n

写完脚本运行起来就像喵的自信从容,结果~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CREATE TEMPORARY TABLE datagen_source (
id INT,
len INT,
content VARCHAR,
c TIMESTAMP
) with (
'connector' = 'datagen'
);
CREATE TEMPORARY TABLE odps_sink (
id INT,
len INT,
content VARCHAR,
ds VARCHAR --动态分区列需要显式声明。
) with (
'connector' = 'odps',
'endpoint' = '<yourEndpoint>',
'tunnelEndpoint' = '<yourTunnelEndpoint>',
'project' = '<yourProjectName>',
'tablename' = '<yourTableName>',
'accessid' = '<yourAccessKeyId>',
'accesskey' = '<yourAccessKeySecret>',
--指定分区
--'partition' = 'ds=20180905'
--动态分区
'partition' ='ds'
);
INSERT INTO odps_sink
SELECT
id,
len,
content,
DATE_FORMAT(c, 'yyMMdd') as ds
FROM datagen_source;
假如上述insert后查询语句写成 select * from datagen_source或者不是按以上示例顺序进行查询,那么你的结果表很可能是len=/n。
所以顺序、字段名一定要跟odps_sink 定义的字段名跟顺序一样
posted @ 2023-07-26 14:35  梦呓空间  阅读(13)  评论(0编辑  收藏  举报