luofeng1994 opened a new pull request, #5601:
URL: https://github.com/apache/hive/pull/5601

   ### What changes were proposed in this pull request?
   When executing 
org.apache.hadoop.hive.ql.metadata.Hive#cleanUpOneDirectoryForReplace, to avoid 
task failures caused by fs.listStatus throwing a FileNotFoundException when the 
partition directory has already been deleted in certain scenarios, we wrapped 
fs.listStatus in a try-catch block to handle the exception. This ensures that 
no exception is thrown in org.apache.hadoop.hive.ql.metadata.Hive#replaceFiles, 
allowing the downstream logic (creating the partition directory) to continue 
and ensuring the task executes successfully.
   
   
   ### Why are the changes needed?
   In certain scenarios, such as using Spark SQL to perform an INSERT OVERWRITE 
operation on a dynamically partitioned Hive table, Spark's internal logic will 
first delete the partition directories. When Hive starts writing data and 
executes org.apache.hadoop.hive.ql.metadata.Hive#replaceFiles, a 
FileNotFoundException may be thrown, causing the task to fail. However, 
org.apache.hadoop.hive.ql.metadata.Hive#replaceFiles contains logic to create 
the partition directories, which cannot be executed due to the error causing an 
early exit. Therefore, it is necessary to catch and handle this exception.
   
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   ### Is the change a dependency upgrade?
   No
   
   
   ### How was this patch tested?
   Replace the hive-exec-3.1.3.jar file in the h'ive cluster after rebuilding 
and tested locally.
   


-- 
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