如何读取 Spark SQL 的 toDebugString 输出?

How to read Spark SQL's toDebugString output?

我不知道如何读取 Spark SQL 的 onDebugString 输出。 我不明白

这里是针对两种不同数据库格式的同一查询的 toDebugString 输出的链接。

Avro http://pastebin.com/BPwwfdzz

实木复合地板http://pastebin.com/pZNfCHPc

  1. #number 是名称的一部分(DataFrame 内部字段表示)。 DataFrame 允许有两个具有相同名称的字段(它们具有不同的#number)。尝试 select 其中之一会出现问题 - 你会发现它不明确。
  2. 聚合/排序真/假。 True 表示它是本地操作。在您的示例中,您可以看到总有 Aggregate true,然后是 Exchange,然后是 Aggregate false。这意味着每个分区的每个节点在本地发生了一些聚合,然后节点交换它们的哈希值以知道将数据发送到哪里,然后聚合在远程节点上完成。
  3. BuildLeft 和 BuildRight,我只能推测这是连接方。通过加入,你总是有两个部分加入 - 左边和右边。就是这样。
  4. 无法确定 OutputFaker 是什么,但为了完整起见,javadoc 说:

    A plan node that does nothing but lie about the output of its child. Used to spice a (hopefully structurally equivalent) tree from a different optimization sequence into an already resolved tree.

大多数操作本身就像过滤或交换一样,但有时了解区别很重要:ShuffledHashJoin 与 BroadcastHashJoin。这就是我认为解释有帮助的原因。

此外,可以打印带有详细信息的解释(不仅是物理计划),只需调用 explain(true).