You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/12/22 08:53:46 UTC

[GitHub] [arrow-rs] Dandandan opened a new pull request #1085: Fix like regex escaping

Dandandan opened a new pull request #1085:
URL: https://github.com/apache/arrow-rs/pull/1085


   # Which issue does this PR close?
   
   <!---
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Closes #1069
   
   # Rationale for this change
    
    <!---
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
   -->
   
   # What changes are included in this PR?
   
   <!---
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   # Are there any user-facing changes?
   
   
   <!---
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!---
   If there are any breaking changes to public APIs, please add the `breaking change` label.
   -->
   


-- 
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



[GitHub] [arrow-rs] codecov-commenter commented on pull request #1085: Fix like regex escaping

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #1085:
URL: https://github.com/apache/arrow-rs/pull/1085#issuecomment-999618614


   # [Codecov](https://codecov.io/gh/apache/arrow-rs/pull/1085?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1085](https://codecov.io/gh/apache/arrow-rs/pull/1085?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (976c03a) into [master](https://codecov.io/gh/apache/arrow-rs/commit/5a323915f6c5f53605b82b29c3867252036efe90?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5a32391) will **decrease** coverage by `0.00%`.
   > The diff coverage is `100.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/arrow-rs/pull/1085/graphs/tree.svg?width=650&height=150&src=pr&token=pq9V9qWZ1N&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/arrow-rs/pull/1085?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1085      +/-   ##
   ==========================================
   - Coverage   82.28%   82.28%   -0.01%     
   ==========================================
     Files         168      168              
     Lines       49281    49289       +8     
   ==========================================
   + Hits        40549    40555       +6     
   - Misses       8732     8734       +2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/arrow-rs/pull/1085?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [arrow/src/compute/kernels/comparison.rs](https://codecov.io/gh/apache/arrow-rs/pull/1085/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXJyb3cvc3JjL2NvbXB1dGUva2VybmVscy9jb21wYXJpc29uLnJz) | `93.34% <100.00%> (+0.06%)` | :arrow_up: |
   | [arrow/src/datatypes/field.rs](https://codecov.io/gh/apache/arrow-rs/pull/1085/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXJyb3cvc3JjL2RhdGF0eXBlcy9maWVsZC5ycw==) | `53.37% <0.00%> (-0.31%)` | :arrow_down: |
   | [parquet\_derive/src/parquet\_field.rs](https://codecov.io/gh/apache/arrow-rs/pull/1085/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGFycXVldF9kZXJpdmUvc3JjL3BhcnF1ZXRfZmllbGQucnM=) | `65.98% <0.00%> (-0.23%)` | :arrow_down: |
   | [arrow/src/array/transform/mod.rs](https://codecov.io/gh/apache/arrow-rs/pull/1085/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXJyb3cvc3JjL2FycmF5L3RyYW5zZm9ybS9tb2QucnM=) | `84.86% <0.00%> (-0.14%)` | :arrow_down: |
   | [parquet/src/encodings/encoding.rs](https://codecov.io/gh/apache/arrow-rs/pull/1085/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGFycXVldC9zcmMvZW5jb2RpbmdzL2VuY29kaW5nLnJz) | `93.71% <0.00%> (+0.19%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/arrow-rs/pull/1085?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/arrow-rs/pull/1085?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [5a32391...976c03a](https://codecov.io/gh/apache/arrow-rs/pull/1085?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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



[GitHub] [arrow-rs] alamb commented on pull request #1085: Fix like regex escaping

Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #1085:
URL: https://github.com/apache/arrow-rs/pull/1085#issuecomment-999714390


   > I think there may be an outstanding escaping issue in where right-hand side is '%%%' and you want to match on '(literal%)_(literal%)'.... but this problem may be outside the scope of this fix. :)
   
   We can file a follow on ticket, perhaps. If someone can whip up a reproducer that would be awesome 🤞 


-- 
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



[GitHub] [arrow-rs] alamb commented on pull request #1085: Fix like regex escaping

Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #1085:
URL: https://github.com/apache/arrow-rs/pull/1085#issuecomment-999763420


   Filed https://github.com/apache/arrow-rs/issues/1087 to track the possible escaping problems


-- 
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



[GitHub] [arrow-rs] Dandandan commented on a change in pull request #1085: Fix like regex escaping

Posted by GitBox <gi...@apache.org>.
Dandandan commented on a change in pull request #1085:
URL: https://github.com/apache/arrow-rs/pull/1085#discussion_r773967897



##########
File path: arrow/src/compute/kernels/comparison.rs
##########
@@ -259,14 +259,14 @@ where
     let mut result = BooleanBufferBuilder::new(left.len());
     for i in 0..left.len() {
         let haystack = left.value(i);
-        let pat = right.value(i);
-        let re = if let Some(ref regex) = map.get(pat) {
+        let pat = escape(right.value(i));
+        let re = if let Some(ref regex) = map.get(&pat) {
             regex
         } else {
             let re_pattern = pat.replace("%", ".*").replace("_", ".");

Review comment:
       Yeah, to make a proper regex out of it (instead of literally matching on the percentage or underscore character).




-- 
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



[GitHub] [arrow-rs] Dandandan commented on a change in pull request #1085: Fix like regex escaping

Posted by GitBox <gi...@apache.org>.
Dandandan commented on a change in pull request #1085:
URL: https://github.com/apache/arrow-rs/pull/1085#discussion_r773967897



##########
File path: arrow/src/compute/kernels/comparison.rs
##########
@@ -259,14 +259,14 @@ where
     let mut result = BooleanBufferBuilder::new(left.len());
     for i in 0..left.len() {
         let haystack = left.value(i);
-        let pat = right.value(i);
-        let re = if let Some(ref regex) = map.get(pat) {
+        let pat = escape(right.value(i));
+        let re = if let Some(ref regex) = map.get(&pat) {
             regex
         } else {
             let re_pattern = pat.replace("%", ".*").replace("_", ".");

Review comment:
       Yeah to make a proper regex out of it (instead of literally matching on the percentage or underscore character).




-- 
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



[GitHub] [arrow-rs] alamb commented on a change in pull request #1085: Fix like regex escaping

Posted by GitBox <gi...@apache.org>.
alamb commented on a change in pull request #1085:
URL: https://github.com/apache/arrow-rs/pull/1085#discussion_r773965887



##########
File path: arrow/src/compute/kernels/comparison.rs
##########
@@ -259,14 +259,14 @@ where
     let mut result = BooleanBufferBuilder::new(left.len());
     for i in 0..left.len() {
         let haystack = left.value(i);
-        let pat = right.value(i);
-        let re = if let Some(ref regex) = map.get(pat) {
+        let pat = escape(right.value(i));
+        let re = if let Some(ref regex) = map.get(&pat) {
             regex
         } else {
             let re_pattern = pat.replace("%", ".*").replace("_", ".");

Review comment:
       Do we still need this `pat.replace` call?




-- 
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



[GitHub] [arrow-rs] Dandandan commented on a change in pull request #1085: Fix like regex escaping

Posted by GitBox <gi...@apache.org>.
Dandandan commented on a change in pull request #1085:
URL: https://github.com/apache/arrow-rs/pull/1085#discussion_r773974426



##########
File path: arrow/src/compute/kernels/comparison.rs
##########
@@ -259,14 +259,14 @@ where
     let mut result = BooleanBufferBuilder::new(left.len());
     for i in 0..left.len() {
         let haystack = left.value(i);
-        let pat = right.value(i);
-        let re = if let Some(ref regex) = map.get(pat) {
+        let pat = escape(right.value(i));
+        let re = if let Some(ref regex) = map.get(&pat) {
             regex
         } else {
             let re_pattern = pat.replace("%", ".*").replace("_", ".");

Review comment:
       But we could minimize some borrow / cloning by moving the `escape`... So now it looks more similar to the other places.




-- 
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



[GitHub] [arrow-rs] Dandandan commented on a change in pull request #1085: Fix like regex escaping

Posted by GitBox <gi...@apache.org>.
Dandandan commented on a change in pull request #1085:
URL: https://github.com/apache/arrow-rs/pull/1085#discussion_r773922025



##########
File path: arrow/src/compute/kernels/comparison.rs
##########
@@ -303,7 +303,7 @@ where
 /// use arrow::compute::like_utf8;
 ///
 /// let strings = StringArray::from(vec!["Arrow", "Arrow", "Arrow", "Ar"]);
-/// let patterns = StringArray::from(vec!["A%", "B%", "A.", "A."]);
+/// let patterns = StringArray::from(vec!["A%", "B%", "A.", "A_"]);

Review comment:
       Lol - even the doctest here was relying on a non-escaped `.`




-- 
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



[GitHub] [arrow-rs] alamb commented on a change in pull request #1085: Fix like regex escaping

Posted by GitBox <gi...@apache.org>.
alamb commented on a change in pull request #1085:
URL: https://github.com/apache/arrow-rs/pull/1085#discussion_r774019594



##########
File path: arrow/src/compute/kernels/comparison.rs
##########
@@ -259,14 +259,14 @@ where
     let mut result = BooleanBufferBuilder::new(left.len());
     for i in 0..left.len() {
         let haystack = left.value(i);
-        let pat = escape(right.value(i));
-        let re = if let Some(ref regex) = map.get(&pat) {
+        let pat = right.value(i);
+        let re = if let Some(ref regex) = map.get(pat) {
             regex
         } else {
-            let re_pattern = pat.replace("%", ".*").replace("_", ".");
+            let re_pattern = escape(pat).replace("%", ".*").replace("_", ".");

Review comment:
       👍 




-- 
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



[GitHub] [arrow-rs] jwdeitch commented on pull request #1085: Fix like regex escaping

Posted by GitBox <gi...@apache.org>.
jwdeitch commented on pull request #1085:
URL: https://github.com/apache/arrow-rs/pull/1085#issuecomment-999627965


   thanks for the PR! looks good!
   I think there may be an outstanding escaping issue in where right-hand side is '%%%' and you want to match on '(literal%)_(literal%)'.... but this problem may be outside the scope of this fix. :)
   
   


-- 
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



[GitHub] [arrow-rs] codecov-commenter edited a comment on pull request #1085: Fix like regex escaping

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1085:
URL: https://github.com/apache/arrow-rs/pull/1085#issuecomment-999618614


   # [Codecov](https://codecov.io/gh/apache/arrow-rs/pull/1085?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1085](https://codecov.io/gh/apache/arrow-rs/pull/1085?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (437782d) into [master](https://codecov.io/gh/apache/arrow-rs/commit/5a323915f6c5f53605b82b29c3867252036efe90?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5a32391) will **increase** coverage by `0.00%`.
   > The diff coverage is `100.00%`.
   
   > :exclamation: Current head 437782d differs from pull request most recent head 595c07b. Consider uploading reports for the commit 595c07b to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/arrow-rs/pull/1085/graphs/tree.svg?width=650&height=150&src=pr&token=pq9V9qWZ1N&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/arrow-rs/pull/1085?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@           Coverage Diff           @@
   ##           master    #1085   +/-   ##
   =======================================
     Coverage   82.28%   82.28%           
   =======================================
     Files         168      168           
     Lines       49281    49289    +8     
   =======================================
   + Hits        40549    40559   +10     
   + Misses       8732     8730    -2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/arrow-rs/pull/1085?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [arrow/src/compute/kernels/comparison.rs](https://codecov.io/gh/apache/arrow-rs/pull/1085/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXJyb3cvc3JjL2NvbXB1dGUva2VybmVscy9jb21wYXJpc29uLnJz) | `93.34% <100.00%> (+0.06%)` | :arrow_up: |
   | [parquet/src/encodings/encoding.rs](https://codecov.io/gh/apache/arrow-rs/pull/1085/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGFycXVldC9zcmMvZW5jb2RpbmdzL2VuY29kaW5nLnJz) | `93.71% <0.00%> (+0.19%)` | :arrow_up: |
   | [arrow/src/datatypes/datatype.rs](https://codecov.io/gh/apache/arrow-rs/pull/1085/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXJyb3cvc3JjL2RhdGF0eXBlcy9kYXRhdHlwZS5ycw==) | `66.80% <0.00%> (+0.42%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/arrow-rs/pull/1085?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/arrow-rs/pull/1085?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [5a32391...595c07b](https://codecov.io/gh/apache/arrow-rs/pull/1085?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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



[GitHub] [arrow-rs] alamb merged pull request #1085: Fix like regex escaping

Posted by GitBox <gi...@apache.org>.
alamb merged pull request #1085:
URL: https://github.com/apache/arrow-rs/pull/1085


   


-- 
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