You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by "Roger Fischer (CW)" <rf...@Brocade.com> on 2017/07/14 20:58:00 UTC

CodecNotFoundException: [smallint <-> java.lang.Integer] with Cassandra

Hello,

there seems to be a problem with mapping between Cassandra numerical types to Java types. I am using ver. 2.0.0#20170430-sha1:d4eef3c6.

In Cassandra, the column is defined as "smallint".
In the Java POJO, the field is defined as "Short"
In the configuration (QueryEntity), the field is defined as "java.lang.Short".
Nothing was defined as java.lang.Integer.

Loading an object from Cassandra to Ignite (get with cache-miss, or loadCache()) resulted in the following exception:
com.datastax.driver.core.exceptions.CodecNotFoundException: Codec not found for requested operation: [smallint <-> java.lang.Integer]

It seems that the type defined on the Ignite side is not properly propagated to the Cassandra driver, and Cassandra perceives it as an Integer.

When I define everything (column and all fields) as int/java.lang.Integer, then all is well.

I also tried with "tinyint" and java.lang.Byte. In this case the Java driver tried (and failed) to map to java.nio.ByteBuffer.

Caused by: com.datastax.driver.core.exceptions.CodecNotFoundException: Codec not found for requested operation: [smallint <-> java.lang.Integer]
        at com.datastax.driver.core.CodecRegistry.notFound(CodecRegistry.java:679)
        at com.datastax.driver.core.CodecRegistry.createCodec(CodecRegistry.java:526)
        at com.datastax.driver.core.CodecRegistry.findCodec(CodecRegistry.java:506)
        at com.datastax.driver.core.CodecRegistry.access$200(CodecRegistry.java:140)
        at com.datastax.driver.core.CodecRegistry$TypeCodecCacheLoader.load(CodecRegistry.java:211)
        at com.datastax.driver.core.CodecRegistry$TypeCodecCacheLoader.load(CodecRegistry.java:208)
        at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3542)
        at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2323)
        at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2286)
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2201)
        at com.google.common.cache.LocalCache.get(LocalCache.java:3953)
        at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3957)
        at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4875)
        at com.datastax.driver.core.CodecRegistry.lookupCodec(CodecRegistry.java:480)
        at com.datastax.driver.core.CodecRegistry.codecFor(CodecRegistry.java:448)
        at com.datastax.driver.core.CodecRegistry.codecFor(CodecRegistry.java:430)
        at com.datastax.driver.core.AbstractGettableByIndexData.codecFor(AbstractGettableByIndexData.java:69)
        at com.datastax.driver.core.AbstractGettableByIndexData.getInt(AbstractGettableByIndexData.java:139)
        at com.datastax.driver.core.AbstractGettableData.getInt(AbstractGettableData.java:26)
        at com.datastax.driver.core.AbstractGettableData.getInt(AbstractGettableData.java:87)
        at org.apache.ignite.cache.store.cassandra.common.PropertyMappingHelper.getCassandraColumnValue(PropertyMappingHelper.java:157)
        at org.apache.ignite.cache.store.cassandra.persistence.PojoField.setValueFromRow(PojoField.java:181)
        at org.apache.ignite.cache.store.cassandra.persistence.PersistenceController.buildObject(PersistenceController.java:406)
        at org.apache.ignite.cache.store.cassandra.persistence.PersistenceController.buildValueObject(PersistenceController.java:228)
        at org.apache.ignite.cache.store.cassandra.CassandraCacheStore$1.process(CassandraCacheStore.java:201)
        at org.apache.ignite.cache.store.cassandra.session.CassandraSessionImpl.execute(CassandraSessionImpl.java:148)
        ... 14 more


Roger

Re: CodecNotFoundException: [smallint <-> java.lang.Integer] with Cassandra

Posted by Andrey Mashenkov <an...@gmail.com>.
Hi,

I've found that there is no Short<->SMALLINT mapping in ignite. I see only
Short<->INT.
Looks like a bug to me, so I've create a ticket [1].

[1] https://issues.apache.org/jira/browse/IGNITE-5779

On Fri, Jul 14, 2017 at 11:58 PM, Roger Fischer (CW) <rf...@brocade.com>
wrote:

> Hello,
>
>
>
> there seems to be a problem with mapping between Cassandra numerical types
> to Java types. I am using ver. 2.0.0#20170430-sha1:d4eef3c6.
>
>
>
> In Cassandra, the column is defined as “smallint”.
>
> In the Java POJO, the field is defined as “Short”
>
> In the configuration (QueryEntity), the field is defined as
> “java.lang.Short”.
>
> Nothing was defined as java.lang.Integer.
>
>
>
> Loading an object from Cassandra to Ignite (get with cache-miss, or
> loadCache()) resulted in the following exception:
>
> com.datastax.driver.core.exceptions.CodecNotFoundException: Codec not
> found for requested operation: [smallint <-> java.lang.Integer]
>
>
>
> It seems that the type defined on the Ignite side is not properly
> propagated to the Cassandra driver, and Cassandra perceives it as an
> Integer.
>
>
>
> When I define everything (column and all fields) as int/java.lang.Integer,
> then all is well.
>
>
>
> I also tried with “tinyint” and java.lang.Byte. In this case the Java
> driver tried (and failed) to map to java.nio.ByteBuffer.
>
>
>
> Caused by: com.datastax.driver.core.exceptions.CodecNotFoundException:
> Codec not found for requested operation: [smallint <-> java.lang.Integer]
>
>         at com.datastax.driver.core.CodecRegistry.notFound(
> CodecRegistry.java:679)
>
>         at com.datastax.driver.core.CodecRegistry.createCodec(
> CodecRegistry.java:526)
>
>         at com.datastax.driver.core.CodecRegistry.findCodec(
> CodecRegistry.java:506)
>
>         at com.datastax.driver.core.CodecRegistry.access$200(
> CodecRegistry.java:140)
>
>         at com.datastax.driver.core.CodecRegistry$
> TypeCodecCacheLoader.load(CodecRegistry.java:211)
>
>         at com.datastax.driver.core.CodecRegistry$
> TypeCodecCacheLoader.load(CodecRegistry.java:208)
>
>         at com.google.common.cache.LocalCache$LoadingValueReference.
> loadFuture(LocalCache.java:3542)
>
>         at com.google.common.cache.LocalCache$Segment.loadSync(
> LocalCache.java:2323)
>
>         at com.google.common.cache.LocalCache$Segment.
> lockedGetOrLoad(LocalCache.java:2286)
>
>         at com.google.common.cache.LocalCache$Segment.get(
> LocalCache.java:2201)
>
>         at com.google.common.cache.LocalCache.get(LocalCache.java:3953)
>
>         at com.google.common.cache.LocalCache.getOrLoad(
> LocalCache.java:3957)
>
>         at com.google.common.cache.LocalCache$LocalLoadingCache.
> get(LocalCache.java:4875)
>
>         at com.datastax.driver.core.CodecRegistry.lookupCodec(
> CodecRegistry.java:480)
>
>         at com.datastax.driver.core.CodecRegistry.codecFor(
> CodecRegistry.java:448)
>
>         at com.datastax.driver.core.CodecRegistry.codecFor(
> CodecRegistry.java:430)
>
>         at com.datastax.driver.core.AbstractGettableByIndexData.codecFor(
> AbstractGettableByIndexData.java:69)
>
>         at com.datastax.driver.core.AbstractGettableByIndexData.getInt(
> AbstractGettableByIndexData.java:139)
>
>         at com.datastax.driver.core.AbstractGettableData.getInt(
> AbstractGettableData.java:26)
>
>         at com.datastax.driver.core.AbstractGettableData.getInt(
> AbstractGettableData.java:87)
>
>         at org.apache.ignite.cache.store.cassandra.common.
> PropertyMappingHelper.getCassandraColumnValue(PropertyMappingHelper.java:
> 157)
>
>         at org.apache.ignite.cache.store.cassandra.persistence.
> PojoField.setValueFromRow(PojoField.java:181)
>
>         at org.apache.ignite.cache.store.cassandra.persistence.
> PersistenceController.buildObject(PersistenceController.java:406)
>
>         at org.apache.ignite.cache.store.cassandra.persistence.
> PersistenceController.buildValueObject(PersistenceController.java:228)
>
>         at org.apache.ignite.cache.store.cassandra.CassandraCacheStore$
> 1.process(CassandraCacheStore.java:201)
>
>         at org.apache.ignite.cache.store.cassandra.session.
> CassandraSessionImpl.execute(CassandraSessionImpl.java:148)
>
>         ... 14 more
>
>
>
>
>
> Roger
>



-- 
Best regards,
Andrey V. Mashenkov