Closed glammers1 closed 5 years ago
the issue seems to be this line:
MappedEncoding[CassandraDriverLocalDate, LocalDate](new LocalDate(_))
the LocalDate
constructor seems to reject the CassandraDriverLocalDate
value. It doesn't seem to be a quill bug, but feel free to reopen if necessary.
You are entirely right, I had been changing in my program the CQL data types related with dates from text to timestamp, date... I have had other issues (fixed prior to this one) and I was not aware that LocalDate
constructor had the problem in runtime :man_facepalming:
@ CassandraDriverLocalDate.fromYearMonthDay(2018, 11, 14)
res5: com.datastax.driver.core.LocalDate = 2018-11-14
@ new LocalDate(res5)
java.lang.IllegalArgumentException: No partial converter found for type: com.datastax.driver.core.LocalDate
org.joda.time.convert.ConverterManager.getPartialConverter(ConverterManager.java:253)
org.joda.time.LocalDate.<init>(LocalDate.java:415)
org.joda.time.LocalDate.<init>(LocalDate.java:363)
ammonite.$sess.cmd6$.<init>(cmd6.sc:1)
ammonite.$sess.cmd6$.<clinit>(cmd6.sc)
I've changed to:
implicit val decodeLocalDate: MappedEncoding[CassandraDriverLocalDate, LocalDate] =
MappedEncoding[CassandraDriverLocalDate, LocalDate](ld =>
new LocalDate(ld.getYear, ld.getMonth, ld.getDay))
Thanks! Sorry for the time spent on this, keep up the good work!
Version: 2.5.4 Module: quill-cassandra Database: cassandra
Expected behavior
Custom MappedEncoding for
org.joda.time.LocalDate
should work like the one already supported forjava.time.LocalDate
in quill-cassandraActual behavior
Insert (encode) works fine but read operation (decode) throws the following exception:
Steps to reproduce the behavior
I'm using Ammonite to reproduce the error. I've attached a zip with two files for both joda and java.time examples.
First, create a C* keyspace "test_quill" with a table "my_table".
Workaround
Use raw enconding for joda:
Why?
test_cases.zip
@getquill/maintainers