mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-27 11:55:15 +00:00
This patch adds the parsing for the "CREATE MATERIALIZED VIEW" statement, following Cassandra 3 syntax. For example: CREATE MATERIALIZED VIEW building_by_city AS SELECT * FROM buildings WHERE city IS NOT NULL PRIMARY KEY(city, name); It also adds the "IS NOT NULL" operator needed for this purpose. As in Cassandra, "IS NOT NULL" can only be used for materialized view creation, and not in a normal SELECT. It can only be used with the NULL operand (i.e., "IS NOT 3" will be a syntax error). The current implementation of this statement just does some sanity checking (such as to verify that "city" is a valid column name and that the "building" base table exists), complains that materialized views are not yet supported: SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query] message="Failed parsing statement: [CREATE MATERIALIZED VIEW building_by_city AS SELECT * FROM buildings WHERE city IS NOT NULL PRIMARY KEY(city, name);] reason: unsupported operation: Materialized views not yet supported"> As mentioned above, the "IS NOT NULL" restriction is not allowed in ordinary selects not creating a materialized views: SELECT * FROM buildings WHERE city IS NOT NULL; InvalidRequest: code=2200 [Invalid query] message="restriction 'city IS NOT null' is only supported in materialized view creation" Signed-off-by: Nadav Har'El <nyh@scylladb.com> Message-Id: <1475742927-30695-1-git-send-email-nyh@scylladb.com>
2.3 KiB
2.3 KiB