hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mich Talebzadeh <mich.talebza...@gmail.com>
Subject Re: Insert query with selective columns in Hive
Date Tue, 24 May 2016 21:57:52 GMT
This should work Mine is Hive 2

hive> create table testme (col1 int, col2 int, col3 int, col4 int);
OK
Time taken: 4.006 seconds

hive> insert into testme values(1,2,3,4);
Loading data to table test.testme
OK
Time taken: 70.844 seconds
hive> insert into testme (col1,col2,col3,col4) values(1,2,3,4);

Loading data to table test.testme
OK
--ignoring col2
hive> insert into testme (col1,col3,col4) values(1,3,4);
Loading data to table test.testme
OK
Time taken: 1.505 seconds
hive> insert into testme (col1,col3,col4) values(4,5,6);
Loading data to table test.testme
OK
-- insert only col4
hive> insert into testme (col4) values(6);

Loading data to table test.testme
OK

HTH

Dr Mich Talebzadeh



LinkedIn * https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw
<https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw>*



http://talebzadehmich.wordpress.com



On 24 May 2016 at 20:57, mahender bigdata <Mahender.BigData@outlook.com>
wrote:

> Hi,
>
> Is there a way in Hive to insert specific columns  rather than insert
> query with all columns options. Like
> I have table with 10 columns, in my insert statement, i would like to
> insert only 3 columns like below
>
> insert into tbl1 (col1,col2,col10) values (1,2,3);
>
> insert into tbl1 (col1,col2,col10) values (4,5,6);
>
> Above query fails due to syntactic error, I have forcefully need to write
> Insert into tbl1 values (1,2,3.....10); I'm running in Hive 1.2 version.
>
>
>
>

Mime
View raw message