虽然插入到Cassandra db这个错误来了,我正在向数据库插入非常大的数据,这个错误是因为内存,我有足够的磁盘空间,因为我知道数据库中的行可以容纳20亿条记录所以我我缺少列范围配置。
Exception in thread "main" com.datastax.driver.core.exceptions.InvalidQueryException: The sum of all clustering columns is too long (65927 > 65535)
at com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java:35)
at com.datastax.driver.core.DefaultResultSetFuture.extractCauseFromExecutionException(DefaultResultSetFuture.java:259)
at com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:175)
at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:52)
at FileLogger.persistData(FileLogger.java:91)
at FileLogger.main(FileLogger.java:59)
Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: The sum of all clustering columns is too long (65927 > 65535)
答案 0 :(得分:1)
看起来很清楚,你的总和列名大于预期的cassandra(0XFFFF = 65535)。
您可以减少名称,要么必须划分查询。
来自:Link
105 public static void validateColumnNames(Iterable<ByteBuffer> columnNames) throws InvalidRequestException
106 {
107 for (ByteBuffer name : columnNames)
108 validateColumnName(name);
109 }
110
111 public static void validateColumnName(ByteBuffer name) throws InvalidRequestException
112 {
113 if (name.remaining() > IColumn.MAX_NAME_LENGTH)
114 throw new InvalidRequestException(String.format("The sum of all clustering columns is too long (%s > %s)",
115 name.remaining(),
116 IColumn.MAX_NAME_LENGTH));
117
118 if (name.remaining() == 0)
119 throw new InvalidRequestException("Invalid empty value for clustering column of COMPACT TABLE");
120 }