You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/12/21 04:56:00 UTC

[GitHub] [spark] gengliangwang commented on a diff in pull request #39148: [DON'T MERGE] Introduce `ProtoBufSerDe` as a SPI

gengliangwang commented on code in PR #39148:
URL: https://github.com/apache/spark/pull/39148#discussion_r1053983534


##########
core/src/main/scala/org/apache/spark/status/protobuf/ApplicationEnvironmentInfoWrapperSerializer.scala:
##########
@@ -23,8 +23,14 @@ import org.apache.spark.resource.{ExecutorResourceRequest, TaskResourceRequest}
 import org.apache.spark.status.ApplicationEnvironmentInfoWrapper
 import org.apache.spark.status.api.v1.{ApplicationEnvironmentInfo, ResourceProfileInfo, RuntimeInfo}
 
-object ApplicationEnvironmentInfoWrapperSerializer {
-  def serialize(input: ApplicationEnvironmentInfoWrapper): Array[Byte] = {
+class ApplicationEnvironmentInfoWrapperSerializer extends ProtoBufSerDe {
+
+  override val supportClass: Class[_] = classOf[ApplicationEnvironmentInfoWrapper]
+
+  override def serialize(input: Any): Array[Byte] =

Review Comment:
   Is it possible to change the `Any` here to be `ApplicationEnvironmentInfoWrapper`? The trait `ProtoBufSerDe` can become `ProtoBufSerDe[T]`.
   I haven't look into it closely. But if we can avoid the `asInstanceOf` here, the proposal looks good.
   
   



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