[
https://issues.apache.org/jira/browse/SPARK-16347?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15359679#comment-15359679
]
Reynold Xin commented on SPARK-16347:
-------------------------------------
Yea it is by design -- otherwise it will be very difficult for joins to work.
We should however improve experience working duplicate columns. I think right
now it is a little but cumbersome.
> DataFrame allows duplicate column-names
> ---------------------------------------
>
> Key: SPARK-16347
> URL: https://issues.apache.org/jira/browse/SPARK-16347
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 2.0.0
> Environment: Databricks community edition
> Scala notebook in Google-Chrome
> Linux (Ubuntu 14.04LTS)
> Reporter: Sanjay Dasgupta
>
> Certain DataFrame APIs allow duplicate column-names. The following code
> illustrates the problem:
> case class Row(integer: Int, string1: String, string2: String)
> val rows = spark.sparkContext.parallelize(Seq(Row(1, "one", "one"), Row(2,
> "two", "two"), Row(3, "three", "three")))
> // DUPLICATED COLUMN-NAMES ...
> val df = rows.toDF("integer", "string", "string")
> df.printSchema()
> Here is the output:
> root
> |-- integer: integer (nullable = false)
> |-- string: string (nullable = true)
> |-- string: string (nullable = true)
> defined class Row
> rows: org.apache.spark.rdd.RDD[Row] = ParallelCollectionRDD[168] at
> parallelize at <console>:39
> df: org.apache.spark.sql.DataFrame = [integer: int, string: string ... 1 more
> field]
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]