-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
refactor: use ExprBuilder to consume substrait expr and use macro to generate error #8515
Conversation
Signed-off-by: Ruihang Xia <[email protected]>
Signed-off-by: Ruihang Xia <[email protected]>
@@ -517,6 +517,9 @@ make_error!(not_impl_err, not_impl_datafusion_err, NotImplemented); | |||
// Exposes a macro to create `DataFusionError::Execution` | |||
make_error!(exec_err, exec_datafusion_err, Execution); | |||
|
|||
// Exposes a macro to create `DataFusionError::Substrait` | |||
make_error!(substrait_err, substrait_datafusion_err, Substrait); |
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.
👍
|
||
impl BuiltinExprBuilder { | ||
pub fn try_from_name(name: &str) -> Option<Self> { | ||
match name { |
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.
should we that be case insensitive?
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.
Looks like the existing code is also case sensitive. Not that we shouldn't fix it if it should be ignoring case, but I dont' think this PR makes it any better or worse
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.
Thanks for reminding me 👍 I added an item to #8149, I would take other implementations as a reference on how they handle case sensitivity.
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.
|
||
impl BuiltinExprBuilder { | ||
pub fn try_from_name(name: &str) -> Option<Self> { | ||
match name { |
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.
Looks like the existing code is also case sensitive. Not that we shouldn't fix it if it should be ignoring case, but I dont' think this PR makes it any better or worse
Which issue does this PR close?
Related to #8149
Rationale for this change
This PR does two reactors:
Expr
branches inScalarFunctionType
into one. And move the dispatch logic intoBuiltinExprBuilder
.substrait_err!
/substrait_datafusion_err!
to generate errors.I'm going to implement other
Expr
types in substrait. This refactoring makes it easier to extend the match ofExpr
sWhat changes are included in this PR?
As described above. This PR doesn't contains logical change
Are these changes tested?
By existing cases
Are there any user-facing changes?
No