Cassandra InvalidQueryException:密钥不能为空 [英] Cassandra InvalidQueryException: Key may not be empty
本文介绍了Cassandra InvalidQueryException:密钥不能为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
InvalidQueryException:密钥不能为空将Java驱动程序用于DataStax Astra Cassandra DB时.
InvalidQueryException: Key may not be empty When using the Java Driver for DataStax Astra Cassandra DB.
我100%确保我的partitionKey或clusteringColumns不为空.有人可以告诉我这个错误除了意味着什么?
I'm 100% sure that my partitionKey or my clusteringColumns are not empty. Can someone tell me what this error can mean besides that?
同一代码在异常发生前1小时有效吗?
The same code worked 1 hour before what does that exception mean?
推荐答案
谢谢你们,但我自己找到了.
Thank you guys but I just found it myself.
我在 ByteBuffer
中写了 Long
,此后不使用 flip()
.
I wrote a Long
into an ByteBuffer
and didn't use flip()
afterwards.
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;
}
这篇关于Cassandra InvalidQueryException:密钥不能为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文