Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Fix cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-martinez-maqueda-sap committed Aug 3, 2022
1 parent e430c9b commit 65c9a1a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/compute/like.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ fn replace_pattern(pattern: &str) -> String {
result.push('\\');
result.push('\\');
}

}
} else if regex_syntax::is_meta_character(c) {
result.push('\\');
Expand Down Expand Up @@ -142,7 +141,10 @@ fn a_like_utf8_scalar<O: Offset, F: Fn(bool) -> bool>(

let values = if !rhs.contains(is_like_pattern) {
Bitmap::from_trusted_len_iter(lhs.values_iter().map(|x| op(x == rhs)))
} else if rhs.ends_with('%') && !rhs.ends_with("\\%") && !rhs[..rhs.len() - 1].contains(is_like_pattern) {
} else if rhs.ends_with('%')
&& !rhs.ends_with("\\%")
&& !rhs[..rhs.len() - 1].contains(is_like_pattern)
{
// fast path, can use starts_with
let starts_with = &rhs[..rhs.len() - 1];
Bitmap::from_trusted_len_iter(lhs.values_iter().map(|x| op(x.starts_with(starts_with))))
Expand Down Expand Up @@ -294,7 +296,10 @@ fn a_like_binary_scalar<O: Offset, F: Fn(bool) -> bool>(

let values = if !pattern.contains(is_like_pattern) {
Bitmap::from_trusted_len_iter(lhs.values_iter().map(|x| op(x == rhs)))
} else if pattern.ends_with('%') && !pattern.ends_with("\\%") && !pattern[..pattern.len() - 1].contains(is_like_pattern) {
} else if pattern.ends_with('%')
&& !pattern.ends_with("\\%")
&& !pattern[..pattern.len() - 1].contains(is_like_pattern)
{
// fast path, can use starts_with
let starts_with = &rhs[..rhs.len() - 1];
Bitmap::from_trusted_len_iter(lhs.values_iter().map(|x| op(x.starts_with(starts_with))))
Expand Down
1 change: 0 additions & 1 deletion tests/it/compute/like.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ fn test_like_utf8_scalar() -> Result<()> {
let result = like_utf8_scalar(&array, "A\\_row").unwrap();
assert_eq!(result, BooleanArray::from_slice(&[true, false]));


Ok(())
}

Expand Down

0 comments on commit 65c9a1a

Please sign in to comment.