Github user liancheng commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12952#discussion_r62311927
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala ---
    @@ -340,7 +340,8 @@ class Dataset[T] private[sql](
        */
       // This is declared with parentheses to prevent the Scala compiler from 
treating
       // `ds.toDF("1")` as invoking this toDF and then apply on the returned 
DataFrame.
    -  def toDF(): DataFrame = new Dataset[Row](sparkSession, queryExecution, 
RowEncoder(schema))
    +  def toDF(): DataFrame =
    +    new Dataset[Row](sparkSession, queryExecution, 
RowEncoder(logicalPlan.schema))
    --- End diff --
    
    Another option here is to add a projection to make sure column order of the 
result DataFrame always conform to schema of the Dataset.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to