Skip to content

Change ParallelQuerySet to use QueryBuilder - #725

Merged
luisremis merged 10 commits into
developfrom
fix/issue-265
May 24, 2026
Merged

Change ParallelQuerySet to use QueryBuilder#725
luisremis merged 10 commits into
developfrom
fix/issue-265

Conversation

@ad-claw000

Copy link
Copy Markdown
Contributor

Summary

Extracted the command resolution logic in ParallelQuerySet into QueryBuilder.get_query_cmd. This refactoring simplifies the codebase and leverages QueryBuilder effectively.

Verification

  • Added get_query_cmd to QueryBuilder in aperturedb/Query.py.
  • Replaced manual dictionary key extraction in ParallelQuerySet.py.
  • Evaluated Python syntax.

Fixes #265

Copilot AI review requested due to automatic review settings May 20, 2026 12:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors ParallelQuerySet constraint handling by centralizing “command extraction” logic into a new QueryBuilder.get_query_cmd helper, reducing duplicated parsing logic and aiming to standardize query-structure interpretation.

Changes:

  • Added QueryBuilder.get_query_cmd to extract the command name from supported query structures.
  • Updated ParallelQuerySet to call QueryBuilder.get_query_cmd instead of manually inspecting dict/list shapes.
  • Wrapped command extraction in a try/except to raise a constraint-specific error when unsupported structures are encountered.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
aperturedb/Query.py Adds QueryBuilder.get_query_cmd to encapsulate query command-name extraction.
aperturedb/ParallelQuerySet.py Replaces inline query-structure parsing with QueryBuilder.get_query_cmd during constraint evaluation.
Comments suppressed due to low confidence (1)

aperturedb/Query.py:284

  • The exception message "Cannot extract command from query structure" is hard to act on when debugging. It would be more helpful to include what structures are supported (e.g., single-command dict vs [constraints_dict, command_dict]) and basic info about the received value (type/length/keys) without dumping large payloads.
        elif isinstance(query, list) and isinstance(query[0], dict) \
                and all(map(lambda k: k in known_constraint_keywords, query[0].keys()))  \
                and isinstance(query[1], dict):
            return list(query[1].keys())[0]
        else:
            raise Exception("Cannot extract command from query structure")

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

Comment thread aperturedb/Query.py Outdated
Comment thread aperturedb/ParallelQuerySet.py Outdated
Comment thread aperturedb/ParallelQuerySet.py Outdated
Comment thread aperturedb/Query.py
- Refine get_query_cmd to validate input structure and raise ValueError for invalid shapes
- Chain exceptions when get_query_cmd fails in ParallelQuerySet
- Fix typo in exception message 'Contraints' -> 'Constraints'
- Add unit tests for QueryBuilder.get_query_cmd in test_Datawizard.py
@ad-claw000

Copy link
Copy Markdown
Contributor Author

All PR review comments have been addressed in commit a9522cc and pushed to the branch.

Copilot AI review requested due to automatic review settings May 21, 2026 01:53
@ad-claw000

Copy link
Copy Markdown
Contributor Author

All actionable review comments have been addressed in commit a9522cc.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment thread test/test_Datawizard.py Outdated
Comment thread aperturedb/Query.py
Addressed the reviewer's feedback to include the type, length, and keys
of the received payload instead of dumping the full payload when parsing fails.
Copilot AI review requested due to automatic review settings May 21, 2026 02:52
@ad-claw000

Copy link
Copy Markdown
Contributor Author

Done. Refined the ValueError message in aperturedb/Query.py to include the type, length, and keys of the received query structure without dumping large payloads, as suggested in the review. See commit e26d7f0.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings May 23, 2026 21:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread aperturedb/Query.py Outdated
Copilot AI review requested due to automatic review settings May 24, 2026 06:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread aperturedb/ParallelQuerySet.py Outdated
@luisremis
luisremis merged commit 767cc8f into develop May 24, 2026
3 checks passed
@luisremis
luisremis deleted the fix/issue-265 branch May 24, 2026 17:45
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.

Change ParallelQuerySet to use QueryBuilder

3 participants