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

Missing encoding for Short and Byte in Cassandra contexts #1009

Closed
mosyp opened this issue Jan 5, 2018 · 9 comments
Closed

Missing encoding for Short and Byte in Cassandra contexts #1009

mosyp opened this issue Jan 5, 2018 · 9 comments

Comments

@mosyp
Copy link
Collaborator

mosyp commented Jan 5, 2018

Version: 2.3.2
Module: quill-cassandra

Expected behavior

Provide encoders/decoders form Short and Byte

Actual behavior

Encoders/decoders are missing

Workaround

implicit val byteDecoder: Decoder[Byte] = decoder(_.getByte)
implicit val byteEncoder: Encoder[Byte] = encoder(_.setByte)

implicit val shortDecoder: Decoder[Short] = decoder(_.getShort)
implicit val shortEncoder: Encoder[Short] = encoder(_.setShort)

@getquill/maintainers

@blueberrynotblue
Copy link

@mentegy what's the exact type of Decoder?

@mosyp
Copy link
Collaborator Author

mosyp commented Jan 5, 2018

@blueberrynotblue Encoding is driver dependent, however in general those are functions to extract value from a result row (Decoder) and prepare value to prepare row (Encoder). Example in http://getquill.io/#extending-quill-custom-encoding-raw-encoding

@blueberrynotblue
Copy link

@mentegy how do I write codec for Map[x,y] , I think the most confusing part is which types got support from quill and which needs codec.

@mosyp
Copy link
Collaborator Author

mosyp commented Jan 5, 2018

@mosyp
Copy link
Collaborator Author

mosyp commented Jan 5, 2018

@blueberrynotblue one more note, quill itself does not provide any codec for cassandra. We have our own layers called Encoder/Decoder and provide mapping for common types

@blueberrynotblue
Copy link

@mentegy thx a lot!!

@blueberrynotblue
Copy link

blueberrynotblue commented Jan 10, 2018

@mentegy hi,
com.datastax.driver.core.exceptions.CodecNotFoundException: Codec not found for requested operation: [tinyint <-> java.lang.Short] didn't dispear. I tried raw coding and your solution above.

CodecNotFoundException found in casssandra types of [tinyint,date] so far.

In datastax library, there're these codec code, which is weird.

My enviroment:
cassandra 3.11.1
dependency: "io.getquill" %% "quill-cassandra" % "2.3.2"
scala:2.12.2

@mosyp
Copy link
Collaborator Author

mosyp commented Jan 10, 2018

@blueberrynotblue Could you prepare reproducible and dedicated code for me, so I can take a look?

@deusaquilus
Copy link
Collaborator

This would also be very useful to do for quill-jdbc since most SQL dialects have a tinyint. Also an encoding for Char would be very useful for varchar(1) columns.

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

No branches or pull requests

3 participants