-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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: Expressify str.slice
#13747
feat: Expressify str.slice
#13747
Conversation
@alexander-beedie You might be interested in this :) This will work well with |
c866553
to
ed4cd28
Compare
Powerful combination! 😎 |
@@ -905,11 +905,11 @@ impl SQLFunctionVisitor<'_> { | |||
Reverse => self.visit_unary(|e| e.str().reverse()), | |||
Right => self.try_visit_binary(|e, length| { | |||
Ok(e.str().slice( match length { | |||
Expr::Literal(LiteralValue::Int64(n)) => -n, | |||
Expr::Literal(LiteralValue::Int64(n)) => lit(-n), |
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.
@alexander-beedie I've mostly left the SQL part as it is, so feel free to push a new commit or open a new PR if you want to improve it to work better with expressions.
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.
Will do; thx! :))
}) | ||
}, | ||
(len_a, 1, len_c) if len_a == len_c => { | ||
fn infer<F: for<'a> FnMut(Option<&'a str>, Option<u64>) -> Option<&'a str>>(f: F) -> F where |
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.
The compiler is a bit annoying, so we have to introduce this infer
function to keep it happy.
Co-authored-by: cmdlineluser <99486669+cmdlineluser@users.noreply.github.com>
ed4cd28
to
c617570
Compare
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.
Nice one. Thanks @mcrumiller and @reswqa for the unified effort. 😄
@ritchie46 I think you meant to thank @cmdlineluser, I didn't contribute to this one! |
IDK what precisely is going on there, but at this point it looks like its all my fault, sorry if I alarmed someone. Unless I cleared that up and found a minimal example that shows a difference between releases, I'll have to retract this. |
Co-authored-by: cmdlineluser <99486669+cmdlineluser@users.noreply.github.com>
This comes from @cmdlineluser's nice work. It's hard to make any changes in the original commit due to too many code conflicts, but I'm listing him as a co-author to keep authorship :)