Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #281 +/- ##
==========================================
+ Coverage 87.62% 87.69% +0.06%
==========================================
Files 57 57
Lines 4865 4924 +59
Branches 858 864 +6
==========================================
+ Hits 4263 4318 +55
- Misses 380 384 +4
Partials 222 222 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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 a robust mechanism to handle large lists of IDs in SQL queries, preventing SQL variable overflow errors by dynamically switching between inline
INclauses and temporary scratch tables. It adds a new_SqlIdSethelper class to encapsulate this logic, updates all relevant filtering and degree calculation code paths to use it, and provides comprehensive tests to ensure correctness—especially around edge cases where the number of IDs approaches backend-imposed limits.Key changes include:
Core SQL handling improvements:
_SqlIdSetclass, which automatically decides whether to use an inlineINclause or a temporary scratch table based on the number of IDs and the number of times they are used in a query, preventing SQL variable overflow (OperationalError: too many SQL variables). Scratch tables are created and cleaned up as needed, with automatic resource management usingweakref.finalize.SQLGraph.filter,overlaps, and_get_degreeto use_SqlIdSet, ensuring consistent handling of large ID sets across all query paths.Testing and validation:
test_subgraph.pythat create graphs with enough nodes to trigger the scratch-table code path, verify correct filtering and degree calculations, and ensure the cutoff logic accounts for the number of ID occurrences per query. This includes edge cases near the cutoff boundary.Internal utilities and cleanup:
_SqlIdSetinstances, with error handling and logging for robustness during interpreter shutdown or unexpected errors.These changes make the SQL backend resilient to large filter operations and improve maintainability by centralizing the handling of SQL variable limits.