You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Sanjay Dasgupta (JIRA)" <ji...@apache.org> on 2016/07/01 17:21:11 UTC

[jira] [Created] (SPARK-16347) DataFrame allows duplicate column-names

Sanjay Dasgupta created SPARK-16347:
---------------------------------------

             Summary: 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: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org