Chinna :
Thanks for your replay
I also do not understand why.
Could you please give me a more detailed explanation?

*Example:*
________________________________
CREATE TABLE source_table (s1 INT, s2 SRRING);
SELECT * FORM source_table;
s1     s2
10     tom
11     jack
__________________________________
CREATE TABLE target_table (t1 INT, t2 INT, t3 STRING, t4 STRING);
SELECT * FROM target_table;
t1       t2            t3                t4
1        1             bob            may
___________________________________
INSERT OVERWRITE TABLE target_table (t2,t4) SELECT s1, s2 FROM source_table;
SELECT * FROM target_table;
t1       t2            t3                t4
1        1             bob            may
NULL 10         NULL         tom
NULL 11         NULL         jack


2011/8/3 Chinna <chinna...@huawei.com>

>
> I think we cannot do this directly by specify the particular target columns
> in the insert query because it is dealing with the files.
>
> And the syntax is
>
> syntax:
> INSERT OVERWRITE TABLE tablename1 [PARTITION (partcol1=val1, partcol2=val2
> ...)] select_statement1 FROM from_statement;
> INSERT INTO TABLE tablename1 [PARTITION (partcol1=val1, partcol2=val2 ...)]
> select_statement1 FROM from_statement;
>
> -Chinna Rao Lalam
>
> -----Original Message-----
> From: 曹坤 [mailto:caofang...@gmail.com]
> Sent: Wednesday, August 03, 2011 8:30 AM
> To: dev@hive.apache.org
> Subject: how to insert data to specified columns
>
> Hello :
> Any idea about how to insert data to specified columns?
> In a way like follow :
>
> INSERT OVERWRITE TABLE target_table
>                                 PARTITION (day='20110803' , hour='11')
>                                 (target_table_column1,target_table_column2)
> SELECT source_table_column1,  source_table_column2
> FROM source_table;
>
> --
> Best wishs!
>
>


-- 
Best wishs!
曹 坤

Reply via email to