Skip to content

Implement deep query planner/executor for nested where conditions#47

Open
konard wants to merge 3 commits intomainfrom
issue-7-24186adb
Open

Implement deep query planner/executor for nested where conditions#47
konard wants to merge 3 commits intomainfrom
issue-7-24186adb

Conversation

@konard
Copy link
Member

@konard konard commented Sep 13, 2025

Summary

  • Implements comprehensive deep query processing for nested where conditions as requested in issue Deep query planner/executor #7
  • Adds support for all logical operators: _and, _or, _not
  • Enables nested relationship filtering: from, to, type, in, out
  • Supports all comparison operators: _eq, _neq, _gt, _gte, _lt, _lte, _in, _nin, _is_null
  • Fixes type inconsistency in LinksBooleanExpression.type_id field
  • Maintains full backward compatibility with existing queries

Implementation Details

  • Deep Query Processing: Completely rewrote LinksQuery.GetLinks() to handle complex nested where clauses
  • Recursive Evaluation: Added EvaluateWhereClause() method that recursively processes nested conditions
  • Relationship Navigation: Implemented support for filtering by properties of linked objects (from.id, to.id, etc.)
  • Performance Optimization: Uses basic query optimization to reduce candidate set before applying complex filters

Examples of Supported Queries

Logical Operators

{
  links(where: {
    _and: [
      { id: { _gt: 0 } }
      { from_id: { _eq: 1 } }
    ]
  }) { id from_id to_id }
}

Nested Relationships

{
  links(where: {
    from: { id: { _gt: 0 } }
    to: { id: { _lt: 100 } }
  }) { 
    id from_id to_id 
    from { id }
    to { id }
  }
}

Outgoing/Incoming Links

{
  links(where: {
    out: { to_id: { _gt: 0 } }
    in: { from_id: { _gt: 0 } }
  }) {
    id from_id to_id
    out { id to_id }
    in { id from_id }
  }
}

Test Coverage

  • Added 8 comprehensive test cases covering deep query functionality
  • All existing tests continue to pass (maintains backward compatibility)
  • Total test results: 11/11 query tests pass, 5/5 mutation tests pass

Bug Fixes

  • Fixed type mismatch: LinksBooleanExpression.type_id now correctly uses LongComparisonExpression instead of LinksBooleanExpression

🤖 Generated with Claude Code


Resolves #7

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #7
@konard konard self-assigned this Sep 13, 2025
- Added comprehensive deep query processing in LinksQuery.GetLinks()
- Support for all logical operators: _and, _or, _not
- Support for nested relationship filtering: from, to, type, in, out
- Support for all comparison operators: _eq, _neq, _gt, _gte, _lt, _lte, _in, _nin, _is_null
- Fixed type inconsistency: LinksBooleanExpression.type_id now uses LongComparisonExpression
- Added 8 new test cases covering deep query functionality
- Maintains backward compatibility with existing simple queries
- All tests pass (11/11 query tests, 5/5 mutation tests)

Resolves issue #7 - Support deep (multiple layers) of where query argument.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Fix issue #7 Implement deep query planner/executor for nested where conditions Sep 13, 2025
@konard konard marked this pull request as ready for review September 13, 2025 05:35
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.

Deep query planner/executor

1 participant