Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/4416#discussion_r24254686
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/DataFrameImpl.scala
---
@@ -88,17 +88,26 @@ private[sql] class DataFrameImpl protected[sql](
}
}
- override def toDataFrame(colName: String, colNames: String*): DataFrame
= {
- val newNames = colName +: colNames
- require(schema.size == newNames.size,
+ override def toDataFrame(colNames: String*): DataFrame = {
+ require(schema.size == colNames.size,
"The number of columns doesn't match.\n" +
"Old column names: " + schema.fields.map(_.name).mkString(", ") +
"\n" +
- "New column names: " + newNames.mkString(", "))
-
- val newCols = schema.fieldNames.zip(newNames).map { case (oldName,
newName) =>
- apply(oldName).as(newName)
+ "New column names: " + colNames.mkString(", "))
+
+ logicalPlan match {
+ case LocalRelation(outputAttributes, data) =>
--- End diff --
why is this not in the optimizer?
---
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]