1

Hi Guys,

So I am trying to do multiple inserts and i am successfully able to do it but if there are two queries which have same partition and static value assigned it gives me the following error :15:02:22 [EXPLAIN - 0 row(s), 0.000 secs] [Error Code: 10087, SQL State: 42000] Error while compiling statement: FAILED: SemanticException [Error 10087]: The same output cannot be present multiple times: table_name@id=0
here first insert happens successfully but because second insert has the same value assigned for id which is 0 ..it gives the above error ..please let me know a workaround.Thanks :)

FROM (  
      Select * from Table_Name
     )Query
INSERT OVERWRITE TABLE Table_Name PARTITION(id=0)
 select column1,column2,column3
 GROUP BY column1,column2,column1

INSERT OVERWRITE TABLE Table_Name PARTITION(id=0) 
   select column1,count(*) as column2 

1 Answer 1

-1

Instead of multiple inserts, you can just do one insert with a union of the two queries.

FROM (  
      Select * from Table_Name
     )Query
INSERT OVERWRITE TABLE Table_Name PARTITION(id=0)
  select <query 1>
  UNION ALL
  select <query 2>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.