[
https://issues.apache.org/jira/browse/SPARK-16327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15356883#comment-15356883
]
Tao Li commented on SPARK-16327:
--------------------------------
I found that when I call "df.queryExecution.executedPlan.execute()", it will
trigger 4 jobs, query t1 run first and then query t2. Both t1 and t2 will read
hive data. I am confusions that I didn't call any action opertation at the RDD,
but it will trigger hive data read?
I find SortMergeJoin will call left.execute() and then right.execute(), does it
will cause hive data read and right runs after left?
[https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/joins/SortMergeJoinExec.scala#L97]
{code:none|title=test.scala|borderStyle=solid}
val df = sqlContext.sql("select t1.channel_l1 as channel, t1.pv as pv1, t2.pv
as pv2 from (select channel_l1, count(*) as pv from custom.common_wap_pv where
logdate>='2016060605' and logdate<='2016060605' group by channel_l1) t1 join
(select channel_l1, count(*) as pv from custom.common_wap_pv where
logdate>='2016060606' and logdate<='2016060606' group by channel_l1) t2 on
t1.channel_l1 = t2.channel_l1")
val rdd = df.queryExecution.executedPlan.execute()
{code}
> The two subquery in join operator can't be execute in parallel
> --------------------------------------------------------------
>
> Key: SPARK-16327
> URL: https://issues.apache.org/jira/browse/SPARK-16327
> Project: Spark
> Issue Type: Improvement
> Components: SQL
> Affects Versions: 1.6.0, 1.6.1, 1.6.2
> Environment: Spark: 1.6.2
> Hadoop: 2.5.0-cdh5.3.2
> Hive: 0.14.0
> Reporter: Tao Li
>
> I found that the two subquery in join operator can't execute in parallel. For
> example, t1 and t2 can't execute in parallel.
> {code:SQL|title=test.sql|borderStyle=solid}
> select t1.channel_l1 as channel, t1.pv as pv1, t2.pv as pv2
> from (select channel_l1, count(*) as pv from custom.common_wap_pv where
> logdate>='2016060605' and logdate<='2016060605' group by channel_l1) t1
> join (select channel_l1, count(*) as pv from custom.common_wap_pv where
> logdate>='2016060606' and logdate<='2016060606' group by channel_l1) t2
> on t1.channel_l1 = t2.channel_l1
> {code}
> Physical Plan:
> {code}
> == Physical Plan ==
> Limit 21
> +- ConvertToSafe
> +- Project [channel_l1#58 AS channel#2,pv#0L AS pv1#3L,pv#1L AS pv2#4L]
> +- SortMergeJoin [channel_l1#58], [channel_l1#132]
> :- Sort [channel_l1#58 ASC], false, 0
> : +- TungstenExchange(coordinator id: 182426297)
> hashpartitioning(channel_l1#58,200), Some(coordinator[target post-shuffle
> partition size: 67108864])
> : +- TungstenAggregate(key=[channel_l1#58],
> functions=[(count(1),mode=Final,isDistinct=false)],
> output=[channel_l1#58,pv#0L])
> : +- TungstenExchange(coordinator id: 1254877490)
> hashpartitioning(channel_l1#58,200), Some(coordinator[target post-shuffle
> partition size: 67108864])
> : +- TungstenAggregate(key=[channel_l1#58],
> functions=[(count(1),mode=Partial,isDistinct=false)],
> output=[channel_l1#58,count#155L])
> : +- HiveTableScan [channel_l1#58], MetastoreRelation
> custom, common_wap_pv, None, [(logdate#5 >= 2016060605),(logdate#5 <=
> 2016060605)]
> +- Sort [channel_l1#132 ASC], false, 0
> +- TungstenExchange(coordinator id: 1199219058)
> hashpartitioning(channel_l1#132,200), Some(coordinator[target post-shuffle
> partition size: 67108864])
> +- TungstenAggregate(key=[channel_l1#132],
> functions=[(count(1),mode=Final,isDistinct=false)],
> output=[channel_l1#132,pv#1L])
> +- TungstenExchange(coordinator id: 1391280854)
> hashpartitioning(channel_l1#132,200), Some(coordinator[target post-shuffle
> partition size: 67108864])
> +- TungstenAggregate(key=[channel_l1#132],
> functions=[(count(1),mode=Partial,isDistinct=false)],
> output=[channel_l1#132,count#158L])
> +- HiveTableScan [channel_l1#132], MetastoreRelation
> custom, common_wap_pv, None, [(logdate#79 >= 2016060606),(logdate#79 <=
> 2016060606)]
> {code}
> The two subquery is not executed in parallel:
> !http://7xid4y.com1.z0.glb.clouddn.com/demo.png!
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]