dichlorodiphen commented on code in PR #60148:
URL: https://github.com/apache/spark/pull/60148#discussion_r4543923147


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/toFromProtobufSqlFunctions.scala:
##########
@@ -167,7 +167,10 @@ case class FromProtobuf(
       case bytes: Array[Byte] => Some(bytes)
       case null => None
     }
-    val optionsValue: Map[String, String] = options.eval() match {
+    // Concurrent canonicalization can evaluate the same CreateMap and corrupt 
its map builder.
+    // Copy stateful options to avoid duplicate-key errors and mismatched 
key/value array lengths.
+    val freshOptions = options.freshCopyIfContainsStatefulExpression()

Review Comment:
   I agree that this is a very unlikely failure, but given that this 
persistence of SQLConf values is already precedented (see [here 
](https://github.com/apache/spark/blob/077f3f265f734910d67e755df2f6bc80dadee905/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/avroSqlFunctions.scala#L81-L83)for
 ex), I'd probably go ahead and do the same here.



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