You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "juliuszsompolski (via GitHub)" <gi...@apache.org> on 2023/07/28 15:12:34 UTC
[GitHub] [spark] juliuszsompolski commented on a diff in pull request #42211: [SPARK-44587] Increase Protobuf Marshaller Recursion Limit
juliuszsompolski commented on code in PR #42211:
URL: https://github.com/apache/spark/pull/42211#discussion_r1277682924
##########
connector/connect/server/src/main/scala/org/apache/spark/sql/connect/service/SparkConnectService.scala:
##########
@@ -160,6 +168,40 @@ class SparkConnectService(debug: Boolean)
userId = request.getUserContext.getUserId,
sessionId = request.getSessionId)
}
+
+ private def customizedMethodDesc(
Review Comment:
add some comment docs
##########
connector/connect/server/src/main/scala/org/apache/spark/sql/connect/service/SparkConnectService.scala:
##########
@@ -160,6 +168,40 @@ class SparkConnectService(debug: Boolean)
userId = request.getUserContext.getUserId,
sessionId = request.getSessionId)
}
+
+ private def customizedMethodDesc(
+ methodDef: MethodDescriptor[MessageLite, MessageLite]
+ ): MethodDescriptor[MessageLite, MessageLite] = {
+ val requestMarshaller =
+ ProtoLiteUtils.marshallerWithRecursionLimit(
+ methodDef
+ .getRequestMarshaller
+ .asInstanceOf[PrototypeMarshaller[MessageLite]]
+ .getMessagePrototype,
+ PROTOBUF_RECURSION_LIMIT
+ )
+ val responseMarshaller =
+ ProtoLiteUtils.marshallerWithRecursionLimit(
+ methodDef
+ .getResponseMarshaller
+ .asInstanceOf[PrototypeMarshaller[MessageLite]]
+ .getMessagePrototype,
+ PROTOBUF_RECURSION_LIMIT
+ )
+ methodDef.toBuilder(requestMarshaller, responseMarshaller).build()
+ }
+
+ override def bindService(): ServerServiceDefinition = {
+ val serviceDef = SparkConnectServiceGrpc.bindService(this)
+ val builder = io.grpc.ServerServiceDefinition.builder(serviceDef.getServiceDescriptor.getName)
+ serviceDef
+ .getMethods
+ .asScala
+ .asInstanceOf[Iterable[ServerMethodDefinition[MessageLite, MessageLite]]]
+ .foreach(method => builder.addMethod(
+ customizedMethodDesc(method.getMethodDescriptor), method.getServerCallHandler))
+ builder.build()
Review Comment:
add some comments explaining what's going on 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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org