-
Notifications
You must be signed in to change notification settings - Fork 10
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
support arrow functions with ExprPlanner
#26
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d75d8e2
support arrow functions with UserDefinedSQLPlanner
samuelcolvin c629076
add better docstrings
samuelcolvin e308b57
use datafusion main
samuelcolvin a2dbbfd
pin datafusion
samuelcolvin aa98133
add ? contains test and set dialect
samuelcolvin 1ba8fbf
use alias for arrow rewrite
samuelcolvin fdc45f6
another test
samuelcolvin d061e04
add filter test
samuelcolvin 6cda70e
use datafusion main, add tests for alias predicate
samuelcolvin 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
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.
@alamb it's worth noting that using
UserDefinedSQLPlanner
means the default title for columns becomes the applied function rather than a pretty representation of the actual operator.This differs from what we got from apache/datafusion#11137, see #22 where the column title for this was
test.json_data -> Utf8(\"foo\")
I don't think this is a show stopper, just pointing it out.
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.
One potential way workaround is to use
Expr::alias
to name the expression something less unpleasingThere 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.
Yes, I actually tried that unfortunately it got even more ugly when when you have a complex type and the column heading becomes something like
alias(json_get(test.json_data,Utf8(\"foo\")), "json_data ->> "foo"") = "bar"
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.
That certainly sounds worse -- I would expect the heading to only be
"json_data ->> "foo"
(notalias(...)
) which is how it works for simple typesuse alias
Non alias
Can you provide an example of what you mean by "complex types"? It sounds like it would be good bug / limitation to fix
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.
Okay, I've had another try and most of manually inserting aliases is working, see the penultimate commit below.
The only remain strange case is when doing
(field->'foo')::int
, where my alias logic means that the cast is lost in the alias. See the teststest_arrow_cast_int
andtest_arrow_double_nested_cast
.I can't for the life of me work out how to make the alias (for
test_arrow_cast_int
)(Utf8(\"{\"foo\": 42}\") -> Utf8(\"foo\"))::int
instead of justUtf8(\"{\"foo\": 42}\") -> Utf8(\"foo\")
.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.
(ignore that message)
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.
apache/datafusion#11306 is causing issues.