com.datastax.driver.core.exceptions.InvalidTypeException: Invalid type for value 3 of CQL type bigint, expecting class java.lang.Long but class java.lang.Integer provided

DataStax JIRA | Tim McCormack | 3 years ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    When inserting a java.lang.Number into Cassandra, the Datastax driver effectively expects an exact match on the class. This means that callers are expected to pre-coerce their inputs, which is surprising and fragile. (Some libraries, such as Jackson, are fond of producing different Number types depending on the magnitude of the data.) This issue was encountered while using the Cassaforte library from Clojurewerkz (which uses the datastax lib v1.0.3) The stack trace is below: {noformat} com.datastax.driver.core.exceptions.InvalidTypeException: Invalid type for value 3 of CQL type bigint, expecting class java.lang.Long but class java.lang.Integer provided at com.datastax.driver.core.BoundStatement.bind(BoundStatement.java:190) ~[cassandra-driver-core-1.0.3.jar:na] at com.datastax.driver.core.PreparedStatement.bind(PreparedStatement.java:158) ~[cassandra-driver-core-1.0.3.jar:na] at clojurewerkz.cassaforte.client$build_statement.invoke(client.clj:170) ~[classes/:na] at clojurewerkz.cassaforte.client$execute.doInvoke(client.clj:291) ~[classes/:na] at clojure.lang.RestFn.invoke(RestFn.java:457) ~[clojure-1.4.0.jar:na] at clojurewerkz.cassaforte.multi.cql$execute_.invoke(cql.clj:17) ~[classes/:na] at clojurewerkz.cassaforte.multi.cql$insert.doInvoke(cql.clj:132) ~[classes/:na] ... {noformat}

    DataStax JIRA | 3 years ago | Tim McCormack
    com.datastax.driver.core.exceptions.InvalidTypeException: Invalid type for value 3 of CQL type bigint, expecting class java.lang.Long but class java.lang.Integer provided
  2. 0

    When inserting a java.lang.Number into Cassandra, the Datastax driver effectively expects an exact match on the class. This means that callers are expected to pre-coerce their inputs, which is surprising and fragile. (Some libraries, such as Jackson, are fond of producing different Number types depending on the magnitude of the data.) This issue was encountered while using the Cassaforte library from Clojurewerkz (which uses the datastax lib v1.0.3) The stack trace is below: {noformat} com.datastax.driver.core.exceptions.InvalidTypeException: Invalid type for value 3 of CQL type bigint, expecting class java.lang.Long but class java.lang.Integer provided at com.datastax.driver.core.BoundStatement.bind(BoundStatement.java:190) ~[cassandra-driver-core-1.0.3.jar:na] at com.datastax.driver.core.PreparedStatement.bind(PreparedStatement.java:158) ~[cassandra-driver-core-1.0.3.jar:na] at clojurewerkz.cassaforte.client$build_statement.invoke(client.clj:170) ~[classes/:na] at clojurewerkz.cassaforte.client$execute.doInvoke(client.clj:291) ~[classes/:na] at clojure.lang.RestFn.invoke(RestFn.java:457) ~[clojure-1.4.0.jar:na] at clojurewerkz.cassaforte.multi.cql$execute_.invoke(cql.clj:17) ~[classes/:na] at clojurewerkz.cassaforte.multi.cql$insert.doInvoke(cql.clj:132) ~[classes/:na] ... {noformat}

    DataStax JIRA | 3 years ago | Tim McCormack
    com.datastax.driver.core.exceptions.InvalidTypeException: Invalid type for value 3 of CQL type bigint, expecting class java.lang.Long but class java.lang.Integer provided
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Root Cause Analysis

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

      Invalid type for value 3 of CQL type bigint, expecting class java.lang.Long but class java.lang.Integer provided

      at com.datastax.driver.core.BoundStatement.bind()
    2. DataStax Java Driver for Apache Cassandra - Core
      PreparedStatement.bind
      1. com.datastax.driver.core.BoundStatement.bind(BoundStatement.java:190)[cassandra-driver-core-1.0.3.jar:na]
      2. com.datastax.driver.core.PreparedStatement.bind(PreparedStatement.java:158)[cassandra-driver-core-1.0.3.jar:na]
      2 frames
    3. clojurewerkz.cassaforte
      client$execute.doInvoke
      1. clojurewerkz.cassaforte.client$build_statement.invoke(client.clj:170)[classes/:na]
      2. clojurewerkz.cassaforte.client$execute.doInvoke(client.clj:291)[classes/:na]
      2 frames
    4. Clojure
      RestFn.invoke
      1. clojure.lang.RestFn.invoke(RestFn.java:457)[clojure-1.4.0.jar:na]
      1 frame
    5. clojurewerkz.cassaforte.multi
      cql$insert.doInvoke
      1. clojurewerkz.cassaforte.multi.cql$execute_.invoke(cql.clj:17)[classes/:na]
      2. clojurewerkz.cassaforte.multi.cql$insert.doInvoke(cql.clj:132)[classes/:na]
      2 frames