카산드라 열 패밀리에서 키 값 쌍 수를 얻으려고합니다. 다음은 내가 사용한 코드입니다.Cassandra ResultSet에서 BigInteger 특성 가져 오기
PreparedStatement statement = client.session
.prepare("select count(*) from corpus.word_usage");
ResultSet results = client.session.execute(statement.bind());
Row row = results.one();
System.out.println(row.getVarint(0));
하지만이 코드를 실행하면 다음 예외가 발생합니다.
Exception in thread "main" com.datastax.driver.core.exceptions.InvalidTypeException: Column count is of type bigint
at com.datastax.driver.core.ColumnDefinitions.checkType(ColumnDefinitions.java:291)
at com.datastax.driver.core.ArrayBackedRow.getVarint(ArrayBackedRow.java:185)
at SimpleClient.main(SimpleClient.java:57)
는 datastax 문서에 따르면 (http://www.datastax.com/drivers/java/2.0/com/datastax/driver/core/Row.html) getVarint는 BigInteger를 반환해야합니다. 그렇다면 왜 내가 여기서 예외를 얻고 있습니까? 내가 뭘 잘못 했니?
네, 저에게도 효과가있었습니다, 감사합니다. –