title: subqueries in impala case statements
body: <pre><code>select
  a.time, b.name, c.user_city, 
  case
      when c.user_country='xxxx' and c.user_state in (select cast(state_id as string) from states_list)
      then (select d.STATE_NAME from States_LIST d where d.STATE_ID = cast(c.user_state as int) )
      else c.user_state 
  end state,
  case
      when c.user_country in (select cast(COUNTRY_ID as string) from COUNTRIES_LIST) 
      then (select e.COUNTRY_NAME from COUNTRIES_LIST e where e.COUNTRY_ID = cast(c.user_country as int)) 
      else null
  end country, col6, col7, ......
  from ......
  where.......
  </code></pre>
  
  <p>while executing the above query in Impala I am getting the error mentioned below:</p>
  
  <blockquote>
    <p>incompatible return types Array and string of exprs 'select
    d.STATE_NAME from States_LIST d where d.STATE_ID = cast(c.user_state
    as int) ' and 'c.user_state'</p>
  </blockquote>
  
  <p>please help!!!!</p>