Reputation: 57
I am using java store data to Cassandra through materiliazed view but I got an issue. The issue is that its not going save data to Cassandra database. I got this error.
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)
Upvotes: 1
Views: 361
Reputation: 87119
It looks like that you're creating the materialized view with the same primary key as a main table. Please check the MV definition
Upvotes: 2