Skip to content

refactor(match-clause): Complete architecture overhaul - split monoli…#49

Merged
genezhang merged 1 commit intomainfrom
refactor/match-clause-architecture
Jan 27, 2026
Merged

refactor(match-clause): Complete architecture overhaul - split monoli…#49
genezhang merged 1 commit intomainfrom
refactor/match-clause-architecture

Conversation

@genezhang
Copy link
Copy Markdown
Owner

…thic file into modules

This PR refactors the 4,333-line match_clause.rs monolith into a well-organized module structure:

Module Structure

  • traversal.rs (1,159 lines) - Core MATCH pattern traversal and evaluation
  • view_scan.rs (899 lines) - ViewScan generation for nodes and relationships
  • type_inference.rs (570 lines) - Node label and relationship type inference
  • helpers.rs (536 lines) - 14 reusable helper functions
  • tests.rs (1,560 lines) - Unit tests
  • mod.rs (49 lines) - Public API
  • errors.rs (7 lines) - Error types

Key Improvements

  • Eliminated 500+ lines of code duplication via helper extraction
  • Clear separation of concerns with single-responsibility modules
  • Improved testability and maintainability
  • Renamed legacy.rs to traversal.rs (final naming)
  • Updated method names for graph_catalog compatibility

All 801 tests passing. No functional changes - pure refactoring.

@genezhang genezhang requested a review from Copilot January 27, 2026 22:38
@genezhang genezhang force-pushed the refactor/match-clause-architecture branch 2 times, most recently from d9d7307 to e3e0bc1 Compare January 27, 2026 22:42
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR successfully refactors the massive 4,333-line match_clause.rs monolith into a well-organized module structure with clear separation of concerns. The refactoring splits the code into 7 focused modules, eliminating significant code duplication and improving maintainability while maintaining all 801 passing tests.

Changes:

  • Split monolithic match_clause.rs into 7 specialized modules (traversal, view_scan, type_inference, helpers, tests, errors, mod)
  • Eliminated 500+ lines of duplicated code through helper function extraction
  • Renamed legacy.rs to traversal.rs for final module naming
  • Updated return_clause.rs to use TryFrom instead of From for ProjectionItem conversion

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/query_planner/logical_plan/match_clause/mod.rs Public API module with clear re-exports of all functionality
src/query_planner/logical_plan/match_clause/traversal.rs Core pattern traversal logic (1,159 lines) - handles MATCH evaluation
src/query_planner/logical_plan/match_clause/view_scan.rs ViewScan generation for nodes and relationships (899 lines)
src/query_planner/logical_plan/match_clause/type_inference.rs Node label and relationship type inference (570 lines)
src/query_planner/logical_plan/match_clause/helpers.rs 14 reusable utility functions (536 lines)
src/query_planner/logical_plan/match_clause/tests.rs Comprehensive unit tests (1,560 lines)
src/query_planner/logical_plan/match_clause/errors.rs Error type re-exports (7 lines)
src/query_planner/logical_plan/return_clause.rs Updated to use TryFrom with expect for error handling
docs/audits/MATCH_CLAUSE_ARCHITECTURE_PROPOSAL.md Architecture proposal document (reference material)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/query_planner/logical_plan/match_clause/traversal.rs Outdated
Comment thread src/query_planner/logical_plan/match_clause/helpers.rs Outdated
Comment thread docs/audits/MATCH_CLAUSE_ARCHITECTURE_PROPOSAL.md Outdated
Comment thread src/query_planner/logical_plan/return_clause.rs Outdated
Comment thread src/query_planner/logical_plan/match_clause/view_scan.rs Outdated
Comment thread src/query_planner/logical_plan/match_clause/view_scan.rs
…thic file into modules

This PR refactors the 4,333-line match_clause.rs monolith into a well-organized module structure:

## Module Structure
- traversal.rs (1,159 lines) - Core MATCH pattern traversal and evaluation
- view_scan.rs (899 lines) - ViewScan generation for nodes and relationships
- type_inference.rs (570 lines) - Node label and relationship type inference
- helpers.rs (536 lines) - 14 reusable helper functions
- tests.rs (1,560 lines) - Unit tests
- mod.rs (49 lines) - Public API
- errors.rs (7 lines) - Error types

## Key Improvements
- Eliminated 500+ lines of code duplication via helper extraction
- Clear separation of concerns with single-responsibility modules
- Improved testability and maintainability
- Renamed legacy.rs to traversal.rs (final naming)
- Updated method names for graph_catalog compatibility

All 801 tests passing. No functional changes - pure refactoring.
@genezhang genezhang force-pushed the refactor/match-clause-architecture branch from e3e0bc1 to d76e8a1 Compare January 27, 2026 22:48
@genezhang genezhang merged commit 2bd51c5 into main Jan 27, 2026
2 checks passed
@genezhang genezhang deleted the refactor/match-clause-architecture branch January 27, 2026 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants