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

Darren Cheung updated SPARK-44226:
----------------------------------
    Component/s: PySpark

> dropDuplicates prevents correct metadata caching
> ------------------------------------------------
>
>                 Key: SPARK-44226
>                 URL: https://issues.apache.org/jira/browse/SPARK-44226
>             Project: Spark
>          Issue Type: Bug
>          Components: PySpark, Spark Core, SQL
>    Affects Versions: 3.3.2
>            Reporter: Darren Cheung
>            Priority: Minor
>
> {quote}given a df, applying dropDuplicates (dD) AND after writing+reading it 
> to s3 (cache), the metadata is deleted
> applying just dD or just cache preserves metadata
> however, the issue is fixed by recreating the df after dD
> {{spark.createDataFrame(dedupedPositiveUsersDf.rdd, 
> dedupedPositiveUsersDf.schema)}}
> this leads to the conclusion that there is some issue with dD (affects the df 
> in some unknown way that prevents metadata caching)
>  
> Example below:
> {{{}val dfWithVector = 
> spark.createDataFrame({}}}{{{}spark.sparkContext.parallelize(denseData),{}}}{{{}StructType(schema){}}}{{{}){}}}
> {quote}
> {quote}{{println("metadata before:" + 
> dfWithVector.schema("features").metadata)}}
> {quote}
> {quote}{{var dfDroppedDuplicates = dfWithVector.dropDuplicates("id")}}
> {quote}
> {quote}{{println("metadata after duplicates dropped:" + 
> droppedDuplicatesWithOverwrittenSchema.schema("features").metadata)}}
> {quote}
> {quote}{{dfDroppedDuplicates.write.mode("overwrite").parquet(outputLocation)}}
> {quote}
> {quote}{{val dfRead = spark.read.parquet(outputLocation)}}
> {quote}
> {quote}{{{}println("metadata after caching: " + 
> dfRead.schema("features").metadata){}}}{{{{}}{}}}
> {quote}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to