Skip to content
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

like / nlike_utf8 do not allow escaping % #415

Closed
Dandandan opened this issue Jun 6, 2021 · 2 comments · Fixed by #2258
Closed

like / nlike_utf8 do not allow escaping % #415

Dandandan opened this issue Jun 6, 2021 · 2 comments · Fixed by #2258
Labels
arrow Changes to the arrow crate bug good first issue Good for newcomers

Comments

@Dandandan
Copy link
Contributor

Dandandan commented Jun 6, 2021

Describe the bug

like_utf8 and nlike_utf8 and scalar variants don't take care of escaping the wildcard character.

To Reproduce

    test_utf8_scalar!(
        test_utf8_scalar_escape,
        vec!["a%", "a\\x"],
        "a\\%",
        like_utf8_scalar,
        vec![true, false]
    );

This fails in master, returning false / true.

Expected behavior
A clear and concise description of what you expected to happen.

Additional context
Add any other context about the problem here.

@alamb
Copy link
Contributor

alamb commented Dec 22, 2021

Another reproducer from @jwdeitch on #1087

    test_utf8!(
        ilike_utf8_scalar_regex,
        vec!["%%%"],
        vec![r#"\%_\%"#],
        ilike_utf8,
        vec![true]
    );

@daniel-martinez-maqueda-sap
Copy link
Contributor

I have a proposal I've been working on that could work:

  • Escape regex patterns calling escape from the crate regex as it is done at the moment
  • If a like wildcard is escaped, remove the escape characters (so that it is matched when running the regex)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate bug good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants