Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/13335#discussion_r65411215
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/Offset.scala 
---
    @@ -17,11 +17,14 @@
     
     package org.apache.spark.sql.execution.streaming
     
    +import com.fasterxml.jackson.annotation.JsonTypeInfo
    +
     /**
      * An offset is a monotonically increasing metric used to track progress 
in the computation of a
      * stream. An [[Offset]] must be comparable, and the result of `compareTo` 
must be consistent
      * with `equals` and `hashcode`.
      */
    +@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = 
JsonTypeInfo.As.PROPERTY, property = "@class")
    --- End diff --
    
    That's why Jackson has javadocs. :-) You read it once instead of having to 
understand how every single type ends up in json by having to read the specific 
manual serialization code for that type...
    
    Anyway, to avoid copy & paste of this kind of code everywhere, it would be 
probably better to have a base trait for "traits that will be serialized in 
events and might have multiple implementations", and have that trait have this 
annotation (like `SparkListenerEvent` does).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to