Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/4298#discussion_r23895621
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala ---
@@ -139,12 +139,13 @@ class DataFrame protected[sql](
* val rdd: RDD[(Int, String)] = ...
* rdd.toDataFrame // this implicit conversion creates a DataFrame
with column name _1 and _2
* rdd.toDataFrame("id", "name") // this creates a DataFrame with
column name "id" and "name"
+ * rdd.toDataFrame("id") // this creates a DataFrame with
only column name "id"
* }}}
*/
@scala.annotation.varargs
def toDataFrame(colName: String, colNames: String*): DataFrame = {
val newNames = colName +: colNames
- require(schema.size == newNames.size,
+ require(schema.size >= newNames.size,
--- End diff --
I'm worried that silently dropping fields here can cause trouble without
the user knowing. Can you revert this line?
If we see a lot of requests to make it less strict, we can always relax it
in the future. But we cannot go the other way.
---
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]