Skip to content

GH-19667: [C++][Gandiva] Use arrow::Result<std::string> for RegexUtil::SqlLikePatternToPcre - #49879

Merged
kou merged 1 commit into
apache:mainfrom
Reranko05:gandiva-19667
May 1, 2026
Merged

GH-19667: [C++][Gandiva] Use arrow::Result<std::string> for RegexUtil::SqlLikePatternToPcre#49879
kou merged 1 commit into
apache:mainfrom
Reranko05:gandiva-19667

Conversation

@Reranko05

@Reranko05Reranko05 commented Apr 28, 2026

Copy link
Copy Markdown
Collaborator

Rationale for this change

Replace the Status + out-parameter pattern in RegexUtil::SqlLikePatternToPcre with arrow::Result<std::string>, aligning with modern Arrow API practices.

What changes are included in this PR?

  • Updated RegexUtil::SqlLikePatternToPcre to return arrow::Result<std::string> instead of using an out-parameter
  • Updated call sites in regex_functions_holder.cc to use ARROW_ASSIGN_OR_RAISE
  • Updated tests in regex_functions_holder_test.cc to use ASSERT_OK_AND_ASSIGN
  • Removed GANDIVA_EXPORT from the inline wrapper to avoid Windows dllimport issues
  • Simplified control flow in regex_functions_holder.cc

Are these changes tested?

  • Rebuilt with ninja gandiva
  • Ran Gandiva tests successfully

Are there any user-facing changes?

Yes.

@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #19667has been automatically assigned in GitHub to PR creator.

@Reranko05

Copy link
Copy Markdown
CollaboratorAuthor

@kou opened this PR for discussion.

Comment threadcpp/src/gandiva/regex_util.cc Outdated
Comment threadcpp/src/gandiva/regex_util.cc Outdated
@github-actionsgithub-actionsBot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Apr 30, 2026
Comment threadcpp/src/gandiva/regex_util.h Outdated
@github-actionsgithub-actionsBot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Apr 30, 2026
@github-actionsgithub-actionsBot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Apr 30, 2026
@Reranko05
Reranko05 requested review from kou and lriggsApril 30, 2026 04:35
@github-actionsgithub-actionsBot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Apr 30, 2026
@github-actionsgithub-actionsBot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Apr 30, 2026
@kou
kou requested review from Copilot and removed request for lriggsApril 30, 2026 11:43

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Gandiva’s RegexUtil::SqlLikePatternToPcre API to avoid mutable reference out-parameters and propagates the change through local LIKE holder call sites and tests.

Changes:

  • Changed RegexUtil::SqlLikePatternToPcre to return arrow::Result<std::string> instead of writing into a mutable out-parameter.
  • Updated LikeHolder creation paths to use ARROW_ASSIGN_OR_RAISE with the new API.
  • Updated the affected unit test to consume the new Result<std::string> return type.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

FileDescription
cpp/src/gandiva/regex_util.hUpdates the public API signature and export annotations for SqlLikePatternToPcre.
cpp/src/gandiva/regex_util.ccImplements the new Result<std::string>-returning conversion function.
cpp/src/gandiva/regex_functions_holder.ccAdapts LIKE holder construction to the new RegexUtil API.
cpp/src/gandiva/regex_functions_holder_test.ccUpdates a test to use the new Result<std::string> return value.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadcpp/src/gandiva/regex_functions_holder.cc Outdated
Comment threadcpp/src/gandiva/regex_functions_holder_test.cc Outdated
Comment threadcpp/src/gandiva/regex_util.h Outdated
Comment threadcpp/src/gandiva/regex_util.h
kou
kou approved these changes Apr 30, 2026

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

Could you update the PR title and description?

@github-actionsgithub-actionsBot added awaiting merge Awaiting merge and removed awaiting change review Awaiting change review labels Apr 30, 2026

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadcpp/src/gandiva/regex_util.cc Outdated
@Reranko05Reranko05 changed the title GH-19667: [C++][Gandiva] Replace RegexUtil out references with pointer out argsGH-19667: [C++][Gandiva] Use arrow::Result<std::string> for RegexUtil::SqlLikePatternToPcreMay 1, 2026
@Reranko05

Copy link
Copy Markdown
CollaboratorAuthor

@kou updated the PR title and description as suggested. Also addressed the minor comment in the code.

Thanks for the review!

@kou
kou merged commit c13f3bc into apache:mainMay 1, 2026
55 checks passed
@koukou removed the awaiting merge Awaiting merge label May 1, 2026
@kou

kou commented May 1, 2026

Copy link
Copy Markdown
Member

Thanks.

@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 0 benchmarking runs that have been run so far on merge-commit c13f3bc.

None of the specified runs were found on the Conbench server.

The full Conbench report has more details.

@Reranko05
Reranko05 deleted the gandiva-19667 branch May 1, 2026 14:18
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit c13f3bc.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 17 possible false positives for unstable benchmarks that are known to sometimes produce them.

Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
…exUtil::SqlLikePatternToPcre (apache#49879)
### Rationale for this change
Replace the `Status` + out-parameter pattern in `RegexUtil::SqlLikePatternToPcre` with `arrow::Result<std::string>`, aligning with modern Arrow API practices.
### What changes are included in this PR?
* Updated `RegexUtil::SqlLikePatternToPcre` to return `arrow::Result<std::string>` instead of using an out-parameter
* Updated call sites in `regex_functions_holder.cc` to use `ARROW_ASSIGN_OR_RAISE`
* Updated tests in `regex_functions_holder_test.cc` to use `ASSERT_OK_AND_ASSIGN`
* Removed `GANDIVA_EXPORT` from the inline wrapper to avoid Windows `dllimport` issues
* Simplified control flow in `regex_functions_holder.cc`
### Are these changes tested?
* Rebuilt with `ninja gandiva`
* Ran Gandiva tests successfully
### Are there any user-facing changes?
Yes.
* GitHub Issue: apache#19667
Authored-by: Aaditya Srinivasan <aadityasri03@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Sign up for freeto 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.

4 participants

@Reranko05@kou@lriggs