Grokbase Groups Hive user March 2011
FAQ
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

Search Discussions

  • Lenin Gali at Mar 21, 2011 at 3:35 pm
    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 <amit_jus@yahoo.com>
    Date: Mon, 21 Mar 2011 08:10:55
    To: <user@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
  • Andrew Wilson at Mar 21, 2011 at 3:44 pm
    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 <amit_jus@yahoo.com>
    Date: Mon, 21 Mar 2011 08:10:55
    To: <user@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
  • Edward Capriolo at Mar 21, 2011 at 9:21 pm

    On Mon, Mar 21, 2011 at 11:43 AM, Andrew Wilson 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 <amit_jus@yahoo.com>
    Date: Mon, 21 Mar 2011 08:10:55
    To: <user@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)
  • Sameer Kalburgi at Mar 21, 2011 at 10:56 pm
    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 wrote:
    On Mon, Mar 21, 2011 at 11:43 AM, Andrew Wilson 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 <amit_jus@yahoo.com>
    Date: Mon, 21 Mar 2011 08:10:55
    To: <user@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)
  • Avram Aelony at Mar 21, 2011 at 11:28 pm
    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 wrote:
    On Mon, Mar 21, 2011 at 11:43 AM, Andrew Wilson 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 <amit_jus@yahoo.com>
    Date: Mon, 21 Mar 2011 08:10:55
    To: <user@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)

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categorieshive, hadoop
postedMar 21, '11 at 3:11p
activeMar 21, '11 at 11:28p
posts6
users6
websitehive.apache.org

People

Translate

site design / logo © 2021 Grokbase