Github user naveenminchu commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9942#discussion_r46318681
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/WriterContainer.scala
 ---
    @@ -234,7 +234,22 @@ private[sql] class DefaultWriterContainer(
         executorSideSetup(taskContext)
         val configuration = 
SparkHadoopUtil.get.getConfigurationFromJobContext(taskAttemptContext)
         configuration.set("spark.sql.sources.output.path", outputPath)
    -    val writer = outputWriterFactory.newInstance(getWorkPath, dataSchema, 
taskAttemptContext)
    +    val writer = try {
    +      outputWriterFactory.newInstance(getWorkPath, dataSchema, 
taskAttemptContext)
    +    } catch {
    +      case e: org.apache.hadoop.fs.FileAlreadyExistsException =>
    +        if 
(outputCommitter.isInstanceOf[parquet.DirectParquetOutputCommitter]) {
    +          // Spark-11382: DirectParquetOutputCommitter is not idempotent, 
meaning on retry
    +          // attempts, the task will fail because the output file is 
created from a prior attempt.
    +          // This often means the most visible error to the user is 
misleading. Augment the error
    +          // to tell the user to look for the actual error.
    +          throw new SparkException("The output file already exists but 
this could be due to a " +
    +            "failure from a earlier attempt. Look through the earlier logs 
for the first " +
    +            "error.\n  File exists error: " + e)
    --- End diff --
    
    May be its better idea to wrap current exception instance into 
SparkException
    Example: SparkException("some error message",  e)   


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to