java - Cassandra InvalidQueryException:键可能不为空
问题描述
InvalidQueryException:使用 DataStax Astra Cassandra DB 的 Java 驱动程序时,键可能不为空。
我 100% 确定我的 partitionKey 或 clusteringColumns 不为空。有人能告诉我除此之外这个错误意味着什么吗?
相同的代码在该异常意味着什么之前工作了 1 小时?
解决方案
谢谢大家,但我自己找到了。
我把 a 写成了Long
an之后ByteBuffer
就没有用flip()
了。
public static ByteBuffer toBB(Long x) {
ByteBuffer bb = ByteBuffer.allocate(Long.BYTES);
if (x == null) {
return null;
}
bb.putLong(x);
bb.flip(); //Added this line here and it works
return bb;
}
推荐阅读
- android - ConstraintLayout RecyclerView中的不同高度
- php - Zend 1 php 如何获取助手并在课堂外执行它?
- html - 选择第二个 col_content
- yaml - 用于从 Artifact 存储库下载最新 Artifact 的 Yaml 脚本
- sql-server - 在计算实例数时如何选择所有行?
- python - 如何在python中处理原始字符串中的通配符
- mysql - MySQL_Retrieving 基于 max 和 min_date 的股票价格
- javascript - history.back 在 Karma 中的行为不符合预期
- javascript - 如何通过方法在动态创建的行中分配/传递数据 - Vue.js
- machine-learning - 为什么不能从宏精度和召回率计算宏 F1 度量?