0

I wrote a hive sql query here:

SELECT
 dt,
 COUNT(CASE WHEN search_word like ‘%A%’ THEN id END) AS a,
 COUNT(CASE WHEN search_word like ‘%B%’ THEN id END) AS b,
 FROM database
 GROUP BY dt

However, Hive returns an error :

Error while compiling statement : Failed ParseExceptionline 3:7 Failed to recognise predicate ‘AS’. Failed rule: ‘identifier’ in the select target.

I searched this error and my assumption is it might be come from AS reserve word. But I still do not understand how to fix it.

Ian Campbell
  • 23,484
  • 14
  • 36
  • 57

0 Answers0