You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by amit jaiswal <am...@yahoo.com> on 2011/03/21 16:10:55 UTC

Dynamic Configuration support in Hive SQL

Hi,

Does hive support dynamic configuration? For example: is it possible to write a 
hive script with some ${PARAM} variables and let hive replace these parameters 
with their values at runtime.

Eg.
Original hive script:
select * from person where age > ${MIN_AGE};

Config file:
MIN_AGE=18

And hive replaces the MIN_AGE parameter automatically.

-amit


Re: Dynamic Configuration support in Hive SQL

Posted by Avram Aelony <Av...@eharmony.com>.
You can probably do this in Bash now, try something like this:

zz=`hive -S -e "select count(1) from t"`


~Avram


~ Avram Aelony|Sr. Analyst|eHarmony.com|(424) 258-1199|x1098|skype: avram.aelony ~

On Mar 21, 2011, at 3:55 PM, Sameer Kalburgi wrote:

> Any plans, if possible, to allow you to set the variable from a query result e.g. 'set zzz = (select count(1) from t)'?
> 
> On Mon, Mar 21, 2011 at 5:20 PM, Edward Capriolo <ed...@gmail.com> wrote:
> On Mon, Mar 21, 2011 at 11:43 AM, Andrew  Wilson <aw...@conductor.com> wrote:
> > We use the Cloudera Oozie distro which has a Hive action, and provides that kind of template support for Hive scripts.
> >
> > On Mar 21, 2011, at 11:35 AM, Lenin Gali wrote:
> >
> >> Best way to do this is to write shell or python scripts and echo with substitute variables and call hive from command line passing -f argument with output file.
> >>
> >> Lenin
> >> Sent from my BlackBerry® wireless handheld
> >>
> >> -----Original Message-----
> >> From: amit jaiswal <am...@yahoo.com>
> >> Date: Mon, 21 Mar 2011 08:10:55
> >> To: <us...@hive.apache.org>
> >> Reply-To: user@hive.apache.org
> >> Subject: Dynamic Configuration support in Hive SQL
> >>
> >> Hi,
> >>
> >> Does hive support dynamic configuration? For example: is it possible to write a
> >> hive script with some ${PARAM} variables and let hive replace these parameters
> >> with their values at runtime.
> >>
> >> Eg.
> >> Original hive script:
> >> select * from person where age > ${MIN_AGE};
> >>
> >> Config file:
> >> MIN_AGE=18
> >>
> >> And hive replaces the MIN_AGE parameter automatically.
> >>
> >> -amit
> >>
> >
> >
> 
> Hive 0.7.0 will support variables substitution.
> This is the xdoc
> http://svn.apache.org/repos/asf/hive/trunk/docs/xdocs/language_manual/var_substitution.xml
> (you can built the doc into nicer html by running ant docs in trunk)
> 


Re: Dynamic Configuration support in Hive SQL

Posted by Sameer Kalburgi <sa...@gmail.com>.
Any plans, if possible, to allow you to set the variable from a query result
e.g. 'set zzz = (select count(1) from t)'?

On Mon, Mar 21, 2011 at 5:20 PM, Edward Capriolo <ed...@gmail.com>wrote:

> On Mon, Mar 21, 2011 at 11:43 AM, Andrew  Wilson <aw...@conductor.com>
> wrote:
> > We use the Cloudera Oozie distro which has a Hive action, and provides
> that kind of template support for Hive scripts.
> >
> > On Mar 21, 2011, at 11:35 AM, Lenin Gali wrote:
> >
> >> Best way to do this is to write shell or python scripts and echo with
> substitute variables and call hive from command line passing -f argument
> with output file.
> >>
> >> Lenin
> >> Sent from my BlackBerry® wireless handheld
> >>
> >> -----Original Message-----
> >> From: amit jaiswal <am...@yahoo.com>
> >> Date: Mon, 21 Mar 2011 08:10:55
> >> To: <us...@hive.apache.org>
> >> Reply-To: user@hive.apache.org
> >> Subject: Dynamic Configuration support in Hive SQL
> >>
> >> Hi,
> >>
> >> Does hive support dynamic configuration? For example: is it possible to
> write a
> >> hive script with some ${PARAM} variables and let hive replace these
> parameters
> >> with their values at runtime.
> >>
> >> Eg.
> >> Original hive script:
> >> select * from person where age > ${MIN_AGE};
> >>
> >> Config file:
> >> MIN_AGE=18
> >>
> >> And hive replaces the MIN_AGE parameter automatically.
> >>
> >> -amit
> >>
> >
> >
>
> Hive 0.7.0 will support variables substitution.
> This is the xdoc
>
> http://svn.apache.org/repos/asf/hive/trunk/docs/xdocs/language_manual/var_substitution.xml
> (you can built the doc into nicer html by running ant docs in trunk)
>

Re: Dynamic Configuration support in Hive SQL

Posted by Edward Capriolo <ed...@gmail.com>.
On Mon, Mar 21, 2011 at 11:43 AM, Andrew  Wilson <aw...@conductor.com> wrote:
> We use the Cloudera Oozie distro which has a Hive action, and provides that kind of template support for Hive scripts.
>
> On Mar 21, 2011, at 11:35 AM, Lenin Gali wrote:
>
>> Best way to do this is to write shell or python scripts and echo with substitute variables and call hive from command line passing -f argument with output file.
>>
>> Lenin
>> Sent from my BlackBerry® wireless handheld
>>
>> -----Original Message-----
>> From: amit jaiswal <am...@yahoo.com>
>> Date: Mon, 21 Mar 2011 08:10:55
>> To: <us...@hive.apache.org>
>> Reply-To: user@hive.apache.org
>> Subject: Dynamic Configuration support in Hive SQL
>>
>> Hi,
>>
>> Does hive support dynamic configuration? For example: is it possible to write a
>> hive script with some ${PARAM} variables and let hive replace these parameters
>> with their values at runtime.
>>
>> Eg.
>> Original hive script:
>> select * from person where age > ${MIN_AGE};
>>
>> Config file:
>> MIN_AGE=18
>>
>> And hive replaces the MIN_AGE parameter automatically.
>>
>> -amit
>>
>
>

Hive 0.7.0 will support variables substitution.
This is the xdoc
http://svn.apache.org/repos/asf/hive/trunk/docs/xdocs/language_manual/var_substitution.xml
(you can built the doc into nicer html by running ant docs in trunk)

Re: Dynamic Configuration support in Hive SQL

Posted by Andrew Wilson <aw...@conductor.com>.
We use the Cloudera Oozie distro which has a Hive action, and provides that kind of template support for Hive scripts.

On Mar 21, 2011, at 11:35 AM, Lenin Gali wrote:

> Best way to do this is to write shell or python scripts and echo with substitute variables and call hive from command line passing -f argument with output file.
> 
> Lenin
> Sent from my BlackBerry® wireless handheld
> 
> -----Original Message-----
> From: amit jaiswal <am...@yahoo.com>
> Date: Mon, 21 Mar 2011 08:10:55 
> To: <us...@hive.apache.org>
> Reply-To: user@hive.apache.org
> Subject: Dynamic Configuration support in Hive SQL
> 
> Hi,
> 
> Does hive support dynamic configuration? For example: is it possible to write a 
> hive script with some ${PARAM} variables and let hive replace these parameters 
> with their values at runtime.
> 
> Eg.
> Original hive script:
> select * from person where age > ${MIN_AGE};
> 
> Config file:
> MIN_AGE=18
> 
> And hive replaces the MIN_AGE parameter automatically.
> 
> -amit
> 


Re: Dynamic Configuration support in Hive SQL

Posted by Lenin Gali <ga...@gmail.com>.
Best way to do this is to write shell or python scripts and echo with substitute variables and call hive from command line passing -f argument with output file.

Lenin
Sent from my BlackBerry® wireless handheld

-----Original Message-----
From: amit jaiswal <am...@yahoo.com>
Date: Mon, 21 Mar 2011 08:10:55 
To: <us...@hive.apache.org>
Reply-To: user@hive.apache.org
Subject: Dynamic Configuration support in Hive SQL

Hi,

Does hive support dynamic configuration? For example: is it possible to write a 
hive script with some ${PARAM} variables and let hive replace these parameters 
with their values at runtime.

Eg.
Original hive script:
select * from person where age > ${MIN_AGE};

Config file:
MIN_AGE=18

And hive replaces the MIN_AGE parameter automatically.

-amit