com.datastax.driver.core.exceptions.InvalidTypeException: Value number is of type varint

Spring JIRA | Peter Cable | 2 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    BigInteger columns map to varint in Cassandra. ColumnReader attempts to read varint columns back as Integers, which throws an exception. I have submitted a pull request with a test for this condition and a fix. Stack trace on failure follows: testQueryWithReference(org.springframework.data.cassandra.test.integration.querymethods.bigintparam.BigIntParamIntegrationTests) Time elapsed: 0.212 sec <<< ERROR! com.datastax.driver.core.exceptions.InvalidTypeException: Value number is of type varint at com.datastax.driver.core.AbstractGettableByIndexData.checkType(AbstractGettableByIndexData.java:73) at com.datastax.driver.core.AbstractGettableByIndexData.getInt(AbstractGettableByIndexData.java:119) at com.datastax.driver.core.AbstractGettableData.getInt(AbstractGettableData.java:24) at org.springframework.data.cassandra.convert.ColumnReader.get(ColumnReader.java:71) at org.springframework.data.cassandra.convert.ColumnReader.get(ColumnReader.java:38) at org.springframework.data.cassandra.convert.ColumnReader.get(ColumnReader.java:30) at org.springframework.data.cassandra.convert.BasicCassandraRowValueProvider.getPropertyValue(BasicCassandraRowValueProvider.java:64) at org.springframework.data.cassandra.convert.MappingCassandraConverter.readPropertyFromRow(MappingCassandraConverter.java:186) at org.springframework.data.cassandra.convert.MappingCassandraConverter$1.doWithPersistentProperty(MappingCassandraConverter.java:150) at org.springframework.data.cassandra.convert.MappingCassandraConverter$1.doWithPersistentProperty(MappingCassandraConverter.java:145) at org.springframework.data.mapping.model.BasicPersistentEntity.doWithProperties(BasicPersistentEntity.java:309) at org.springframework.data.cassandra.convert.MappingCassandraConverter.readPropertiesFromRow(MappingCassandraConverter.java:145) at org.springframework.data.cassandra.convert.MappingCassandraConverter.readEntityFromRow(MappingCassandraConverter.java:137) at org.springframework.data.cassandra.convert.MappingCassandraConverter.readRow(MappingCassandraConverter.java:114) at org.springframework.data.cassandra.convert.MappingCassandraConverter.read(MappingCassandraConverter.java:202) at org.springframework.data.cassandra.repository.query.AbstractCassandraQuery.getSingleEntity(AbstractCassandraQuery.java:176) at org.springframework.data.cassandra.repository.query.AbstractCassandraQuery.execute(AbstractCassandraQuery.java:133) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:395) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:373) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) at com.sun.proxy.$Proxy52.findThingByBigInteger(Unknown Source) at org.springframework.data.cassandra.test.integration.querymethods.bigintparam.BigIntParamIntegrationTests.testQueryWithReference(BigIntParamIntegrationTests.java:45)

    Spring JIRA | 2 years ago | Peter Cable
    com.datastax.driver.core.exceptions.InvalidTypeException: Value number is of type varint
  2. 0

    BigInteger columns map to varint in Cassandra. ColumnReader attempts to read varint columns back as Integers, which throws an exception. I have submitted a pull request with a test for this condition and a fix. Stack trace on failure follows: testQueryWithReference(org.springframework.data.cassandra.test.integration.querymethods.bigintparam.BigIntParamIntegrationTests) Time elapsed: 0.212 sec <<< ERROR! com.datastax.driver.core.exceptions.InvalidTypeException: Value number is of type varint at com.datastax.driver.core.AbstractGettableByIndexData.checkType(AbstractGettableByIndexData.java:73) at com.datastax.driver.core.AbstractGettableByIndexData.getInt(AbstractGettableByIndexData.java:119) at com.datastax.driver.core.AbstractGettableData.getInt(AbstractGettableData.java:24) at org.springframework.data.cassandra.convert.ColumnReader.get(ColumnReader.java:71) at org.springframework.data.cassandra.convert.ColumnReader.get(ColumnReader.java:38) at org.springframework.data.cassandra.convert.ColumnReader.get(ColumnReader.java:30) at org.springframework.data.cassandra.convert.BasicCassandraRowValueProvider.getPropertyValue(BasicCassandraRowValueProvider.java:64) at org.springframework.data.cassandra.convert.MappingCassandraConverter.readPropertyFromRow(MappingCassandraConverter.java:186) at org.springframework.data.cassandra.convert.MappingCassandraConverter$1.doWithPersistentProperty(MappingCassandraConverter.java:150) at org.springframework.data.cassandra.convert.MappingCassandraConverter$1.doWithPersistentProperty(MappingCassandraConverter.java:145) at org.springframework.data.mapping.model.BasicPersistentEntity.doWithProperties(BasicPersistentEntity.java:309) at org.springframework.data.cassandra.convert.MappingCassandraConverter.readPropertiesFromRow(MappingCassandraConverter.java:145) at org.springframework.data.cassandra.convert.MappingCassandraConverter.readEntityFromRow(MappingCassandraConverter.java:137) at org.springframework.data.cassandra.convert.MappingCassandraConverter.readRow(MappingCassandraConverter.java:114) at org.springframework.data.cassandra.convert.MappingCassandraConverter.read(MappingCassandraConverter.java:202) at org.springframework.data.cassandra.repository.query.AbstractCassandraQuery.getSingleEntity(AbstractCassandraQuery.java:176) at org.springframework.data.cassandra.repository.query.AbstractCassandraQuery.execute(AbstractCassandraQuery.java:133) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:395) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:373) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) at com.sun.proxy.$Proxy52.findThingByBigInteger(Unknown Source) at org.springframework.data.cassandra.test.integration.querymethods.bigintparam.BigIntParamIntegrationTests.testQueryWithReference(BigIntParamIntegrationTests.java:45)

    Spring JIRA | 2 years ago | Peter Cable
    com.datastax.driver.core.exceptions.InvalidTypeException: Value number is of type varint

    Root Cause Analysis

    1. com.datastax.driver.core.exceptions.InvalidTypeException

      Value number is of type varint

      at com.datastax.driver.core.AbstractGettableByIndexData.checkType()
    2. DataStax Java Driver for Apache Cassandra - Core
      AbstractGettableData.getInt
      1. com.datastax.driver.core.AbstractGettableByIndexData.checkType(AbstractGettableByIndexData.java:73)
      2. com.datastax.driver.core.AbstractGettableByIndexData.getInt(AbstractGettableByIndexData.java:119)
      3. com.datastax.driver.core.AbstractGettableData.getInt(AbstractGettableData.java:24)
      3 frames
    3. Spring Data Cassandra - Core
      MappingCassandraConverter$1.doWithPersistentProperty
      1. org.springframework.data.cassandra.convert.ColumnReader.get(ColumnReader.java:71)
      2. org.springframework.data.cassandra.convert.ColumnReader.get(ColumnReader.java:38)
      3. org.springframework.data.cassandra.convert.ColumnReader.get(ColumnReader.java:30)
      4. org.springframework.data.cassandra.convert.BasicCassandraRowValueProvider.getPropertyValue(BasicCassandraRowValueProvider.java:64)
      5. org.springframework.data.cassandra.convert.MappingCassandraConverter.readPropertyFromRow(MappingCassandraConverter.java:186)
      6. org.springframework.data.cassandra.convert.MappingCassandraConverter$1.doWithPersistentProperty(MappingCassandraConverter.java:150)
      7. org.springframework.data.cassandra.convert.MappingCassandraConverter$1.doWithPersistentProperty(MappingCassandraConverter.java:145)
      7 frames
    4. Spring Data Core
      BasicPersistentEntity.doWithProperties
      1. org.springframework.data.mapping.model.BasicPersistentEntity.doWithProperties(BasicPersistentEntity.java:309)
      1 frame
    5. Spring Data Cassandra - Core
      AbstractCassandraQuery.execute
      1. org.springframework.data.cassandra.convert.MappingCassandraConverter.readPropertiesFromRow(MappingCassandraConverter.java:145)
      2. org.springframework.data.cassandra.convert.MappingCassandraConverter.readEntityFromRow(MappingCassandraConverter.java:137)
      3. org.springframework.data.cassandra.convert.MappingCassandraConverter.readRow(MappingCassandraConverter.java:114)
      4. org.springframework.data.cassandra.convert.MappingCassandraConverter.read(MappingCassandraConverter.java:202)
      5. org.springframework.data.cassandra.repository.query.AbstractCassandraQuery.getSingleEntity(AbstractCassandraQuery.java:176)
      6. org.springframework.data.cassandra.repository.query.AbstractCassandraQuery.execute(AbstractCassandraQuery.java:133)
      6 frames
    6. Spring Data Core
      RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke
      1. org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:395)
      2. org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:373)
      2 frames
    7. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      2. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
      2 frames
    8. com.sun.proxy
      $Proxy52.findThingByBigInteger
      1. com.sun.proxy.$Proxy52.findThingByBigInteger(Unknown Source)
      1 frame
    9. org.springframework.data
      BigIntParamIntegrationTests.testQueryWithReference
      1. org.springframework.data.cassandra.test.integration.querymethods.bigintparam.BigIntParamIntegrationTests.testQueryWithReference(BigIntParamIntegrationTests.java:45)
      1 frame