In particular, if I say
rdd3 = rdd1.join(rdd2)
then when I call rdd3.collect
, depending on the Partitioner
used, either data is moved between nodes partitions, or the join is done locally on each partition (or, for all I know, something else entirely).
This depends on what the RDD paper calls "narrow" and "wide" dependencies, but who knows how good the optimizer is in practice.
Anyways, I can kind of glean from the trace output which thing actually happened, but it would be nice to call rdd3.explain
.
Does such a thing exist?
I think
toDebugString
will appease your curiosity.Each indentation is a stage, so this should run as two stages.
Also, the optimizer is fairly decent, however I would suggest using
DataFrames
if you are using 1.3+ as the optimizer there is EVEN better in many cases:)I would use Spark UI (the web page the spark context used to serve) instead of
toDebugString
whenever I can. Much easier to comprehend, and a bit more information (and less glitches according my very limited experience). Also, Spark UI shows the number of Tasks and their input and output sizes for each Stage, which helps figuring out what it does.Besides, there's very little information shown in both of them. Mostly just a graph of boxes saying
MapPartitionsRDD [12]
and such, which doesn't tell much about what that step actually does. (ForWholeStageCodegen
boxes theDEBUG
log underorg.apache.spark.sql.execution
contains the generated code at least. But there's no any kind of ID logged to pair them with what you see on Spark UI.)