Repository navigation
Comet writer doesn't respect OVERWRITE mode #2970
Copy link
Copy link
Open
Labels
area:writerNative Parquet writerNative Parquet writerbugSomething isn't workingSomething isn't workingpriority:mediumFunctional bugs, performance regressions, broken featuresFunctional bugs, performance regressions, broken features
Description
Activity
Taking a look at this
some more details on implementation
The flow is like
↓ DataFrameWriter.saveInternal() ↓ InsertIntoHadoopFsRelationCommand.run() ↓ [Line 131] deleteMatchingPartitions(fs, qualifiedOutputPath, customPartitionLocations, committer) ↓ [Line 238] committer.deleteWithJob(fs, staticPrefixPath, true) ↓ [Line 183] fs.delete(path, recursive=true) ← ACTUAL DELETION HAPPENS HEREThis Spark implementation now
val doInsertion = if (mode == SaveMode.Append) { true } else { val pathExists = fs.exists(qualifiedOutputPath) (mode, pathExists) match { case (SaveMode.ErrorIfExists, true) => throw QueryCompilationErrors.outputPathAlreadyExistsError(qualifiedOutputPath) case (SaveMode.Overwrite, true) => if (ifPartitionNotExists && matchingPartitions.nonEmpty) { false } else if (dynamicPartitionOverwrite) { // For dynamic partition overwrite, do not delete partition directories ahead. true } else { deleteMatchingPartitions(fs, qualifiedOutputPath, customPartitionLocations, committer) true } case (SaveMode.Overwrite, _) | (SaveMode.ErrorIfExists, false) => true case (SaveMode.Ignore, exists) => !exists case (s, exists) => throw QueryExecutionErrors.saveModeUnsupportedError(s, exists) } }The keypoint here, we need to support
dynamicPartitionOverwriteor fallback to Spark in this caseReacted by Bhargava Vadlamanitake
- addedpriority:mediumFunctional bugs, performance regressions, broken featuresFunctional bugs, performance regressions, broken featuresarea:writerNative Parquet writerNative Parquet writer
on Mar 27, 2026
Metadata
Metadata
Assignees
Labels
area:writerNative Parquet writerNative Parquet writerbugSomething isn't workingSomething isn't workingpriority:mediumFunctional bugs, performance regressions, broken featuresFunctional bugs, performance regressions, broken features
Describe the bug
Comet fails if the folder exists and cannot overwrite it
Steps to reproduce
Folder
output2existsExpected behavior
Should overwrite the folder with new content
Additional context
No response