Top level Union is not supported currently; use a subquery for the union : Error

August 1, 2013
select c1, c2 from cert.tset1 tset1 union all select c1, c2 from cert.tset2 
tset2


vs 

select * from ( select c1, c2 from cert.tset1 tset1 union all select c1, c2 
from cert.tset2 tset2 ) T 

 

Advertisements

Insert into doesnt work in Hive – by passing it !

August 1, 2013

The insert into command doesnt work in hive and gives the error “mismatched input ‘INTO’ expecting OVERWRITE in insert clause”.

Hence, we have to look at the other methods for implementing the same.
Hive tables are set up to be partitioned and load/insert overwrite partitions at a time.

There is another inefficient method of doing this :

INSERT OVERWRITE INTO TABLE myTable
SELECT … FROM …
UNION ALL
SELECT * from myTable;