You necessarily don't need to go in for UNION ALL for your requirement.
Use INSERT INTO instead, which has less overhead. It is supported from hive 0.8 .
INSERT INTO main_table SELECT * FROM stage_table;
Or an even better approach if you are just copying whole data from one table to another would be to use a hdfs copy/move.
LOAD DATA INPATH 'location/of/stage_table' INTO TABLE 'main_table';
Sent from handheld, please excuse typos.
From: "Balaraman, Anand" <[EMAIL PROTECTED]>
Date: Thu, 16 Aug 2012 11:36:49
To: <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Subject: UNION ALL - what is the simplest form
I am trying to consolidate one of my staged tables with a primary table
Simply need to merge 2 tables using UNION ALL.
Tried the following:
select * from main_table UNION ALL select * from stage_table
but, not able to execute it -> Error in semantic analysis: Top level
UNION is not supported currently; use a subquery for the UNION
But, HIVE language manual says:
UNION ALL is used to combine the result from multiple SELECT statements
into a single result set.
select_statement UNION ALL select_statement UNION ALL
Have I gone wrong with the syntax anywhere in my query ?
Confidential: This electronic message and all contents contain information from Syntel, Inc. which may be privileged, confidential or otherwise protected from disclosure. The information is intended to be for the addressee only. If you are not the addressee, any disclosure, copy, distribution or use of the contents of this message is prohibited. If you have received this electronic message in error, please notify the sender immediately and destroy the original message and all copies.