Re: equvalent beewn join sql and data frame

2016-05-30 Thread Mich Talebzadeh
one is sql and the other one is its equivalent in functional programming

val s =
HiveContext.table("sales").select("AMOUNT_SOLD","TIME_ID","CHANNEL_ID")
val c = HiveContext.table("channels").select("CHANNEL_ID","CHANNEL_DESC")
val t = HiveContext.table("times").select("TIME_ID","CALENDAR_MONTH_DESC")

//These are the same
val rs =
s.join(t,s("time_id")===t("time_id")).join(c,"channel_id").groupBy("calendar_month_desc","channel_desc").agg(sum("amount_sold").as("TotalSales"))

val rs =
s.join(t,"time_id").join(c,"channel_id").groupBy("calendar_month_desc","channel_desc").agg(sum("amount_sold").as("TotalSales"))

HTH

Dr Mich Talebzadeh



LinkedIn * 
https://www.linkedin.com/profile/view?id=AAEWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw
*



http://talebzadehmich.wordpress.com



On 31 May 2016 at 04:55, Takeshi Yamamuro  wrote:

> Hi,
>
> The same they are.
> If you check the equality, you can use DataFrame#explain.
>
> // maropu
>
>
> On Tue, May 31, 2016 at 12:26 PM, pseudo oduesp 
> wrote:
>
>> hi guys ,
>> it s similare  thing to do :
>>
>> sqlcontext.join("select * from t1 join t2 on condition) and
>>
>> df1.join(df2,condition,'inner")??
>>
>> ps:df1.registertable('t1')
>> ps:df2.registertable('t2')
>> thanks
>>
>
>
>
> --
> ---
> Takeshi Yamamuro
>


Re: equvalent beewn join sql and data frame

2016-05-30 Thread Takeshi Yamamuro
Hi,

The same they are.
If you check the equality, you can use DataFrame#explain.

// maropu


On Tue, May 31, 2016 at 12:26 PM, pseudo oduesp 
wrote:

> hi guys ,
> it s similare  thing to do :
>
> sqlcontext.join("select * from t1 join t2 on condition) and
>
> df1.join(df2,condition,'inner")??
>
> ps:df1.registertable('t1')
> ps:df2.registertable('t2')
> thanks
>



-- 
---
Takeshi Yamamuro


equvalent beewn join sql and data frame

2016-05-30 Thread pseudo oduesp
hi guys ,
it s similare  thing to do :

sqlcontext.join("select * from t1 join t2 on condition) and

df1.join(df2,condition,'inner")??

ps:df1.registertable('t1')
ps:df2.registertable('t2')
thanks