Github user scwf commented on a diff in the pull request:
https://github.com/apache/spark/pull/5247#discussion_r28397087
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala ---
@@ -139,11 +139,13 @@ class DataFrame private[sql](
@transient protected[sql] val logicalPlan: LogicalPlan =
queryExecution.logical match {
// For various commands (like DDL) and queries with side effects, we
force query optimization to
// happen right away to let these side effects take place eagerly.
- case _: Command |
- _: InsertIntoTable |
- _: CreateTableAsSelect[_] |
- _: CreateTableUsingAsSelect |
- _: WriteToFile =>
+ case _ : Command =>
+ queryExecution.sparkPlan.executeCollect()
+ queryExecution.analyzed
--- End diff --
This will leads to executed command twice when we do action operator on
dataframe, such as
`sql(s"CREATE DATABASE xxx").count()`
first execution is when constructing dataframe
second is to execute count.
So maybe we still need construct LocalRelation here?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]