Repository: spark
Updated Branches:
refs/heads/branch-1.3 6fff9b872 -> 5bd4b499a
[SPARK-5926] [SQL] make DataFrame.explain leverage queryExecution.logical
DataFrame.explain return wrong result when the query is DDL command.
For example, the following two queries should print out the same execution
plan, but it not.
sql("create table tb as select * from src where key > 490").explain(true)
sql("explain extended create table tb as select * from src where key > 490")
This is because DataFrame.explain leverage logicalPlan which had been forced
executed, we should use the unexecuted plan queryExecution.logical.
Author: Yanbo Liang <[email protected]>
Closes #4707 from yanboliang/spark-5926 and squashes the following commits:
fa6db63 [Yanbo Liang] logicalPlan is not lazy
0e40a1b [Yanbo Liang] make DataFrame.explain leverage queryExecution.logical
(cherry picked from commit 41e2e5acb749c25641f1f8dea5a2e1d8af319486)
Signed-off-by: Michael Armbrust <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/5bd4b499
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/5bd4b499
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/5bd4b499
Branch: refs/heads/branch-1.3
Commit: 5bd4b499a51b825419d9b0e61bba3050f53e8ab0
Parents: 6fff9b8
Author: Yanbo Liang <[email protected]>
Authored: Wed Feb 25 15:37:13 2015 -0800
Committer: Michael Armbrust <[email protected]>
Committed: Wed Feb 25 15:37:29 2015 -0800
----------------------------------------------------------------------
sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/5bd4b499/sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala
b/sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala
index 04bf5d9..f045da3 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala
@@ -264,7 +264,7 @@ class DataFrame protected[sql](
*/
def explain(extended: Boolean): Unit = {
ExplainCommand(
- logicalPlan,
+ queryExecution.logical,
extended = extended).queryExecution.executedPlan.executeCollect().map {
r => println(r.getString(0))
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]