You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Raviprasad T <ra...@gmail.com> on 2019/05/27 17:30:36 UTC

Hive Insert and Select only specific columns ( not all columns ) - Partitioned table

*emp   ( Hive emp table,  Non partitioned table )*

empo
ename
sal
deptno


*emp_parquet*   ( Hive  emp_parquet table  Partitioned by deptno )

empo
ename
sal
Partition by deptno

I am  having two tables  emp  ( text file format  )   and emp_parquet  (
Parquet file format )

Both are have same columns  and  emp_parquet is  the partitioned table.

I want to select only *specific column*   ( Not all columns )  from emp
table  and insert into emp_parquet ( partitioned table )table.

*insert into table emp_parquet partition by (deptno)  select empno, ename
from emp;*

Please note :  I want to insert only empno, ename   and   NOT  sal column
in  emp_parquet table.  ( Partitioned table ).
I have tried with Non partitioned table,  it was working fine

Regards
Ravi




-- 
----------------------------------------------
Regards,
RAVI PRASAD. T

Re: Hive Insert and Select only specific columns ( not all columns ) - Partitioned table

Posted by Alan Gates <al...@gmail.com>.
You need to provide a value for the deptno partition key.  You can't insert
into a partitioned table without providing a value for the partition
column.  You can either give it a static value:
insert into table emp_parquet partition (deptno = 'x') select empno, ename
from emp

or you can set it dynamically based on a value in emp (if such a value
exists)
insert into table emp_parquet partition (deptno) select empno, ename,
deptno from emp;

Alan.

On Wed, May 29, 2019 at 9:16 PM Raviprasad T <ra...@gmail.com> wrote:

> Is it possible to Insert only specific columns in  Hive   ( Partitioned
> tables ) ?
>
> For Non partitioned tables, it is working as below.
>
> insert into emp (empno,sal) select empno,sal from emp_hist.;   ---  This
> is working  ( emp_hist  table is having  empno,ename,sal,job_desc  columns,
> I am able to insert only empno  and  sal  columns )
>
> ---------- Forwarded message ---------
> From: Raviprasad T <ra...@gmail.com>
> Date: Mon, May 27, 2019 at 11:00 PM
> Subject: Hive Insert and Select only specific columns ( not all columns )
> - Partitioned table
> To: <us...@hive.apache.org>
>
>
> *emp   ( Hive emp table,  Non partitioned table )*
>
> empo
> ename
> sal
> deptno
>
>
> *emp_parquet*   ( Hive  emp_parquet table  Partitioned by deptno )
>
> empo
> ename
> sal
> Partition by deptno
>
> I am  having two tables  emp  ( text file format  )   and emp_parquet  (
> Parquet file format )
>
> Both are have same columns  and  emp_parquet is  the partitioned table.
>
> I want to select only *specific column*   ( Not all columns )  from emp
> table  and insert into emp_parquet ( partitioned table )table.
>
> *insert into table emp_parquet partition by (deptno)  select empno, ename
> from emp;*
>
> Please note :  I want to insert only empno, ename   and   NOT  sal column
> in  emp_parquet table.  ( Partitioned table ).
> I have tried with Non partitioned table,  it was working fine
>
> Regards
> Ravi
>
>
>
>
> --
> ----------------------------------------------
> Regards,
> RAVI PRASAD. T
>
>
> --
> ----------------------------------------------
> Regards,
> RAVI PRASAD. T
>
>
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Virus-free.
> www.avg.com
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> <#m_6521893363656032594_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>

Fwd: Hive Insert and Select only specific columns ( not all columns ) - Partitioned table

Posted by Raviprasad T <ra...@gmail.com>.
Is it possible to Insert only specific columns in  Hive   ( Partitioned
tables ) ?

For Non partitioned tables, it is working as below.

insert into emp (empno,sal) select empno,sal from emp_hist.;   ---  This is
working  ( emp_hist  table is having  empno,ename,sal,job_desc  columns, I
am able to insert only empno  and  sal  columns )

---------- Forwarded message ---------
From: Raviprasad T <ra...@gmail.com>
Date: Mon, May 27, 2019 at 11:00 PM
Subject: Hive Insert and Select only specific columns ( not all columns ) -
Partitioned table
To: <us...@hive.apache.org>


*emp   ( Hive emp table,  Non partitioned table )*

empo
ename
sal
deptno


*emp_parquet*   ( Hive  emp_parquet table  Partitioned by deptno )

empo
ename
sal
Partition by deptno

I am  having two tables  emp  ( text file format  )   and emp_parquet  (
Parquet file format )

Both are have same columns  and  emp_parquet is  the partitioned table.

I want to select only *specific column*   ( Not all columns )  from emp
table  and insert into emp_parquet ( partitioned table )table.

*insert into table emp_parquet partition by (deptno)  select empno, ename
from emp;*

Please note :  I want to insert only empno, ename   and   NOT  sal column
in  emp_parquet table.  ( Partitioned table ).
I have tried with Non partitioned table,  it was working fine

Regards
Ravi




-- 
----------------------------------------------
Regards,
RAVI PRASAD. T


-- 
----------------------------------------------
Regards,
RAVI PRASAD. T

<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>