Closed
Conversation
hermanschaaf
commented
Dec 8, 2022
| // listAndValidateTables returns a flattened list - we only want to return | ||
| // the top-level tables from this function. | ||
| // listAndValidateTables returns a set of all tables - we only want to return | ||
| // the top-level tables from the set in this function. |
Contributor
Author
There was a problem hiding this comment.
Technically I think this behavior should change (this function should return all tables, not just top-level ones), but I'm not changing it in this PR.
⏱️ Benchmark resultsComparing with cdcef5d
|
disq
reviewed
Dec 8, 2022
Contributor
|
Closing in favour of #488 |
kodiakhq bot
pushed a commit
that referenced
this pull request
Dec 12, 2022
This simplifies our glob filtering and makes sure Tables are always stored in a tree like structured apart from when returned from `FlattenTables`. This solves a lot of potential bugs and places where we need to do things like `if parent != nil`. I think this also closes #475 as there is no need for another data structure. The reasoning for this is that our tables are tree like structured and it's easier imo to always keep it like this everywhere across the code and not have multiple data structures with similar methods and so on. This required a small update to our filtering logic which just works as a DFS and in-place filtering (for that to work I had to add a copy method which I think can be useful for other things in the future).
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 implements the set idea from #470
It doesn't change any behavior, and doesn't fix the bug in
TableForSpec. It's just for readability:listAndValidateTablesnow returns a set type which only supports a very limited set of operations. This set type is passed tosyncDfsrather than a flattened list.syncDfsand its related functions must referencep.tablesto traverse the tables, but can now checkselectedTables.Contains(table.Name)to see whether a given table should be included or skipped. I think this makes the code quite a bit simpler (e.g. no more checks for whether a table is top-level or not) and less error-prone.