Repository navigation
Conversation
Row policies and `PREWHERE` reduce emitted rows while the cache key is file identity only. Treat them like filter DAGs in `FormatFilterInfo::hasFilter`. Co-authored-by: Cursor <[email protected]>
|
Workflow [PR], commit [7f135f9] Summary: ❌
AI ReviewSummaryThe PR includes row policies in the file-format query-condition-cache key and adds regressions for filtered count caching and cross-policy cache reuse. The earlier bot findings are addressed, and no remaining actionable findings were identified. Current regressions pass CI; comparison-build bugfix validation reports no reproduction. Final VerdictStatus: ✅ Approve |
`ORDER BY ... LIMIT` drops rows inside the Parquet reader while the cache key is file identity only, so a reduced count could be reused by a later `count()`. https: //github.com/ClickHouse/pull/122835 Co-authored-by: Cursor <[email protected]>
`getMatchedBuckets` records a row group as unmatched when `rows_pass` is zero, and the reader applies the row policy before that count. A `WHERE`-only key could skip those rows after the policy changed. https: //github.com/ClickHouse/pull/122835 Co-authored-by: Cursor <[email protected]>
Build profile diff (arm_release)Commit See the job log for details. |
| { | ||
| condition_hash = queryConditionCacheHash( | ||
| filter_actions_dag->getHash(), queryConditionCacheSettingsSalt(context_->getSettingsRef())); | ||
| dag_hash, queryConditionCacheSettingsSalt(context_->getSettingsRef())); |
There was a problem hiding this comment.
Don't we need to do the same in MergeTree?
There is still getHash from ActionDAG
size_t condition_hash = queryConditionCacheHash(
filter_actions_dag->getOutputs()[0]->getHash(),
queryConditionCacheSettingsSalt(read_from_merge_tree->getContext()->getSettingsRef()));
There was a problem hiding this comment.
As far as I understand, in updateQueryConditionCache key calculation is already after applying row level filter, so with different row filters returns different keys.
…les-cache-row-filters Keep `FormatFilterInfo::hasFilter` from master. Mix `row_level_filter` into `computeConditionHash` so the Parquet query-condition cache key still changes with the row policy, and keep `fileFormatPruningSettingsSalt`. Co-authored-by: Cursor <[email protected]>
`SchemaCache` drops an entry when `st_mtime` is at least `registration_time`, and both are second resolution. An insert and a top-K read in the same second discarded a reduced count, so a later `count()` reread the file and passed with the `top_k_filter` guard removed. https: //github.com/ClickHouse/pull/122835 Co-authored-by: Cursor <[email protected]>
`File(TSV)` keeps a row policy in a `FilterStep` above `StorageFileSource`, so the reader still sees every row and would cache the full count with the `hasFilter` guard removed. `File(Parquet)` pushes the policy as `row_level_filter`, and the file is backdated before the filtered `count()` so a reduced count stays reusable. https: //github.com/ClickHouse/pull/122835 Co-authored-by: Cursor <[email protected]>
|
Dear @scanhex12, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
Row policies and
PREWHEREreduce emitted rows while the cache key is file identity only. Treat them like filter DAGs inFormatFilterInfo::hasFilter.hasFilterreported only theWHEREfilter DAG, so a filteredcount()could store a reduced cardinality and a later unrestrictedcount()would reuse it.hasFilternow also reportsPREWHEREand row-policy filters.StorageFileandStorageURLalready consulthasFilterbefore writing the cache.StorageObjectStorageSourcecheckedfilter_actions_dagdirectly and now useshasFilteras well.This is the
FormatFilterInfofix split out of #113561. Deletion-vector read support from that pull request landed separately in #110781.Related: #113561
Related: #110781
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Do not store count-from-files cache entries for reads filtered by a row policy or
PREWHERE. The cache key is file identity only, so a reduced count could be reused by a later unrestrictedcount().Workflow [PR]
Sync PR [sync-upstream/pr/122835]