Skip to content
Advertisement

To compare count between two hive table

I am trying to do count comparision between two table . As minus operator does not work in hive , it is not happening. Could you please give some simple way to do count comparision between two tables.

It’s throwing error:

FAILED: ParseException line 81:0 cannot recognize input near ‘(‘ ‘(‘ ‘select’ in from source

Advertisement

Answer

Use cross join if you have no group by columns. In this case it will produce one row with both counts:

If you will add some group by columns to compare on more detailed grain, then use FULL JOIN on group by columns:

This query will return joined rows with difference calculated and also not joined rows from both tables.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement