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


##########
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'd fix this just for completeness, since it sounds like a pretty narrowly 
scoped fix. IIUC, we'd just call `freshCopyIfContainsStatefulExpression` for 
each of these nodes. If that's incorrect and the required fix is much larger, 
then I think it'd be defensible to push back, given how unlikely this failure 
is.



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