konjac commented on code in PR #47820:
URL: https://github.com/apache/spark/pull/47820#discussion_r1739152667


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/WriteToDataSourceV2Exec.scala:
##########
@@ -55,6 +57,19 @@ case class WriteToDataSourceV2(
     copy(query = newChild)
 }
 
+object WriteToDataSourceV2Exec {
+  // Returns None if it detects table created by a concurrent command and 
ifNotExists is true.
+  def handleConcurrentCreateExceptions[T](ifNotExists: Boolean)(block: => T): 
Option[T] = {
+    try {
+      Some(block)
+    } catch {
+      // Committing to the table failed because of a concurrent table creation 
to catalog,
+      // but we ignore the exception when IF NOT EXISTS is true.
+      case _: TableAlreadyExistsException if ifNotExists => None

Review Comment:
   Is there any log for this silented exception so that user can understand 
what happens behind?



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