hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sanjay Subramanian <Sanjay.Subraman...@wizecommerce.com>
Subject Re: Hive Query - Issue
Date Tue, 03 Sep 2013 18:18:19 GMT
Hi

When you do a SELECT * ,  the partition columns are returned as last N columns  (if u have
N partitions)

In this case the 63rd column in SELECT * is the partition column

Instead of SELECT *
Do a
SELECT
             col1,
             col2,
             col3,
…..


Not to show the candle to the sun if u r a AWK/SED ninja :-) but to get all column from hive
u can do this

hive -e "describe ur_table_name" | awk '{print $1","}'|sed '1i SELECT'|less

Thanks

sanjay
From: Manickam P <manickam.p@outlook.com<mailto:manickam.p@outlook.com>>
Reply-To: "user@hive.apache.org<mailto:user@hive.apache.org>" <user@hive.apache.org<mailto:user@hive.apache.org>>
Date: Monday, September 2, 2013 4:32 AM
To: "user@hive.apache.org<mailto:user@hive.apache.org>" <user@hive.apache.org<mailto:user@hive.apache.org>>
Subject: Hive Query - Issue

Hello Experts,

when i try to execute the below query i'm getting error. Please help me to correct this.

insert overwrite table table_baseline partition (sourcedate='base_2013_08') select * from
(select * from table_a where sourcedate='tablea_2013_08' union all select * from table_b where
sourcedate='tableb_2013_08') final

My intention here is i want to populate the table_baseline by using the all records from table_a
and table_b with partition. I am getting the below error.

Error in semantic analysis: Line 1:23 Cannot insert into target table because column number/types
are different ''BASE_2013_08'': Table insclause-0 has 62 columns, but query has 63 columns.

I verified the column count and types everything is same but here it says some difference.
The same query works fine without having any partitions in all the three tables but getting
error while executing with partitions.


please help.



Thanks
Manickam P

CONFIDENTIALITY NOTICE
======================
This email message and any attachments are for the exclusive use of the intended recipient(s)
and may contain confidential and privileged information. Any unauthorized review, use, disclosure
or distribution is prohibited. If you are not the intended recipient, please contact the sender
by reply email and destroy all copies of the original message along with any attachments,
from your computer system. If you are the intended recipient, please be advised that the content
of this message is subject to access, review and disclosure by the sender's Email System Administrator.

Mime
View raw message