hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brotanek, Jan" <Jan.Brota...@adastragrp.com>
Subject hivevar in partition clause
Date Tue, 21 Mar 2017 16:50:16 GMT
Hi, I have following shell script:

#!/bin/bash
PNAME=20170320_203225
TNAME=tablea1
/usr/bin/hive -hiveconf hive.cli.errors.ignore=true -hivevar PNAME=$PNAME -hivevar TNAME=$TNAME
-v -f ./query.hql

Trying to pass PNAME hivevar to query.hql script:

insert into table a1.${hivevar:TNAME}_orc PARTITION (part_col=${hivevar=PNAME})
select
a1,
a2,
a3
from a1.${hivevar:TNAME}
;

Substitution works fine in table name and from clause. However in (part_col=${hivevar=PNAME})
I get error cannot recognize input near '$' '{' 'hivevar' in constant.

If I add quotes (part_col="${hivevar=PNAME}"), it works fine, but never expands variable,
resulting having text "${hivevar=PNAME}") in my partition.
How should I quote PNAME to avoid error and having my variable expanded?

Can anyone help?
Thank you!


Mime
View raw message