rangadi commented on code in PR #40654:
URL: https://github.com/apache/spark/pull/40654#discussion_r1188071319


##########
connector/connect/server/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala:
##########
@@ -1567,6 +1613,19 @@ class SparkConnectPlanner(val session: SparkSession) {
         val expr = transformExpression(fun.getArguments(0))
         Some(transformUnregisteredUDF(MLFunctions.arrayToVectorUdf, Seq(expr)))
 
+      // Protobuf-specific functions
+      case "from_protobuf" if Seq(2, 3, 4).contains(fun.getArgumentsCount) =>
+        val children = 
fun.getArgumentsList.asScala.toSeq.map(transformExpression)
+        val (messageClassName, descFilePathOpt, options) =
+          extractArgsOfProtobufFunction("from_protobuf", 
fun.getArgumentsCount, children)
+        Some(ProtobufDataToCatalyst(children.head, messageClassName, 
descFilePathOpt, options))

Review Comment:
   Is it better to call `from_protobuf()` rather than invoking 
`ProtobufDataToCatalyst` directly? 
   Any future changes for `from_protobuf()` will apply automatically to these. 



##########
connector/protobuf/src/main/scala/org/apache/spark/sql/protobuf/CatalystDataToProtobuf.scala:
##########
@@ -23,7 +23,7 @@ import 
org.apache.spark.sql.catalyst.expressions.codegen.{CodegenContext, ExprCo
 import org.apache.spark.sql.protobuf.utils.ProtobufUtils
 import org.apache.spark.sql.types.{BinaryType, DataType}
 
-private[protobuf] case class CatalystDataToProtobuf(
+private[sql] case class CatalystDataToProtobuf(

Review Comment:
   If we call public API `from_protobuf()`, we would not need this. 



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