JoeKevin
JoeKevin

Reputation: 91

Hive sql: Error while compiling statement: FAILED: SemanticException Exception while processing in Hive

As I know hive support sql like one from multi select, my sql like this:

 FROM
  (SELECT DISTINCT a.td_id,a.brd,a.crt_at,
                   b.imei
   FROM table_main as a
   LEFT JOIN
     (SELECT DISTINCT imei,
                      td_id
      FROM table_device
      WHERE crt_at < '2016-12-01')b ON a.td_id=b.td_id)bb
SELECT imei,td_id,crt_at,brd 
SELECT imei,
       count(DISTINCT td_id)AS imei_cnt
GROUP BY imei 

I try one query multi select, but hive return exception: "Error while compiling statement: FAILED: SemanticException Exception while processing"

Anyone know why this is happening? How to solve it? Thanks, Gal.

Upvotes: 0

Views: 4919

Answers (1)

David דודו Markovitz
David דודו Markovitz

Reputation: 44981

There is no such thing as "multi select".
a query cannot return multiple row-sets.
Perhaps you are confusing it with "multiple inserts" - Inserting multiple row-sets into multiple tables,from one source, in a single statement.

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DML#LanguageManualDML-InsertingdataintoHiveTablesfromqueries

Upvotes: 1

Related Questions