mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-29 19:21:01 +00:00
cql3: expr: accept expression as lhs argument to contains()
contains() used to only accept column_value as the lhs to evaluate. Changed it to accept any generic expression. This will allow to evaluate a more diverse set of binary operators. Signed-off-by: Jan Ciolek <jan.ciolek@scylladb.com>
This commit is contained in:
@@ -362,10 +362,11 @@ bool contains(const data_value& collection, const raw_value_view& value) {
|
||||
}
|
||||
|
||||
/// True iff a column is a collection containing value.
|
||||
bool contains(const column_value& col, const raw_value_view& value, const evaluation_inputs& inputs) {
|
||||
const auto collection = get_value(col, inputs);
|
||||
if (collection) {
|
||||
return contains(col.col->type->deserialize(managed_bytes_view(*collection)), value);
|
||||
bool contains(const expression& collection_val, const raw_value_view& value, const evaluation_inputs& inputs) {
|
||||
const data_type collection_type = type_of(collection_val);
|
||||
const managed_bytes_opt collection_bytes = evaluate(collection_val, inputs).to_managed_bytes_opt();
|
||||
if (collection_bytes) {
|
||||
return contains(collection_type->deserialize(managed_bytes_view(*collection_bytes)), value);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user