[ https://issues.apache.org/jira/browse/HIVE-19255?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16445351#comment-16445351 ]
Riju Trivedi commented on HIVE-19255: ------------------------------------- Query works using WITH clause too : with t1 as (SELECT col1, col2,col3 FROM source_table DISTRIBUTE BY col1 SORT BY col1,col2) INSERT into TABLE target_table_2 partition (col3) (col1, col2,col3) Select * from t1 ; > Hive doesn't support column list specification in INSERT into statements with > distribute by/Cluster by > ------------------------------------------------------------------------------------------------------- > > Key: HIVE-19255 > URL: https://issues.apache.org/jira/browse/HIVE-19255 > Project: Hive > Issue Type: Bug > Components: Parser, Query Processor, SQL > Affects Versions: 1.2.0 > Reporter: Riju Trivedi > Priority: Major > > INSERT into TABLE target_table_2 partition (col3) (col1, col2,col3) > SELECT col1,col2,col3 > FROM source_table > DISTRIBUTE BY col1 > SORT BY col1,col2; > This Insert statement throws > Error: Error while compiling statement: FAILED: SemanticException [Error > 10004]: Line 4:14 Invalid table alias or column reference 'col1': > Query is executed successfully with below workaround: > INSERT into TABLE target_table_2 partition (col3) (col1, col2,col3) > select * From (SELECT col1, col2,col3 > FROM source_table > DISTRIBUTE BY col1 > SORT BY col1,col2) a; -- This message was sent by Atlassian JIRA (v7.6.3#76005)