cql3: expr: Add is_empty_restriction
Add a function to check whether an expression restricts anything at all. Signed-off-by: Jan Ciolek <jan.ciolek@scylladb.com>
This commit is contained in:
@@ -2407,5 +2407,14 @@ single_column_restrictions_map get_single_column_restrictions_map(const expressi
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool is_empty_restriction(const expression& e) {
|
||||
bool contains_non_conjunction = recurse_until(e, [&](const expression& e) -> bool {
|
||||
return !is<conjunction>(e);
|
||||
});
|
||||
|
||||
return !contains_non_conjunction;
|
||||
}
|
||||
|
||||
} // namespace expr
|
||||
} // namespace cql3
|
||||
|
||||
@@ -759,6 +759,9 @@ using single_column_restrictions_map = std::map<const column_definition*, expres
|
||||
// Extracts map of single column restrictions for each column from expression
|
||||
single_column_restrictions_map get_single_column_restrictions_map(const expression&);
|
||||
|
||||
// Checks whether this expression is empty - doesn't restrict anything
|
||||
bool is_empty_restriction(const expression&);
|
||||
|
||||
} // namespace expr
|
||||
|
||||
} // namespace cql3
|
||||
|
||||
Reference in New Issue
Block a user