AnsweredAssumed Answered

Apache Hive - Single pass through query

Question asked by Lokesh on Aug 4, 2017
Latest reply on Aug 4, 2017 by MichaelSegel

Hi All,


I got this question from but finding it difficult to understand.


Query A:

hive> INSERT OVERWRITE TABLE sales SELECT * FROM history WHERE action = 'purchased';

hive> INSERT OVERWRITE TABLE credits SELECT * FROM history WHERE action = 'returned';


and Query B:

hive> FROM history

INSERT OVERWRITE sales SELECT * WHERE action = 'purchased' 

INSERT OVERWRITE credits SELECT * WHERE action = 'returned'


Which of them will make a single pass through?

A - Query A

B - Query B (This is the answer)

C - Both

D - None


I don't know if query B will even compile. There is no 'select * from table_name'. What is single pass through? Can somebody please explain this concept in detail taking above query as an example?