LuciferYang commented on code in PR #39666:
URL: https://github.com/apache/spark/pull/39666#discussion_r1082248889


##########
core/src/main/scala/org/apache/spark/status/protobuf/Utils.scala:
##########
@@ -17,10 +17,24 @@
 
 package org.apache.spark.status.protobuf
 
+import com.google.protobuf.MessageOrBuilder
+
 object Utils {
   def getOptional[T](condition: Boolean, result: () => T): Option[T] = if 
(condition) {
     Some(result())
   } else {
     None
   }
+
+  def setStringField(input: String, f: String => MessageOrBuilder): Unit = {

Review Comment:
   Should we make this function more general? Such as 
   
   ```
     def setField[T](input: T, f: T => MessageOrBuilder): Unit = {
       if (input != null) {
         f(input)
       }
     }
   ```
   Other types of input may also be null, such as map.
   
   
https://github.com/apache/spark/blob/ec424c5b0e392acc57e825fb94a21d6963ebece9/sql/core/src/main/scala/org/apache/spark/status/protobuf/sql/SQLExecutionUIDataSerializer.scala#L37-L41
   
   



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