[ 
https://issues.apache.org/jira/browse/FLINK-25459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17465922#comment-17465922
 ] 

qyw commented on FLINK-25459:
-----------------------------

[~wenlong.lwl] If it is a simple field, I agree with your solution However, for 
"row" type fields, type matching depends on order. For example:
query schema: [ceshi: ROW<`name` INT, `id` STRING>]
Sink schema:  [ceshi: ROW<`id` INT, `name` STRING>
According to my previous understanding, the data mapping relationship is: name 
-> name and id-> id, which will be matched according to the field name
In fact, the data mapping relationship is: name ->id and id -> name, which are 
matched in order. Because my data is in JSON format, I am very confused about 
this phenomenon

> When inserting row type fields into sink, the order needs to be maintained
> --------------------------------------------------------------------------
>
>                 Key: FLINK-25459
>                 URL: https://issues.apache.org/jira/browse/FLINK-25459
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table SQL / Planner
>    Affects Versions: 1.14.2
>            Reporter: qyw
>            Priority: Major
>
> When I insert a row type value into sink, why do I need to maintain the field 
> order in row?
> This is the comparison between my query schema and sink schema:
> Query schema: [ceshi: ROW<`name` STRING, `id` INT, `age` INT, `test` ROW<`c` 
> STRING>>]
> Sink schema:  [ceshi: ROW<`id` INT, `name` STRING, `age` INT, `test` ROW<`c` 
> STRING>>] 
> An error will be thrown:
> Exception in thread "main" org.apache.flink.table.api.ValidationException: 
> Column types of query result and sink for registered table 
> 'default_catalog.default_database.kafka_target' do not match.
> Cause: Incompatible types for sink column 'ceshi' at position 0.
>  
>  
> Is this phenomenon reasonable?



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to