-
Notifications
You must be signed in to change notification settings - Fork 3.8k
expression transform improvements and fixes #13947
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
Merged
clintropolis
merged 6 commits into
apache:master
from
clintropolis:expr-transform-improvements-and-binding-consistency
Mar 22, 2023
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0aa8012
expression transform improvements and fixes
clintropolis 3dadf37
more better
clintropolis 26b31da
better and fix tests
clintropolis 3c460d9
style
clintropolis c53a510
use partial type information for post aggregators
clintropolis e1a4f20
migrate some test uses of InputBindings.forMap to use other methods
clintropolis 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 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
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
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
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.
This has me wondering, what if an expression actually wants the
byte[]how would it be defined so that if one expression returns abyte[]and the next one wants to use it, then it will just be passed through without being base64 encoded in between?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.
This block is for things that are asking for
STRINGtyped values, (though they might be multi-value strings as well).COMPLEXtypes will accept bytes as is and try to deserialize them into the appropriate object using aTypeStrategythat wraps theObjectStrategy.However, to complicate this answer slightly, where the type passed to this method comes from varies depending on where it is being called. This
ofTypemethod is what backsIdentifierExprwhich is what feeds input values into expressions. When backed by a segment, the type will be the type which was stored in the segment, etc. For places we don't know though, such as expression transforms, we fall back to usingbestEffortOf, which will handlebyte[]as aSTRINGtype. It lacks the complex type name so cant handle byte[] to complex object translation, so we turn it into a string because at least then something could do something with it.Responding to this made me realize that the expression post-agg bindings could be improved with the partial type information derived from the aggregators 'result' type, so I have updated them to use it accordingly in the latest commit.
Back to
byte[], we could alternatively consider leaving it as 'unknown'COMPLEX, though that would cause some issue with nested columns which is the other main user of 'bestEffortOf', which uses it to try to derive the type information of these values. Since we don't have a native binary blob type,STRINGis most useful here so we can at least preserve the values (and for JSON,byte[]already come in as base64 strings, so byte[] really only appear in other nested formats, such as Avro, Parquet, Protobuf, and ORC).