Returns the effective row policy filter for the table, or nullptr if the table has no row policies for the current user or the combined filter is always-true. Mirrors the effective-filter check used by buildRowPolicyFilterIfNeeded.
| 303 | /// always-true. Mirrors the effective-filter check used by |
| 304 | /// buildRowPolicyFilterIfNeeded. |
| 305 | RowPolicyFilterPtr getEffectiveRowPolicyFilter(const StoragePtr & storage, const ContextPtr & query_context) |
| 306 | { |
| 307 | auto storage_id = storage->getStorageID(); |
| 308 | if (!storage_id.hasDatabase()) |
| 309 | return nullptr; |
| 310 | auto row_policy_filter = query_context->getRowPolicyFilter( |
| 311 | storage_id.getDatabaseName(), storage_id.getTableName(), RowPolicyFilterType::SELECT_FILTER); |
| 312 | if (!row_policy_filter || row_policy_filter->isAlwaysTrue()) |
| 313 | return nullptr; |
| 314 | return row_policy_filter; |
| 315 | } |
| 316 | |
| 317 | bool applyTrivialCountIfPossible( |
| 318 | QueryPlan & query_plan, |
no test coverage detected