Search code examples
hadoopparametershivehiveqlhue

two queries with parameters in hive


I'm trying to run two queries in hue/hive with parameters (dates and suffixes), but it doesn't work. I wonder if it is possible or should I always run them separately (which is inconvenient).

Queries:

create table private_kubicki.tmp${suffix} as
select
  id,
  c1,
  c2
from 
  private_kubicki.testy_${suffix2}
where
  ${cond}
;
create table private_kubicki.tmp2${suffix} as
select
  id,
  c1,
  c2
from 
  private_kubicki.testy_${suffix2}
where
  ${cond2}

The strange thing is that sometimes I get this error:

Your query has the following error(s):

Error while compiling statement: FAILED: ParseException line 1:33 cannot recognize input near '$' '{' 'suffix' in create table statement

And sometimes it works but only the first table is created..

Important thing is that everything works when I ask only one query at a time.

I'm using hue: 3.5.0, (apache) hive: 0.13.1


Solution

  • This is not working as is currently until https://issues.cloudera.org/browse/HUE-2136 is done, but 2 workarounds are explained in the ticket.