hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mohammad Tariq <donta...@gmail.com>
Subject Re: Storing result of a query in a variable
Date Tue, 03 Jun 2014 11:34:48 GMT
Hi Chhaya,

Try this :

var=`hive -S -e "YOUR_HIVE_QUERY;"`

*Warm regards,*
*Mohammad Tariq*
*cloudfront.blogspot.com <http://cloudfront.blogspot.com>*


On Tue, Jun 3, 2014 at 4:47 PM, Chhaya Vishwakarma <
Chhaya.Vishwakarma@lntinfotech.com> wrote:

> ./hive -e --hiveconf MY_VAR =`cat /tmp/result/000000_0`;
>
>
>
> Is not working
>
>
>
> *From:* Sanjay Subramanian [mailto:sanjaysubramanian@yahoo.com]
> *Sent:* Tuesday, June 03, 2014 2:30 AM
> *To:* user@hive.apache.org
> *Subject:* Re: Storing result of a query in a variable
>
>
>
> Add  *-e* option
>
>
>
> ./hive -e --hiveconf MY_VAR =`cat /tmp/result/000000_0`;
>
>
>
> But u could use the following hdfs command as well
>
>
>
> MY_VAR=$(hdfs dfs -cat /tmp/result/000000_0)
>
>
>
> thanks
>
>
>
> sanjay
>
>
> ------------------------------
>
> *From:* Chhaya Vishwakarma <Chhaya.Vishwakarma@lntinfotech.com>
> *To:* "user@hive.apache.org" <user@hive.apache.org>
> *Sent:* Monday, June 2, 2014 12:06 AM
> *Subject:* Storing result of a query in a variable
>
>
>
>
>
>
>
> Hi ,
>
>
>
> I have a query whose result I wanted to store in a variable
>
> How can I do it ?
>
> I tried
>
>
>
> ./hive -e  "use telecom;insert overwrite local directory '/tmp/result'
> select
>
> avg( a from abc;"
>
>
>
> ./hive --hiveconf MY_VAR =`cat /tmp/result/000000_0`;
>
>
>
> I am able to get average value in MY_VAR but it takes me in hive CLI which
> is not required
>
>
>
>
>
>
> ------------------------------
>
> The contents of this e-mail and any attachment(s) may contain confidential
> or privileged information for the intended recipient(s). Unintended
> recipients are prohibited from taking action on the basis of information in
> this e-mail and using or disseminating the information, and must notify the
> sender and delete it from their system. L&T Infotech will not accept
> responsibility or liability for the accuracy or completeness of, or the
> presence of any virus or disabling code in this e-mail"
>
>
>

Mime
View raw message