Any clue why I am getting the error from the topic. Bellow I pasted all steps to reproduce the error.
I found someone facing same issue and I try the solution proposed but I did get extactly the same issue.
I tried follow Materialised view error in Cassandra by creating table all_orders and following @halfer solution but I reached exactly same error message.
Whole Logs:
C:\Program Files\DataStax Community\apache-cassandra\bin>set JAVA_HOME=C:\Program Files\Java\jre1.8.0_171
C:\Program Files\DataStax Community\apache-cassandra\bin>cqlsh
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 2.2.3 | CQL spec 3.3.1 | Native protocol v4]
Use HELP for help.
WARNING: pyreadline dependency missing. Install to enable tab completion.
cqlsh> CREATE KEYSPACE IF NOT EXISTS sample WITH replication = {'class':'SimpleStrategy', 'replication_factor':1};
cqlsh> use sample;
cqlsh:sample> CREATE TABLE IF NOT EXISTS sample.hotels (
... id UUID,
... name varchar,
... address varchar,
... state varchar,
... zip varchar,
... primary key(id)
... );
cqlsh:sample>
cqlsh:sample> CREATE TABLE IF NOT EXISTS sample.hotels_by_letter (
... first_letter varchar,
... hotel_name varchar,
... hotel_id UUID,
... address varchar,
... state varchar,
... zip varchar,
... primary key((first_letter), hotel_name, hotel_id)
... );
cqlsh:sample> CREATE MATERIALIZED VIEW sample.hotels_by_state AS
... SELECT id, name, address, state, zip FROM hotels
... WHERE state IS NOT NULL AND id IS NOT NULL AND name IS NOT NULL
... PRIMARY KEY ((state), id)
... WITH CLUSTERING ORDER BY (name DESC)
... ;
SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query] message="line 1:7 no viable alternative at input 'MATERIALIZED' ([CREATE] MATERIALIZED...)">
*** added
I tried the exact sample provided in https://www.datastax.com/dev/blog/new-in-cassandra-3-0-materialized-views and I got the same issue (evidence bellow).
cqlsh:sample> CREATE TABLE scores
... (
... user TEXT,
... game TEXT,
... year INT,
... month INT,
... day INT,
... score INT,
... PRIMARY KEY (user, game, year, month, day)
... );
cqlsh:sample> CREATE MATERIALIZED VIEW alltimehigh AS
... SELECT user FROM scores
... WHERE game IS NOT NULL AND score IS NOT NULL AND user IS NOT NULL AND year IS NOT NULL AND month IS NOT NULL AND day IS NOT NULL
... PRIMARY KEY (game, score, user, year, month, day)
... WITH CLUSTERING ORDER BY (score desc);
SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query] message="line 1:7 no viable alternative at input 'MATERIALIZED' ([CREATE] MATERIALIZED...)">
cqlsh:sample>