You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Hyukjin Kwon (JIRA)" <ji...@apache.org> on 2019/05/21 04:35:45 UTC

[jira] [Resolved] (SPARK-14759) After join one cannot drop dynamically added column

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

Hyukjin Kwon resolved SPARK-14759.
----------------------------------
    Resolution: Incomplete

> After join one cannot drop dynamically added column
> ---------------------------------------------------
>
>                 Key: SPARK-14759
>                 URL: https://issues.apache.org/jira/browse/SPARK-14759
>             Project: Spark
>          Issue Type: Bug
>          Components: PySpark
>    Affects Versions: 1.6.1
>            Reporter: Tomasz Bartczak
>            Priority: Minor
>              Labels: bulk-closed
>
> running following code:
> {code}
> from pyspark.sql.functions import *
> df1 = sqlContext.createDataFrame([(1,10,)], ['any','hour'])
> df2 = sqlContext.createDataFrame([(1,)], ['any']).withColumn('hour',lit(10))
> j = df1.join(df2,[df1.hour == df2.hour],how='left')
> print("columns after join:{0}".format(j.columns))
> jj = j.drop(df2.hour)
> print("columns after removing 'hour':{0}".format(jj.columns))
> {code}
> should show that after join and remove df2.hour I end up with only one 'hour' column in dataframe.
> Unfortunately this column is not dropped.
> {code}
> columns after join:            ['any', 'hour', 'any', 'hour']
> columns after removing 'hour': ['any', 'hour', 'any', 'hour']
> {code}
> I found out that it behaves like that only when the column is added dynamically before the join.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org