[SPARK-49991][SQL] Make HadoopMapReduceCommitProtocol respect 'mapreduce.output.basename' to generate file names#48494
Closed
yaooqinn wants to merge 2 commits intoapache:masterfrom
Closed
[SPARK-49991][SQL] Make HadoopMapReduceCommitProtocol respect 'mapreduce.output.basename' to generate file names#48494yaooqinn wants to merge 2 commits intoapache:masterfrom
yaooqinn wants to merge 2 commits intoapache:masterfrom
Conversation
…uce.output.basename' to generate file names
…uce.output.basename' to generate file names
Member
Author
|
cc @cloud-fan @dongjoon-hyun, thanks |
cloud-fan
approved these changes
Oct 17, 2024
HyukjinKwon
reviewed
Oct 17, 2024
| withSQLConf("mapreduce.output.basename" -> "apachespark") { | ||
| spark.range(1).coalesce(1).write.parquet(dir.getCanonicalPath) | ||
| val df = spark.read.parquet(dir.getCanonicalPath) | ||
| assert(df.inputFiles.head.contains("apachespark")) |
Member
There was a problem hiding this comment.
Can we double check if there aren't anything specific to part- files in our codebase?
e.g.,
core/src/main/scala/org/apache/spark/rdd/ReliableCheckpointRDD.scala: .filter(_.getName.startsWith("part-"))
core/src/main/scala/org/apache/spark/rdd/ReliableCheckpointRDD.scala: .sortBy(_.getName.stripPrefix("part-").toInt)
core/src/main/scala/org/apache/spark/rdd/ReliableCheckpointRDD.scala: "part-%05d".format(partitionIndex)
Member
Author
There was a problem hiding this comment.
For checkpoint* you have mentioned, it looks safe to me in a roundtrip.
In addition to those mentioned, there is another instance in SparkHadoopWriter where it is hardcoded. Since this affects the underlying RDD APIs, I plan to leave it unchanged in this PR.
dongjoon-hyun
approved these changes
Oct 17, 2024
Member
dongjoon-hyun
left a comment
There was a problem hiding this comment.
+1, LGTM for Apache Spark 4.0.0. Thank you, @yaooqinn and all.
HyukjinKwon
approved these changes
Oct 18, 2024
Member
|
Thank you, @yaooqinn , @cloud-fan , @HyukjinKwon . |
Member
Author
|
Thank you all, @cloud-fan @HyukjinKwon @dongjoon-hyun |
baibaichen
added a commit
to baibaichen/gluten
that referenced
this pull request
Dec 11, 2025
baibaichen
added a commit
to baibaichen/gluten
that referenced
this pull request
Dec 12, 2025
baibaichen
added a commit
to baibaichen/gluten
that referenced
this pull request
Dec 13, 2025
baibaichen
added a commit
to baibaichen/gluten
that referenced
this pull request
Dec 15, 2025
baibaichen
added a commit
to baibaichen/gluten
that referenced
this pull request
Dec 16, 2025
baibaichen
added a commit
to apache/gluten
that referenced
this pull request
Dec 17, 2025
…Spark 4.0 (#11281) * Replace direct exception throwing with `GlutenFileFormatWriter.throwWriteError` for task failure handling. * Respect 'mapreduce.output.basename' configuration for file name generation, according to apache/spark#48494 * Refactor imports and variable initializations for improved clarity and consistency * Remove exclusions * Assert on the cause message * Enhance error handling in commit and abort tasks to provide better diagnostics * Fix minor syntax inconsistency --------- Co-authored-by: Chang chen <chenchang@apache.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
In 'HadoopMapReduceCommitProtocol', task output files are generated ahead instead of calling
org.apache.hadoop.mapreduce.lib.output.FileOutputFormat#getDefaultWorkFile, which uses themapreduce.output.basenameas the prefix of output files.In this pull request, we modify the
HadoopMapReduceCommitProtocol.getFilenamemethod to also look up this config instead of using the hardcoded 'part'.Why are the changes needed?
Given a custom file name is a useful feature for users. They can use it to distinguish files added by different engines, on different days, etc. We can also align the usage scenario with other SQL on Hadoop engines for better Hadoop compatibility.
Does this PR introduce any user-facing change?
Yes, a Hadoop configuration 'mapreduce.output.basename' can be used in file datasource output files
How was this patch tested?
new tests
Was this patch authored or co-authored using generative AI tooling?
no`