You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by "Martin, Nick" <Ni...@pssd.com> on 2015/01/14 01:39:50 UTC
Set variable via query
Hi all,
I'm looking to set a variable in Hive and use the resulting value in a subsequent query. Something like:
set startdt='select max(dt) from sometable';
select * from someothertable where dt=${hiveconf:startdt};
I found this is still open HIVE-2165<https://issues.apache.org/jira/browse/HIVE-2165>
Any options? Tried a flavor of above via CLI and it didn't work.
On Hive 13
Thanks!
Nick
RE: Set variable via query
Posted by "Martin, Nick" <Ni...@pssd.com>.
Thx..went with something similar-ish to fit the need.
From: Xuefu Zhang [mailto:xzhang@cloudera.com]
Sent: Tuesday, January 13, 2015 9:48 PM
To: user@hive.apache.org
Subject: Re: Set variable via query
select * from someothertable where dt IN (select max(dt) from sometable);
On Tue, Jan 13, 2015 at 4:39 PM, Martin, Nick <Ni...@pssd.com>> wrote:
Hi all,
I'm looking to set a variable in Hive and use the resulting value in a subsequent query. Something like:
set startdt='select max(dt) from sometable';
select * from someothertable where dt=${hiveconf:startdt};
I found this is still open HIVE-2165<https://issues.apache.org/jira/browse/HIVE-2165>
Any options? Tried a flavor of above via CLI and it didn't work.
On Hive 13
Thanks!
Nick
Re: Set variable via query
Posted by Xuefu Zhang <xz...@cloudera.com>.
select * from someothertable where dt IN (select max(dt) from sometable);
On Tue, Jan 13, 2015 at 4:39 PM, Martin, Nick <Ni...@pssd.com> wrote:
> Hi all,
>
> I'm looking to set a variable in Hive and use the resulting value in a
> subsequent query. Something like:
>
> set startdt='select max(dt) from sometable';
> select * from someothertable where dt=${hiveconf:startdt};
>
> I found this is still open HIVE-2165
> <https://issues.apache.org/jira/browse/HIVE-2165>
>
> Any options? Tried a flavor of above via CLI and it didn't work.
>
> On Hive 13
>
> Thanks!
> Nick
>