Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Hive >> mail # user >> Hive Query Issue


+
Manickam P 2013-08-06, 09:52
+
Nitin Pawar 2013-08-06, 10:54
+
Manickam P 2013-08-06, 11:10
+
Sunita Arvind 2013-08-07, 14:22
+
Sanjay Subramanian 2013-08-07, 19:31
+
Manickam P 2013-09-02, 11:32
+
manish dunani 2013-09-02, 11:52
Copy link to this message
-
Re: Hive Query - Issue
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 <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>
Reply-To: "[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>" <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>
Date: Monday, September 2, 2013 4:32 AM
To: "[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>" <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>
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.