add VirtualColumns.findEquivalent and VirtualColumn.EquivalenceKey#17084
Merged
clintropolis merged 3 commits intoapache:masterfrom Sep 17, 2024
Merged
add VirtualColumns.findEquivalent and VirtualColumn.EquivalenceKey#17084clintropolis merged 3 commits intoapache:masterfrom
clintropolis merged 3 commits intoapache:masterfrom
Conversation
abhishekagarwal87
approved these changes
Sep 17, 2024
kgyrtkirk
reviewed
Sep 17, 2024
Comment on lines
+191
to
+192
| for (VirtualColumn vc : virtualColumns) { | ||
| if (vc.isEquivalent(virtualColumn)) { |
Member
There was a problem hiding this comment.
wouldn't this this for loop will cost O(n^2) if it gets run for all VC-s in the query;
I think another pro of making it an internal contract/detail could enable the use of a Set so that it doesn't involve much cost
…umns in VirtualColumns
gianm
approved these changes
Sep 17, 2024
pranavbhole
pushed a commit
to pranavbhole/druid
that referenced
this pull request
Sep 17, 2024
clintropolis
added a commit
to clintropolis/druid
that referenced
this pull request
Sep 26, 2024
clintropolis
added a commit
that referenced
this pull request
Sep 28, 2024
Open
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.
Adds methods to make it easier to check for equivalent virtual columns in the 'native' engine layer, even in cases where output names differ. This method isn't really used yet, but has some use cases in follow-up PRs.
I have only implemented
EquivalenceKeyforExpressionVirtualColumnandNestedFieldVirtualColumnso far, and really only needed it forExpressionVirtualColumn. The default implementation just means a virtual column cannot participate in equivalence, since I noticed a handful of implementations (FallbackVirtualColumn,HashPartitionVirtualColumn, andSettableLongVirtualColumn) do not implement equals proper either. Given their use-cases, and the intended use-case of this method, I don't think it probably matters, though it should be easy enough to add them if we need it.