cloud-fan commented on PR #59728:
URL: https://github.com/apache/spark/pull/59728#issuecomment-6371577273

   A follow-up note, not blocking this PR since the issue predates it: `ALTER 
TABLE .. ADD IF NOT EXISTS PARTITION` can still overwrite an existing partition 
through the stats branch of `AlterTableAddPartitionCommand`:
   
   
https://github.com/apache/spark/blob/7d16a2ba4afdf64731aa75f77b1dac54e07686be/sql/core/src/main/scala/org/apache/spark/sql/execution/command/ddl.scala#L624-L632
   
   When the table has stats, `spark.sql.statistics.size.autoUpdate.enabled` is 
true, and the requested locations are non-empty, the command calls 
`catalog.alterPartitions(table.identifier, parts)` with *all* requested 
partitions. So an existing partition named in the command still gets its 
storage (e.g. the `LOCATION`) replaced, even though `createPartitions` now 
skips it. `addedSize` also counts the requested locations of existing 
partitions, which inflates `sizeInBytes`. This is at the command level, so it 
applies to both the in-memory and Hive catalogs.
   
   Could we fix this in a follow-up by excluding the already-existing specs 
from both `addedSize` and the `alterPartitions` call?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to