Conversation
There was a problem hiding this comment.
Pull request overview
Introduces a new PatternResolver analyzer pass intended to systematically resolve remaining untyped graph variables by enumerating schema-valid type combinations and producing a UNION ALL across typed query clones, along with supporting planning-status reporting and configuration.
Changes:
- Added
PatternResolver(+ config) and integrated it into the analyzer pipeline afterTypeInference. - Extended
PlanCtxwith a status message collection mechanism for analyzer passes to report info/warnings/errors. - Updated docs/status/changelog and performed small cleanup refactors (mostly unused imports).
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/query_planner/analyzer/pattern_resolver.rs |
New analyzer pass implementing discovery, combination generation, validation, cloning, and UNION ALL composition. |
src/query_planner/analyzer/pattern_resolver_config.rs |
Adds env-configured max-combinations with caching. |
src/query_planner/analyzer/mod.rs |
Wires PatternResolver into the analyzer pipeline (Step 2.1). |
src/query_planner/plan_ctx/mod.rs |
Adds StatusLevel + message storage and methods on PlanCtx. |
src/query_planner/plan_ctx/builder.rs |
Initializes status_messages in PlanCtxBuilder. |
notes/pattern-resolver.md / STATUS.md / CHANGELOG.md |
Documentation updates describing the feature and updated test counts/status. |
| Misc files (Bolt/procedures/parser/render/generator) | Minor import cleanups / small refactors. |
9cbebb9 to
381dded
Compare
381dded to
4b877ef
Compare
…xpand - New analyzer pass that automatically resolves unlabeled Cypher patterns into all valid schema-backed label combinations - Generates UNION ALL query plans for multi-type patterns - Schema-aware validation filters impossible label combinations - Configurable via PatternResolverConfig (enabled by default) - Handles complex patterns: undirected edges, multi-hop paths, WHERE clauses - Three-mode property selection: IdOnly, Individual, WholeNode - Multi-type VLP expansion with UNION ALL CTE generation - VLP + WITH CTE integration for chained WITH-MATCH queries - Undirected VLP patterns generate correct per-direction CTEs - VLP CTE schema population for pattern comprehensions - start_type/end_type columns in VLP path tuples - Bolt Path serialization from VLP CTE tuple data (transform_vlp_path) - Browser expand queries return proper Path objects with nodes AND edges - Fixed UNION split pipeline for multi-var id() queries - Fixed label resolution from encoded deterministic IDs - Removed semantic-violating query rewrites (path-to-node, undirected) - Relationship-fetch queries preserve original directed semantics - CTE+JOIN pattern comprehension for size([(a)--() | 1]) - RETURN-context pattern comprehension CTE generation - Single-column UNION ALL pattern comp CTE structure - New optimizer pass prunes impossible UNION branches - Label-aware pruning based on WHERE clause constraints - Bidirectional pruning for relationship patterns - id() function splitting for multi-var IN clauses - Bidirectional pruning and single-label injection - String arena for efficient AST string management - Task-local QueryContext for CTE name registry (thread safety) - CTE column reference uses cte_manager property mappings - Computed WITH aliases typed as scalar instead of path/node - Multi-type VLP CTE naming in from_builder - Duplicate relationship type deduplication 96 files changed, +10364/-1102 lines All 1006 unit tests pass (995 + 11 ignored)
4b877ef to
9830688
Compare
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.
This pull request introduces the new PatternResolver system for automatic type enumeration in untyped graph patterns, significantly enhancing schema intelligence and exploratory query capabilities in the query planner. The PatternResolver systematically discovers untyped variables, queries the schema for valid types, generates all valid combinations (with configurable limits), validates relationships, clones queries per combination, and combines them via
UNION ALL. The integration is robust, with full unit test coverage and minimal performance overhead. Supporting changes include new configuration, status message infrastructure, and updates to documentation and test counts.Major features and changes:
Schema Intelligence & Query Planning:
PatternResolvermodule with full integration into the analyzer pipeline (src/query_planner/analyzer/pattern_resolver.rs,src/query_planner/analyzer/mod.rs). This system enables automatic type enumeration for untyped graph variables, generating all valid type combinations and combining them viaUNION ALL, with graceful fallback and schema constraint validation. [1] [2] [3]pattern_resolver_configmodule and theCLICKGRAPH_MAX_TYPE_COMBINATIONSenvironment variable, with a default of 38.Infrastructure & Status Reporting:
PlanCtxto include a status message system for reporting info, warnings, and errors during planning—used by PatternResolver to communicate combination limits, missing types, etc. Added methods for adding, retrieving, and clearing messages. [1] [2] [3] [4] [5] [6] [7]Documentation & Test Updates:
CHANGELOG.mdandSTATUS.mdto document the PatternResolver feature, architecture, configuration, integration, and testing. Increased the reported number of passing unit and integration tests. [1] [2]Codebase Cleanups & Minor Refactoring:
These changes collectively enable true exploratory graph queries without manual type annotations, improve planning transparency, and maintain robust performance and test coverage.