[ https://issues.apache.org/jira/browse/FLINK-26542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17503280#comment-17503280 ]
luoyuxia edited comment on FLINK-26542 at 3/9/22, 11:46 AM: ------------------------------------------------------------ The main reason is it only use column alias to duplicate, we should try to use internal name to duplicate after finding a duplicate. It's a know issue of Hive, fixed in [HIVE-19770|https://issues.apache.org/jira/browse/HIVE-19770]. So only need to apply this patch to Flink. was (Author: luoyuxia): It's a know issue of Hive, fixed in [HIVE-19770|https://issues.apache.org/jira/browse/HIVE-19770]. So only need to apply this patch to Flink. > Hive dialect supports queries with multiple same columns in select > ------------------------------------------------------------------- > > Key: FLINK-26542 > URL: https://issues.apache.org/jira/browse/FLINK-26542 > Project: Flink > Issue Type: Sub-task > Components: Connectors / Hive > Reporter: luoyuxia > Priority: Major > Labels: pull-request-available > Fix For: 1.16.0 > > > With Hive dialect, for union sql statement, if one side of union select > multiple same columns, the columns will be overwritten, thus only retains one > column. Then it will throw the exception "Schema of both sides of union > should match" for it will loss some columns. > It can be reproduced using the following code in HiveDialectQueryITCase: > {code:java} > List<Row> result = > CollectionUtil.iteratorToList( > tableEnv.executeSql("select x,y from foo union all > select i,i from bar") > .collect()); > {code} -- This message was sent by Atlassian Jira (v8.20.1#820001)