Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deserializing Joda DateTime as Long type #255

Open
mkhsueh opened this issue Sep 19, 2016 · 0 comments
Open

Deserializing Joda DateTime as Long type #255

mkhsueh opened this issue Sep 19, 2016 · 0 comments

Comments

@mkhsueh
Copy link

mkhsueh commented Sep 19, 2016

Ran into this error deserializing Joda DateTime into an Avro model:
java.lang.Long cannot be cast to org.joda.time.DateTime
was able to serialize a record with this value: {"name": "eventTime", "type": {"type": "long", "logicalType": "timestamp-millis"}}, but calling injection.invert(the serialized byte[]).get() throws that error.

My injection object :

private static Injection<MyModel, byte[]> injection = SpecificAvroCodecs.toBinary(scala.reflect.ClassTag$.MODULE$.apply(MyModel.class)); 

Dug into the codebase ( DateBijectionLaws.scala ) looks like round trips were expected using 'String'. Changing the underlying Avro schema to type "string" worked. Should there be dual support for string/long given the timestamp-millis logical type?

Thanks,
Michael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant