You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Yang <te...@gmail.com> on 2014/10/27 22:57:14 UTC

possible to pass in a list of values as param ?

I have a query that does something like


SELECT * from mytable where my_id in ('1', '2', '3', '4' );


now instead of hard coding the value list in the (), I'd like to pass it in
as a param

I tried "in (${hiveconf:myargs}) "

and hive -hiveconf myargs="'1','2','3','4'"
or ='1,2,3,4'

neither seems to work


what is the best way to do this?

thanks!
yang

Re: possible to pass in a list of values as param ?

Posted by 丁桂涛(桂花) <di...@baixing.com>.
Hi Yang,

try:

hive -hiveconf myargs="1','2','3','4"

SELECT * from mytable where my_id in ('${hiveconf:myargs}');


On Tue, Oct 28, 2014 at 5:57 AM, Yang <te...@gmail.com> wrote:

> I have a query that does something like
>
>
> SELECT * from mytable where my_id in ('1', '2', '3', '4' );
>
>
> now instead of hard coding the value list in the (), I'd like to pass it
> in as a param
>
> I tried "in (${hiveconf:myargs}) "
>
> and hive -hiveconf myargs="'1','2','3','4'"
> or ='1,2,3,4'
>
> neither seems to work
>
>
> what is the best way to do this?
>
> thanks!
> yang
>