You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Ruben Berenguel (JIRA)" <ji...@apache.org> on 2018/06/21 08:35:00 UTC

[jira] [Commented] (SPARK-24347) df.alias() in python API should not clear metadata by default

    [ https://issues.apache.org/jira/browse/SPARK-24347?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16519074#comment-16519074 ] 

Ruben Berenguel commented on SPARK-24347:
-----------------------------------------

Looking into this

> df.alias() in python API should not clear metadata by default
> -------------------------------------------------------------
>
>                 Key: SPARK-24347
>                 URL: https://issues.apache.org/jira/browse/SPARK-24347
>             Project: Spark
>          Issue Type: Bug
>          Components: PySpark
>    Affects Versions: 2.3.0
>            Reporter: Tomasz Bartczak
>            Priority: Minor
>
> currently when doing an alias on a column in pyspark I lose metadata:
> {code:java}
> print("just select = ", df.select(col("v")).schema.fields[0].metadata.keys())
> print("select alias= ", df.select(col("v").alias("vv")).schema.fields[0].metadata.keys()){code}
> gives:
> {code:java}
> just select =  dict_keys(['ml_attr'])
> select alias=  dict_keys([]){code}
> After looking at alias() documentation I see that metadata is an optional param. But it should not clear the metadata when it is not set. A default solution should be to keep it as-is.
> Otherwise - it generates problems in a later part of the processing pipeline when someone is depending on the metadata.
>  
>  



--
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