My first thought is that you can get there through a combination of
joins, filters, and unions, but there's probably a better way.



On Mon, May 9, 2011 at 7:31 AM, Mark Laczin <mark.lac...@gmail.com> wrote:
> Can the same pattern be used to deal with OR's in a WHERE?
>
> That is,
> SELECT somestuff, somemorestuff
> FROM data1 d1, data2 d2
> WHERE (d1.d = "somestring" OR d1.d = d2.d) AND (d1.a = d2.a OR d1.b = d2.c)
>
> ?
>
> Quite an odd situation, I know.
>
> -Mark
>
> On Thu, May 5, 2011 at 6:12 PM, Dmitriy Ryaboy <dvrya...@gmail.com> wrote:
>> If you are joining on the same field, you can do that in one statement:
>>
>> x = join a on f1, b on f1, c on f2, d on f3...;
>>
>> If however it's more of a star-like join, you have to do several joins:
>>
>> x = join a on f1, b on f1;
>> xx = join x on b::f2, c on f2;
>> ....
>>
>> D
>>
>> On Thu, May 5, 2011 at 12:06 PM, Mark Laczin <mark.lac...@gmail.com> wrote:
>>> This is more of a "how can I do this" question.
>>> Imagine you have an sql query like the following:
>>> select a.f1, a.f2, a.f3, b.f1, b.f2, c.f1, c.f2, d.f1, d.f2
>>> from tableA a, tableB b, tableC c, tableD d
>>> where
>>>     a.f1 = b.f1
>>>     and b.f2 = d.f1
>>>     and c.f2 = b.f1
>>>     /* etc.... */
>>> What's the best way to replicate that query in Pig?
>>> It's obvious to me that a simple thing could be done with a simple join.
>>> That is, if you just had
>>> where a.f1 = b.f1
>>> You can just JOIN and then foreach generate.
>>> But with more than one clause in the where, I'm not sure of a good 
>>> approach...
>>> -Mark
>>>
>>
>

Reply via email to