[
https://issues.apache.org/jira/browse/SPARK-44226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Darren Cheung updated SPARK-44226:
----------------------------------
Description:
{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)
unsure why this is
{{{code:title=example.scala|borderStyle=solid}}}
val dfWithVector = spark.createDataFrame(
spark.sparkContext.parallelize(denseData),
StructType(schema)
)
println("metadata before:" + dfWithVector.schema("features").metadata)
var dfDroppedDuplicates = dfWithVector.dropDuplicates("id")
println("metadata after duplicates dropped:" +
droppedDuplicatesWithOverwrittenSchema.schema("features").metadata)
dfDroppedDuplicates.write.mode("overwrite").parquet(outputLocation)
val dfRead = spark.read.parquet(outputLocation)
println("metadata after caching: " + dfRead.schema("features").metadata)
```
{quote}
was:
{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)
unsure why this is
```
val dfWithVector = spark.createDataFrame(
spark.sparkContext.parallelize(denseData),
StructType(schema)
)
println("metadata before:" + dfWithVector.schema("features").metadata)
var dfDroppedDuplicates = dfWithVector.dropDuplicates("id")
println("metadata after duplicates dropped:" +
droppedDuplicatesWithOverwrittenSchema.schema("features").metadata)
dfDroppedDuplicates.write.mode("overwrite").parquet(outputLocation)
val dfRead = spark.read.parquet(outputLocation)
println("metadata after caching: " + dfRead.schema("features").metadata)
```
{quote}
> dropDuplicates prevents correct metadata caching
> ------------------------------------------------
>
> Key: SPARK-44226
> URL: https://issues.apache.org/jira/browse/SPARK-44226
> Project: Spark
> Issue Type: Bug
> Components: Spark Core
> 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)
> unsure why this is
> {{{code:title=example.scala|borderStyle=solid}}}
> val dfWithVector = spark.createDataFrame(
> spark.sparkContext.parallelize(denseData),
> StructType(schema)
> )
> println("metadata before:" + dfWithVector.schema("features").metadata)
> var dfDroppedDuplicates = dfWithVector.dropDuplicates("id")
> println("metadata after duplicates dropped:" +
> droppedDuplicatesWithOverwrittenSchema.schema("features").metadata)
> dfDroppedDuplicates.write.mode("overwrite").parquet(outputLocation)
> val dfRead = spark.read.parquet(outputLocation)
> 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]