You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by sonia gehlot <so...@gmail.com> on 2012/08/29 23:44:06 UTC

Join with OR condition in hive

Hi All,

I am joining 2 tables in hive, with or condition. for example:

select blah
from table a
Join table b
*on (a.col1 = b.col2 or a.col2 = 0)*
*
*
but this is giving me error that OR not supported in hive currently.

Any suggestion how I can handle this in hive query.

Thanks,
Sonia

Re: Join with OR condition in hive

Posted by sonia gehlot <so...@gmail.com>.
ah, thanks Erek.

I can easily handle this in where clause.

Thanks much.
Sonia

On Wed, Aug 29, 2012 at 2:52 PM, Erek Dyskant <er...@dyskant.net> wrote:

> select blah
> from table a
> Left Join table b *on (a.col1 = b.col2)*
> *where b.col2 is not null or a.col1 = 0*
>
>
> On Wed, Aug 29, 2012 at 5:44 PM, sonia gehlot <so...@gmail.com>wrote:
>
>> Hi All,
>>
>> I am joining 2 tables in hive, with or condition. for example:
>>
>> select blah
>> from table a
>> Join table b
>> *on (a.col1 = b.col2 or a.col2 = 0)*
>> *
>> *
>> but this is giving me error that OR not supported in hive currently.
>>
>> Any suggestion how I can handle this in hive query.
>>
>> Thanks,
>> Sonia
>>
>
>

Re: Join with OR condition in hive

Posted by Erek Dyskant <er...@dyskant.net>.
select blah
from table a
Left Join table b *on (a.col1 = b.col2)*
*where b.col2 is not null or a.col1 = 0*


On Wed, Aug 29, 2012 at 5:44 PM, sonia gehlot <so...@gmail.com>wrote:

> Hi All,
>
> I am joining 2 tables in hive, with or condition. for example:
>
> select blah
> from table a
> Join table b
> *on (a.col1 = b.col2 or a.col2 = 0)*
> *
> *
> but this is giving me error that OR not supported in hive currently.
>
> Any suggestion how I can handle this in hive query.
>
> Thanks,
> Sonia
>

Re: Join with OR condition in hive

Posted by John Omernik <jo...@omernik.com>.
How do you join two tables that aren't represented in both sides of the =?
 Can you describe a bit more of what you are trying to get out of the data?
I am having a hard time wrapping my head around this...




On Wed, Aug 29, 2012 at 4:44 PM, sonia gehlot <so...@gmail.com>wrote:

> Hi All,
>
> I am joining 2 tables in hive, with or condition. for example:
>
> select blah
> from table a
> Join table b
> *on (a.col1 = b.col2 or a.col2 = 0)*
> *
> *
> but this is giving me error that OR not supported in hive currently.
>
> Any suggestion how I can handle this in hive query.
>
> Thanks,
> Sonia
>