fix(query/planner): apply :pushdown-preds in temporal standalone pattern-scan#827
Merged
Conversation
…ern-scan The entity-group temporal branch in execute-plan re-applies :pushdown-preds as a post-filter after lookup-batch-search (since the planner consumes the clause-level predicate). The sibling standalone :pattern-scan branch had no such re-application and silently dropped the predicate on HistoricalDB / AsOfDB / SinceDB queries with a single data pattern. Surface symptom: temporal range queries shaped like [?tx :db/txInstant ?inst] [(<= ?from ?inst)] over-returned when forced through the Relation path (any context with prior :rels — e.g. a `[?m ...]` collection binding). Mirror the entity-group branch's filter-by-pred reduction on (:pushdown-preds op) directly after lookup-batch-search.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
:pushdown-predspost-filter onto the standalone:pattern-scanbranch inexecute-plan. Without it, the planner consumes the clause-level predicate (:consumed-preds) andlookup-batch-searchsilently drops it on temporal DBs.[?tx :db/txInstant ?inst] [(<= ?from ?inst)]that gets forced through the Relation path (non-empty:relsin the context — e.g. a[?m ...]collection IN binding) returned all rows instead of the bounded range.test-temporal-standalone-pattern-scan-pushdown-predinquery_planner_temporal_test.cljthat fails onmainand passes with this fix. The shape forcesexecute-plan(notexecute-plan-direct) so the bug actually manifests.Test plan
DATAHIKE_QUERY_PLANNER=true clj -M:testagainst the new namespace alone (4 tests, 11 assertions, 0 failures).query-test/query-rules-test/query-planner-test/query-fns-test— 61 tests / 355 assertions, 0 failures.execute.cljcchange makes the new test fail withnot (= #{e2 e3} #{e1 e2 e3 + non-event txs}).Follow-up to #826 / #825.