You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can see CassandraRow contains nested data which will be stored as a UDT value and that OuterData also contains InnerData which is also stored as a UDT value, so we have a UDT value in a Row and a UDT value within a UDT value.
How do the implicits resolve to build a CqlDecoder?
For a: Int -> we have a CqlPrimitiveDecoder[Int] - this gets summoned in the derivation (before going through the implicit conversion from PrimitiveDecoder -> CqlDecoder)
For b: Long -> we have a CqlPrimitiveDecoder[Long] - this gets summoned in the derivation (before going through the implicit conversion from PrimitiveDecoder -> CqlDecoder)
For c: OuterData -> this is more interesting, this ends up having a CqlPrimitiveDecoder[OuterData], but how does that get materialized?
We get that through CqlUDTValueDecoder[OuterData]
If we step through the derivation of CqlUdtValueDecoder[OuterData], we'll find that it uses CqlPrimitiveDecoder to summon instances of String (x and y) and then you'll notice InnerData is also a UDTValue, so what ends up happening is you use CqlPrimitiveDecoder[InnerData] which ends up calling out to CqlUDTValueDecoder[InnerData] which ends up calling back out to CqlPrimitiveDecoder[Int] (the i: Int in InnerData).
You can see that CqlPrimitiveDecoder is a bridge that links all the mechanisms together
Perhaps this linking mechanism is unnecessary but this is how it currently works.
The text was updated successfully, but these errors were encountered:
For example:
Given the following Cassandra Row
We can see
CassandraRow
contains nested data which will be stored as a UDT value and thatOuterData
also containsInnerData
which is also stored as a UDT value, so we have a UDT value in a Row and a UDT value within a UDT value.How do the implicits resolve to build a
CqlDecoder
?For a: Int -> we have a CqlPrimitiveDecoder[Int] - this gets summoned in the derivation (before going through the implicit conversion from PrimitiveDecoder -> CqlDecoder)
For b: Long -> we have a CqlPrimitiveDecoder[Long] - this gets summoned in the derivation (before going through the implicit conversion from PrimitiveDecoder -> CqlDecoder)
For c: OuterData -> this is more interesting, this ends up having a CqlPrimitiveDecoder[OuterData], but how does that get materialized?
We get that through CqlUDTValueDecoder[OuterData]
If we step through the derivation of
CqlUdtValueDecoder[OuterData]
, we'll find that it usesCqlPrimitiveDecoder
to summon instances of String (x and y) and then you'll notice InnerData is also a UDTValue, so what ends up happening is you use CqlPrimitiveDecoder[InnerData] which ends up calling out to CqlUDTValueDecoder[InnerData] which ends up calling back out to CqlPrimitiveDecoder[Int] (the i: Int in InnerData).You can see that
CqlPrimitiveDecoder
is a bridge that links all the mechanisms togetherPerhaps this linking mechanism is unnecessary but this is how it currently works.
The text was updated successfully, but these errors were encountered: