kevinwilfong commented on code in PR #10587:
URL: 
https://github.com/apache/incubator-gluten/pull/10587#discussion_r2319606522


##########
gluten-substrait/src/main/scala/org/apache/gluten/utils/SubstraitUtil.scala:
##########
@@ -107,4 +109,20 @@ object SubstraitUtil {
     val nameList = ConverterUtils.collectAttributeNamesWithExprId(output)
     createNameStructBuilder(typeList, nameList, 
Collections.emptyList()).build()
   }
+
+  def convertJavaObjectToAny(obj: AnyRef): Any = {
+    if (obj == null) return null
+    var msg: Message = null
+    obj match {
+      case s: String => msg = StringValue.newBuilder.setValue(s).build
+      case i: Integer => msg = Int32Value.newBuilder.setValue(i).build
+      case l: JLong => msg = Int64Value.newBuilder.setValue(l).build
+      case d: JDouble => msg = DoubleValue.newBuilder.setValue(d).build
+      case _ =>
+        // TODO: generate the message according to the object type
+        msg = StringValue.newBuilder.setValue(obj.toString).build
+    }
+    if (msg == null) return null

Review Comment:
   You're right, I copied that from the original code, but the contract of the 
build functions is that they don't return null so it's safe to remove it.



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