You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@samza.apache.org by Ruslan Khafizov <ru...@gmail.com> on 2015/02/10 14:26:09 UTC

Review Request 30825: SAMZA-547: Add Java Serializable Serde

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/30825/
-----------------------------------------------------------

Review request for samza.


Repository: samza


Description
-------

I added 2 implementations as I'm not sure how Serde will be used.
Intention is to add only one but I need feedback to make correct trade-off.

Generic serializer SerializableSerde creates quite clumsy API because it takes and returns Serializable. So real objects need to be casted as shown in TestSerializableSerde.

```scala
serde.toBytes(obj.asInstanceOf[java.io.Serializable])
val objRoundTrip:String = serde.fromBytes(bytes).asInstanceOf[String]
```

Type-specific one SerializableTypeSerde gives more clean API but most other Serdes instantiated from config string. Not sure type can be passed in runtime.


Diffs
-----

  samza-core/src/main/scala/org/apache/samza/serializers/SerializableSerde.scala PRE-CREATION 
  samza-core/src/main/scala/org/apache/samza/serializers/SerializableTypeSerde.scala PRE-CREATION 
  samza-core/src/test/scala/org/apache/samza/serializers/TestSerializableSerde.scala PRE-CREATION 
  samza-core/src/test/scala/org/apache/samza/serializers/TestSerializableTypeSerde.scala PRE-CREATION 

Diff: https://reviews.apache.org/r/30825/diff/


Testing
-------


Thanks,

Ruslan Khafizov


Re: Review Request 30825: SAMZA-547: Add Java Serializable Serde

Posted by Ruslan Khafizov <ru...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/30825/
-----------------------------------------------------------

(Updated Feb. 12, 2015, 10:18 p.m.)


Review request for samza.


Repository: samza


Description
-------

I added 2 implementations as I'm not sure how Serde will be used.
Intention is to add only one but I need feedback to make correct trade-off.

Generic serializer SerializableSerde creates quite clumsy API because it takes and returns Serializable. So real objects need to be casted as shown in TestSerializableSerde.

```scala
serde.toBytes(obj.asInstanceOf[java.io.Serializable])
val objRoundTrip:String = serde.fromBytes(bytes).asInstanceOf[String]
```

Type-specific one SerializableTypeSerde gives more clean API but most other Serdes instantiated from config string. Not sure type can be passed in runtime.


Diffs (updated)
-----

  samza-core/src/main/scala/org/apache/samza/serializers/SerializableSerde.scala PRE-CREATION 
  samza-core/src/test/scala/org/apache/samza/serializers/TestSerializableSerde.scala PRE-CREATION 

Diff: https://reviews.apache.org/r/30825/diff/


Testing
-------


Thanks,

Ruslan Khafizov


Re: Review Request 30825: SAMZA-547: Add Java Serializable Serde

Posted by Ruslan Khafizov <ru...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/30825/
-----------------------------------------------------------

(Updated Feb. 11, 2015, 1:31 p.m.)


Review request for samza.


Repository: samza


Description
-------

I added 2 implementations as I'm not sure how Serde will be used.
Intention is to add only one but I need feedback to make correct trade-off.

Generic serializer SerializableSerde creates quite clumsy API because it takes and returns Serializable. So real objects need to be casted as shown in TestSerializableSerde.

```scala
serde.toBytes(obj.asInstanceOf[java.io.Serializable])
val objRoundTrip:String = serde.fromBytes(bytes).asInstanceOf[String]
```

Type-specific one SerializableTypeSerde gives more clean API but most other Serdes instantiated from config string. Not sure type can be passed in runtime.


Diffs (updated)
-----

  samza-core/src/main/scala/org/apache/samza/serializers/SerializableSerde.scala PRE-CREATION 
  samza-core/src/test/scala/org/apache/samza/serializers/TestSerializableSerde.scala PRE-CREATION 

Diff: https://reviews.apache.org/r/30825/diff/


Testing
-------


Thanks,

Ruslan Khafizov