Generate an error when CONTAINS is used on a non-collection column

Fixes #2255

Signed-off-by: Botond Dénes <bdenes@scylladb.com>
Message-Id: <517bb6268ac213aed9a1def231614c2e88f77c9f.1499764183.git.bdenes@scylladb.com>
This commit is contained in:
Botond Dénes
2017-07-11 12:10:15 +03:00
committed by Duarte Nunes
parent 310d2a54d2
commit f18f724f1c

View File

@@ -130,6 +130,10 @@ single_column_relation::to_receivers(schema_ptr schema, const column_definition&
}
}
if (is_contains() && !receiver->type->is_collection()) {
throw exceptions::invalid_request_exception(sprint("Cannot use CONTAINS on non-collection column \"%s\"", receiver->name));
}
if (is_contains_key()) {
if (!dynamic_cast<const map_type_impl*>(receiver->type.get())) {
throw exceptions::invalid_request_exception(sprint("Cannot use CONTAINS KEY on non-map column %s", receiver->name));