Github user liancheng commented on a diff in the pull request:
https://github.com/apache/spark/pull/12952#discussion_r62312045
--- 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 --
Actually I think we should do this. Otherwise `ds.toDF()` may have
different column order from `ds`, and this breaks the commonly used
`checkDataset` testing method, which always converts a Dataset to a DataFrame
first and then checks output rows of the DataFrame.
---
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]