cql3: Keep single column restrictions map inside statement restrictions

Some parts of the code make use of a map keeping single column restrictions
for each partition key column. One of this places is inside do_filter,
so it could be a performance problem to create such a map from scratch
each time.

After adding all restrictions from the where clause the new
map is created and can be used for various purposes.

Signed-off-by: Jan Ciolek <jan.ciolek@scylladb.com>
This commit is contained in:
Jan Ciolek
2022-06-28 08:09:51 +02:00
parent 1339ff1c79
commit 3916bf1168
2 changed files with 5 additions and 0 deletions

View File

@@ -470,6 +470,9 @@ statement_restrictions::statement_restrictions(data_dictionary::database db,
}
}
if (_where.has_value()) {
if (!has_token(_new_partition_key_restrictions)) {
_single_column_partition_key_restrictions = expr::get_single_column_restrictions_map(_new_partition_key_restrictions);
}
_clustering_prefix_restrictions = extract_clustering_prefix_restrictions(*_where, _schema);
_partition_range_restrictions = extract_partition_range(*_where, _schema);
}

View File

@@ -46,6 +46,8 @@ private:
expr::expression _new_partition_key_restrictions;
expr::single_column_restrictions_map _single_column_partition_key_restrictions;
/**
* Restrictions on clustering columns
*/