关注 spark技术分享,
撸spark源码 玩spark最佳实践

Debugging Query Execution

Debugging Query Execution

debug package object contains tools for debugging query execution, i.e. a full analysis of structured queries (as Datasets).

Table 1. Debugging Query Execution Tools (debug Methods)
Method Description

debug

Debugging a structured query

debugCodegen

Displays the Java source code generated for a structured query in whole-stage code generation (i.e. the output of each WholeStageCodegen subtree in a query plan).

debug package object is in org.apache.spark.sql.execution.debug package that you have to import before you can use the debug and debugCodegen methods.

Tip
Read up on Package Objects in the Scala programming language.

Internally, debug package object uses DebugQuery implicit class that “extends” Dataset[_] Scala type with the debug methods.

Tip
Read up on Implicit Classes in the official documentation of the Scala programming language.

Debugging Dataset — debug Method

debug requests the QueryExecution (of the structured query) for the optimized physical query plan.

debug transforms the optimized physical query plan to add a new DebugExec physical operator for every physical operator.

debug requests the query plan to execute and then counts the number of rows in the result. It prints out the following message:

In the end, debug requests every DebugExec physical operator (in the query plan) to dumpStats.

Displaying Java Source Code Generated for Structured Query in Whole-Stage Code Generation (“Debugging” Codegen) — debugCodegen Method

debugCodegen requests the QueryExecution (of the structured query) for the optimized physical query plan.

In the end, debugCodegen simply codegenString the query plan and prints it out to the standard output.

Note

debugCodegen is equivalent to using debug interface of the QueryExecution.

codegenToSeq Method

codegenToSeq…​FIXME

Note
codegenToSeq is used when…​FIXME

codegenString Method

codegenString…​FIXME

Note
codegenString is used when…​FIXME
赞(0) 打赏
未经允许不得转载:spark技术分享 » Debugging Query Execution
分享到: 更多 (0)

关注公众号:spark技术分享

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏