-
Notifications
You must be signed in to change notification settings - Fork 54
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: Add ability to explain groupNode
and it's attribute(s).
#641
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
667bc3d
wip: Store the field key name with the index, i.e. use `mapper.Field`.
shahzadlone 81462de
wip: Make `groupNode` explainable.
shahzadlone dd80b97
wip: Implement the explanation of the groupNode attribute(s).
shahzadlone 08a13d1
wip: Add tests for groupBy explain cases.
shahzadlone 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
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
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
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
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.
suggestion(blocking): I'm very hesitant to make a change like this without input from Andy, just for the sake of the explain system.
As I understand it, the goal here is to be able to efficiently get the corresponding FieldName when doing the
GroupBy
explain, but this change affects a lot of other places (as you know, since you had to update them all).But, as I understand it, the mapper already has a utility to convert
index
intoFieldName
without needing to make a change like this.eg:
n.documentMapping.TryToFindNameFromIndex(index)
. Which you are already using for the order fields. Is it not possible to use this utility as well for the groupby fields? Which would mean you don't have to make this change?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.
Fair point John. I do think however that the codes reads a bit nicer with this change. For example, this:
reads better than this:
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.
There's certainly more than a few rough edges w.r.t the mapper system, which are being tracked/tackled in #606.
The explain PRs should make an effort to not change core planner functionality, if it does need a refactor for something, it should be done in a seperate PR.
For this specific PR, as far as I can tall, the
TryToFindNameFromIndex
seems like it should be sufficient to circumvent this larger change.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.
It doesn't really change the functionality though. It merely adds information to a variable (from
[]int
to[]struct
) and changes its name. I think of it as if it were already a struct, it would just be adding a struct field.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.
You make a fair point, however this is basically just adding an additional field (is nicer IMO). It's nice to have a guarantee of field index always having a corresponding name.
I wrote the
TryToFindNameFromIndex
function for finding indexes of ordering elements inorderNode
. Using that function wouldn't guarantee that the field name exists (even though it should), and obviously is not as nice doing lookup if we don't have to.One other thing I could do to reduce the changes (however would still prefer this approach better), is I could still pass in only the list of indexes into the functions whose signatures were changed to
mapper.Field[]
fromint[]
.LMK what you think, at the end of the day this is a very safe change as it's just tagging an additional field, and the previous field stays there as it was before. I would be concerned if I had removed a field haha
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.
I'd still prefer to try to minimize changes beyond utility funcs for explain PRs.
Although technically this is a small change (
[]int
to[]struct
) as Fred pointed out, it does sprawl all over the implementation.Its OK for now, but lets try to minimize this stuff in the future.