-
Notifications
You must be signed in to change notification settings - Fork 169
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: Support ANSI mode in CAST from String to Bool #290
Conversation
other if ansi_mode => { | ||
return Err(CometError::CastInvalidValue { | ||
value: other.to_string(), | ||
from_type: "STRING".to_string(), | ||
to_type: "BOOLEAN".to_string(), | ||
}) | ||
} |
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 is the actual fix to add ANSI support in this specific cast operation. The rest of the PR is plumbing to pass ANSI mode down into the planner and improving the cast test suite.
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.
Is checking children length required?
I will need to do some shim work to make this compile with earlier versions of Spark. |
// We have to workaround https://github.com/apache/datafusion-comet/issues/293 here by | ||
// removing the "Execution error: " error message prefix that is added by DataFusion | ||
val cometMessage = actual.getMessage | ||
.substring("Execution error: ".length) |
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.
Follow on issue to resolve this: #293
Thank you @andygrove |
Which issue does this PR close?
Part of the epic #286
Rationale for this change
This PR implements ANSI mode for casting string to boolean, and hopefully provides a good example that others can follow when adding ANSI support to other cast operations.
What changes are included in this PR?
cast()
andtry_cast()
with ANSI enabled and disabledHow are these changes tested?
New/improved tests in CometCastSuite.