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

ARROW-18235: [C++][Gandiva] Fix the like function implementation for escape chars #14579

Merged
merged 1 commit into from Nov 16, 2022

Conversation

siddhantrao23
Copy link
Contributor

@siddhantrao23 siddhantrao23 commented Nov 3, 2022

The current implementation of optimisation for like function does a
removal of the escape char, this causes errors in matching if the escape
char is one of the pcre special chars or if the escape char is followed
by itself.

Fix this by only removing the '\' escape char during optimisation.

@github-actions
Copy link

github-actions bot commented Nov 3, 2022

@github-actions
Copy link

github-actions bot commented Nov 3, 2022

⚠️ Ticket has not been started in JIRA, please click 'Start Progress'.

cpp/src/gandiva/regex_util.cc Outdated Show resolved Hide resolved

auto literal_escape_pattern =
TreeExprBuilder::MakeStringLiteral("%tu^_security^_freeze%");
auto escape_char = TreeExprBuilder::MakeStringLiteral("^");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a PCRE special character that is invalid without suitable escap such as [ instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The escape char used here ('^') is one of the pcre spacial characters.

…ters

The current implementation of optimisation for like function does a
removal of the escape char, this causes errors in matching if the escape
char is one of the pcre special chars or if the escape char is followed
by itself.

Fix this by only removing the '\\' escape char during optimisation.
@kou kou merged commit e0e7ba8 into apache:master Nov 16, 2022
@ursabot
Copy link

ursabot commented Nov 17, 2022

Benchmark runs are scheduled for baseline = 5f8cc74 and contender = e0e7ba8. e0e7ba8 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished ⬇️0.0% ⬆️0.0%] ec2-t3-xlarge-us-east-2
[Finished ⬇️0.3% ⬆️0.0%] test-mac-arm
[Failed ⬇️0.27% ⬆️0.0%] ursa-i9-9960x
[Finished ⬇️0.1% ⬆️0.0%] ursa-thinkcentre-m75q
Buildkite builds:
[Finished] e0e7ba82 ec2-t3-xlarge-us-east-2
[Finished] e0e7ba82 test-mac-arm
[Finished] e0e7ba82 ursa-i9-9960x
[Finished] e0e7ba82 ursa-thinkcentre-m75q
[Finished] 5f8cc745 ec2-t3-xlarge-us-east-2
[Finished] 5f8cc745 test-mac-arm
[Failed] 5f8cc745 ursa-i9-9960x
[Finished] 5f8cc745 ursa-thinkcentre-m75q
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

@ursabot
Copy link

ursabot commented Nov 17, 2022

['Python', 'R'] benchmarks have high level of regressions.
ursa-i9-9960x

siddhantrao23 added a commit to siddhantrao23/arrow that referenced this pull request Nov 22, 2022
…escape chars (apache#14579)

 The current implementation of optimisation for like function does a
 removal of the escape char, this causes errors in matching if the escape
 char is one of the pcre special chars or if the escape char is followed
 by itself.

 Fix this by only removing the '\\' escape char during optimisation.

Authored-by: Siddhant Rao <siddhant.rao@dremio.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
siddhantrao23 added a commit to siddhantrao23/arrow that referenced this pull request Nov 24, 2022
…escape chars (apache#14579)

 The current implementation of optimisation for like function does a
 removal of the escape char, this causes errors in matching if the escape
 char is one of the pcre special chars or if the escape char is followed
 by itself.

 Fix this by only removing the '\\' escape char during optimisation.

Authored-by: Siddhant Rao <siddhant.rao@dremio.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
siddhantrao23 added a commit to dremio/arrow that referenced this pull request Nov 24, 2022
…escape chars (apache#14579)

 The current implementation of optimisation for like function does a
 removal of the escape char, this causes errors in matching if the escape
 char is one of the pcre special chars or if the escape char is followed
 by itself.

 Fix this by only removing the '\\' escape char during optimisation.

Authored-by: Siddhant Rao <siddhant.rao@dremio.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants