You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Riju Trivedi (JIRA)" <ji...@apache.org> on 2018/04/20 05:47:00 UTC

[jira] [Commented] (HIVE-19255) Hive doesn't support column list specification in INSERT into statements with distribute by/Cluster by

    [ 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)