gpt4 book ai didi

java - Cassandra 用 Ja​​va 从文件中保存数据

转载 作者:行者123 更新时间:2023-11-30 02:14:01 25 4
gpt4 key购买 nike

我正在通过物化 View 使用 java 将数据存储到 Cassandra,但遇到了问题。问题是它不会将数据保存到 Cassandra 数据库。我收到此错误。

No columns are defined for Materialized View other than primary key

REATE MATERIALIZED VIEW IF NOT EXISTS sensorkeyspace.maxtable AS select sensor_id,humidity from sensorkeyspace.sensortable where (humidity is not null) PRIMARY KEY (sensor_id) Exception in thread "main" com.datastax.driver.core.exceptions.InvalidQueryException: No columns are defined for Materialized View other than primary key at com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java:50) at com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:37) at com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:245) at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:64) at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:39) at sparkproject.SparkApp.main(SparkApp.java:41) Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: No columns are defined for Materialized View other than primary key at com.datastax.driver.core.Responses$Error.asException(Responses.java:136) at com.datastax.driver.core.DefaultResultSetFuture.onSet(DefaultResultSetFuture.java:179) at com.datastax.driver.core.RequestHandler.setFinalResult(RequestHandler.java:174) at com.datastax.driver.core.RequestHandler.access$2600(RequestHandler.java:43) at com.datastax.driver.core.RequestHandler$SpeculativeExecution.setFinalResult(RequestHandler.java:793) at com.datastax.driver.core.RequestHandler$SpeculativeExecution.onSet(RequestHandler.java:627) at com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:1012) at com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:935) at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:328)

最佳答案

看起来您正在使用与主表相同的主键创建物化 View 。请检查MV定义

关于java - Cassandra 用 Ja​​va 从文件中保存数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49178234/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com