Hi!

是字段的顺序不一致(sink schema 里 d 在第三个,query 里 d 在最后)。需要将这两个顺序调整到一致。

yidan zhao <[email protected]> 于2021年10月27日周三 下午4:45写道:

> Flink SQL> insert into upd_sh.dr1 select cast('cid' as string) as cid,
> cast(2001 as bigint) as server_time, cast('20211027' as string) as dt,
> cast('01' as str
> ing) as `hour`, cast('7102' as string) as supply_id, cast(map['sid','7102',
> 'subid', 'i am a subid'] as map<string,string>) as d;
> [INFO] Submitting SQL update statement to the cluster...
> [ERROR] Could not execute SQL statement. Reason:
> org.apache.flink.table.api.ValidationException: Column types of query
> result and sink for registered table 'hive.upd_sh.dr1' do not match.
> Cause: Incompatible types for sink column 'd' at position 2.
>
> Query schema: [cid: STRING NOT NULL, server_time: BIGINT NOT NULL, dt:
> STRING NOT NULL, hour: STRING NOT NULL, supply_id: STRING NOT NULL, d:
> MAP<STRING, STRING> NOT NULL]
> Sink schema:  [cid: STRING, server_time: BIGINT, d: MAP<STRING, STRING>,
> dt: STRING, hour: STRING, supply_id: STRING]
>
>
> 如上,显示是d这个字段有问题,但实际上d我已经强制转换了,类型完全一致。
>

回复