-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: optimise where clause filtering #2076
Merged
Merged
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
9cb9f5a
Add filter
robacourt d1d1adf
Make Shapes.record_in_shape? take a shape
robacourt f299dc0
Make add_shape public
robacourt 9327bbd
Support other types of change
robacourt 5ca7267
Test id not found
robacourt 285105d
Add Filter struct
robacourt f4a5e39
Turn other_shapes into a map
robacourt 5012b0c
Support relation changes
robacourt 0586a0e
Support TruncateRelation
robacourt e97d803
Optimise where clauses
robacourt e4ccdcf
Optimise where clauses
robacourt 54809ee
Add Filter.remove_shape
robacourt c697ce8
Update dispatcher
robacourt 319ede5
Add TODOs
robacourt 1e7f050
Support renames
robacourt 1cb01da
Fix remaining tests
robacourt 2881ad2
Remove redundant arg
robacourt 8c3bf5f
Pass inspector to dispatcher
robacourt 9f03c18
Refactor dispatcher so that state is a struct
robacourt bb2e4fa
Add inspector to dispatcher state
robacourt 55322a6
Add TODO
robacourt ecf54f9
Parse record rather than converting the const to a string
robacourt 33c8a8b
Create expr on Filter.new
robacourt 684cd47
Move functions into TableFilter
robacourt 04c04e9
Rename TableFilter to Table
robacourt ac11f0d
Rename public Table functions
robacourt 3db9970
Introduce Table struct
robacourt 7538087
Extract code into Field
robacourt 8a484ab
Rename table_filter to table
robacourt 2d2c3f6
Rename field to index
robacourt 47fc530
Ensure table is first param of Table public functions
robacourt ba275c5
Neaten up remove_shape
robacourt f8c2703
Refactor affected_shapes function to improve argument structure and u…
robacourt c4af878
Refactor: Use Table.empty?/1 for cleaner table emptiness check
robacourt b604482
Use Index struct
robacourt 001e0d3
Refactor add_shape function to reorder parameters for consistency.
robacourt f4d3f9b
Remove unused inspector option from Dispatcher and related modules.
robacourt be41674
Refactor: Rename handle to shape_id
robacourt 7c22ad7
Refactor all_shapes
robacourt dbf1192
Gracefully handle parsing errors
robacourt 32e75e9
Hide deliberate error in test
robacourt b150fed
Test error logging for invalid error
robacourt c660449
Update TODOs
robacourt 6dd4a48
Refactor code into WhereClause module
robacourt 81be707
Remove Filter.new/1
robacourt e9822d6
Test arrays
robacourt 7f474a1
Test shape with no where clause
robacourt ab3b970
Update TODOs
robacourt 29fb39d
Update moduledoc
robacourt c452bc4
Add moduledoc
robacourt 0ac30a6
Add moduledocs
robacourt efe3613
Remove TODO
robacourt aa4e7c2
Rescue all errors in affected_shapes
robacourt f91c830
Remove unnecessary field from dispatcher state
robacourt c0fba1a
Revert unnecessary change
robacourt 8997ce6
Add typespecs
robacourt 3e40fd7
Add documentation
robacourt e478fee
Decouple Filter tests from the Filter data structure
robacourt 93ee95e
Add optimisation tests
robacourt 51cd083
Refactor reductions/1
robacourt 0f8ef27
Rename Filter.empty() to Filter.new()
robacourt 12c0644
Add changeset
robacourt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed? What kinds of errors do we expect to see here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super safety 😄 My reasoning is that if filtering crashes, all the shapes crash, so we need to be more careful than if this was shape specific code. There's a much more targeted
rescue
inTable
that deals with record parsing errors which is much more likely to be hit. This one is more of a catch-all just to be extra safe.Types of error it could catch:
Shape.is_affected_by_relation_change?
exceptionsaffected_shapes/2
These hopefully will never happen, but if they do, we'd rather the filter didn't crash.