[ 
https://issues.apache.org/jira/browse/SPARK-15489?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15297087#comment-15297087
 ] 

Amit Sela commented on SPARK-15489:
-----------------------------------

This is my registrator:

public class ImmutableRegistrator implements KryoRegistrator {

  @Override
  public void registerClasses(Kryo kryo) {
    try {
      
kryo.register(Class.forName("java.util.Collections$UnmodifiableCollection"),
              new UnmodifiableCollectionsSerializer());
      kryo.register(ImmutableList.class, new ImmutableListSerializer());
    } catch (ClassNotFoundException e) {
      //
    }
  }
}

And I register with: 
conf.set("spark.kryo.registrator", 
ImmutableRegistrator.class.getCanonicalName())

When KryoSerializer.deserializeStream is called I see my registrar in 
KryoSerializerInstance, but when KryoSerializer.deserialize[T: ClassTag](bytes: 
ByteBuffer) is called I'm not so sure, if the instance is this.ks then no, I 
don't see my registrar.


> Dataset kryo encoder fails on Collections$UnmodifiableCollection
> ----------------------------------------------------------------
>
>                 Key: SPARK-15489
>                 URL: https://issues.apache.org/jira/browse/SPARK-15489
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 1.6.1
>            Reporter: Amit Sela
>
> When using Encoders with kryo to encode generically typed Objects in the 
> following manner:
> public static <T> Encoder<T> encoder() {
>   return Encoders.kryo((Class<T>) Object.class);
> }
> I get a decoding exception when trying to decode 
> `java.util.Collections$UnmodifiableCollection`, which probably comes from 
> Guava's `ImmutableList`.
> This happens when running with master = local[1]. Same code had no problems 
> with RDD api.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to