You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/08/03 14:25:44 UTC
[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #7186: Support simplifying expressions such as `~ ^(ba_r|foo)$` , where the string includes underline
alamb commented on code in PR #7186:
URL: https://github.com/apache/arrow-datafusion/pull/7186#discussion_r1283284682
##########
datafusion/optimizer/src/simplify_expressions/regex.rs:
##########
@@ -131,6 +131,15 @@ fn str_from_literal(l: &Literal) -> Option<&str> {
}
}
+/// returns a str represented by `Literal` if it contains a valid utf8
+/// sequence and is unsafe for like (maybe has '%' or '_')
+fn str_from_literal_unsafe_like(l: &Literal) -> Option<&str> {
Review Comment:
I was somewhat confused about this name and the comments as the code doesn't actually check for '%' or '_`
What would you think about renaming it something like
```suggestion
/// returns a str represented by `Literal` if it contains a valid utf8
fn str_from_literal(l: &Literal) -> Option<&str> {
```
And then renaming the existing `str_from_literal` to something like this:
to
```rust
/// returns a str represented by `Literal` if it contains a valid utf8
/// sequence and is safe for `like` (has no '%' and '_')
fn like_str_from_literal(l: &Literal) -> Option<&str> {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org