[ 
https://issues.apache.org/jira/browse/SPARK-19442?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hyukjin Kwon resolved SPARK-19442.
----------------------------------
    Resolution: Cannot Reproduce

I am resolving this as I can't reproduce in the current master as below:

{code}
    // Replace existing column
    spark.range(10).toDF("newColumnName")
      .withColumn("newColumnName", new Column("newColumnName").cast("int"))
      .show();

    // Adding a new column
    spark.range(10).toDF("a")
       .withColumn("newColumnName", new Column("a").cast("int"))
       .show();
{code}

prints

{code}
+-------------+
|newColumnName|
+-------------+
|            0|
|            1|
|            2|
|            3|
|            4|
|            5|
|            6|
|            7|
|            8|
|            9|
+-------------+

+---+-------------+
|  a|newColumnName|
+---+-------------+
|  0|            0|
|  1|            1|
|  2|            2|
|  3|            3|
|  4|            4|
|  5|            5|
|  6|            6|
|  7|            7|
|  8|            8|
|  9|            9|
+---+-------------+
{code}

Please reopen this if I am mistaken

> Unable to add column to the dataset using Dataset.WithColumn() api
> ------------------------------------------------------------------
>
>                 Key: SPARK-19442
>                 URL: https://issues.apache.org/jira/browse/SPARK-19442
>             Project: Spark
>          Issue Type: Bug
>          Components: Java API
>    Affects Versions: 2.0.2
>            Reporter: Navya Krishnappa
>
> When I'm creating a new column using Dataset.WithColumn() api, Analysis 
> Exception is thrown.
> Dataset.WithColumn() api: 
> Dataset.withColumn("newColumnName', new 
> org.apache.spark.sql.Column("newColumnName").cast("int"));
> Stacktrace: 
> cannot resolve '`NewColumn`' given input columns: [abc,xyz ]



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to