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

@Reranko05 Reranko05 commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

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 #19667 has been automatically assigned in GitHub to PR creator.

@Reranko05

Copy link
Copy Markdown
Contributor Author

@kou opened this PR for discussion.

Comment thread cpp/src/gandiva/regex_util.cc Outdated
Comment thread cpp/src/gandiva/regex_util.cc Outdated
@github-actions github-actions Bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Apr 30, 2026
Comment thread cpp/src/gandiva/regex_util.h Outdated
@github-actions github-actions Bot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Apr 30, 2026
@github-actions github-actions Bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Apr 30, 2026
@Reranko05
Reranko05 requested review from kou and lriggs April 30, 2026 04:35
@github-actions github-actions Bot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Apr 30, 2026
@github-actions github-actions Bot 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 lriggs April 30, 2026 11:43

Copilot AI 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.

File Description
cpp/src/gandiva/regex_util.h Updates the public API signature and export annotations for SqlLikePatternToPcre.
cpp/src/gandiva/regex_util.cc Implements the new Result<std::string>-returning conversion function.
cpp/src/gandiva/regex_functions_holder.cc Adapts LIKE holder construction to the new RegexUtil API.
cpp/src/gandiva/regex_functions_holder_test.cc Updates 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 thread cpp/src/gandiva/regex_functions_holder.cc Outdated
Comment thread cpp/src/gandiva/regex_functions_holder_test.cc Outdated
Comment thread cpp/src/gandiva/regex_util.h Outdated
Comment thread cpp/src/gandiva/regex_util.h

@kou kou 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-actions github-actions Bot added awaiting merge Awaiting merge and removed awaiting change review Awaiting change review labels Apr 30, 2026

Copilot AI 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 thread cpp/src/gandiva/regex_util.cc Outdated
@Reranko05 Reranko05 changed the title GH-19667: [C++][Gandiva] Replace RegexUtil out references with pointer out args GH-19667: [C++][Gandiva] Use arrow::Result<std::string> for RegexUtil::SqlLikePatternToPcre May 1, 2026
@Reranko05

Copy link
Copy Markdown
Contributor Author

@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:main May 1, 2026
55 checks passed
@kou kou 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 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.

4 participants