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

GH-38920: [C++][Gandiva] Refactor function holder to return arrow Result #38873

Merged
merged 2 commits into from
Nov 29, 2023

Conversation

niyue
Copy link
Contributor

@niyue niyue commented Nov 24, 2023

Rationale for this change

What changes are included in this PR?

  • A refactoring task to return arrow::Result in Gandiva FunctionHolder classes

Are these changes tested?

It should be covered by existing unit tests.

Are there any user-facing changes?

No

@niyue
Copy link
Contributor Author

niyue commented Nov 24, 2023

@kou I submit this PR to address the follow up task mentioned in #38632 (comment).

But after I finish most of the refactoring, I realize the template function may still be needed since the function holder map requires returning a parent class shared_ptr (FunctionHolderPtr) but each FunctionHolder sub class's Make returns a concrete class shared_ptr.

But this PR at least reduces 130 lines of code, so I think it may still be useful and submit it here.

@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Nov 24, 2023
@niyue niyue force-pushed the bugfix/refactor-func-holder branch from 7244794 to 298076e Compare November 24, 2023 13:41
@kou
Copy link
Member

kou commented Nov 24, 2023

Thanks. Could you open an issue for this?
This is not a MINOR task now. :-)
Our MINOR definition: https://github.com/apache/arrow/blob/main/CONTRIBUTING.md#minor-fixes

@niyue niyue force-pushed the bugfix/refactor-func-holder branch 2 times, most recently from 282c14d to 77733fb Compare November 25, 2023 06:29
@niyue niyue changed the title MINOR: [C++][Gandiva] Refactor gandiva function holder to return arrow Result GH-38879: [C++][Gandiva] Fix to_date_utf8_utf8_int32 function param validation and refactor gandiva function holder to return arrow Result Nov 25, 2023
Copy link

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

@niyue
Copy link
Contributor Author

niyue commented Nov 25, 2023

Could you open an issue for this?

Sure. I opened a bug #38879, which described the to_date_utf8_utf8_int32 invalid input bug I fixed in this PR. And the refactoring task is described in this PR description. Let me know if I need to create a separated issue for that.

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

I opened a bug #38879, which described the to_date_utf8_utf8_int32 invalid input bug I fixed in this PR. And the refactoring task is described in this PR description. Let me know if I need to create a separated issue for that.

Thanks.
Could you open one more issue for refactoring?
This has many refactoring related changes. If we mix the bug fix change and refactoring related changes in one PR, it's difficult to find the bug fix related change.

cpp/src/gandiva/regex_functions_holder.cc Outdated Show resolved Hide resolved
cpp/src/gandiva/regex_functions_holder_test.cc Outdated Show resolved Hide resolved
cpp/src/gandiva/regex_functions_holder_test.cc Outdated Show resolved Hide resolved
@github-actions github-actions bot added awaiting changes Awaiting changes awaiting change review Awaiting change review and removed awaiting committer review Awaiting committer review awaiting changes Awaiting changes labels Nov 27, 2023
@niyue
Copy link
Contributor Author

niyue commented Nov 28, 2023

Could you open one more issue for refactoring?

Okay. Do you think if I need to submit a separated PR, this one for bug fixing and the other one for refactoring?

Update:
I now separated this PR into two PRs, and the corresponding issues are separated as well

I made this PR to be the refactoring task PR since most of the review comments are for refactoring task. The PR title/description is updated as well.

@niyue niyue force-pushed the bugfix/refactor-func-holder branch from 818c790 to b3bb57f Compare November 28, 2023 12:36
@niyue niyue changed the title GH-38879: [C++][Gandiva] Fix to_date_utf8_utf8_int32 function param validation and refactor gandiva function holder to return arrow Result GH-38920: [C++][Gandiva] Refactor gandiva function holder to return arrow Result Nov 28, 2023
Copy link

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

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

This is a welcome improvement.

cpp/src/gandiva/random_generator_holder.cc Show resolved Hide resolved
cpp/src/gandiva/random_generator_holder.cc Show resolved Hide resolved
@pitrou
Copy link
Member

pitrou commented Nov 28, 2023

cc @js8544

cpp/src/gandiva/regex_functions_holder.cc Outdated Show resolved Hide resolved
cpp/src/gandiva/regex_functions_holder.cc Show resolved Hide resolved
cpp/src/gandiva/regex_functions_holder.cc Show resolved Hide resolved
cpp/src/gandiva/regex_functions_holder_test.cc Outdated Show resolved Hide resolved
cpp/src/gandiva/regex_functions_holder_test.cc Outdated Show resolved Hide resolved
cpp/src/gandiva/regex_functions_holder_test.cc Outdated Show resolved Hide resolved
cpp/src/gandiva/regex_functions_holder_test.cc Outdated Show resolved Hide resolved
cpp/src/gandiva/to_date_holder.cc Show resolved Hide resolved
cpp/src/gandiva/to_date_holder_test.cc Outdated Show resolved Hide resolved
@kou kou changed the title GH-38920: [C++][Gandiva] Refactor gandiva function holder to return arrow Result GH-38920: [C++][Gandiva] Refactor function holder to return arrow Result Nov 29, 2023
@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Nov 29, 2023
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Nov 29, 2023
@pitrou
Copy link
Member

pitrou commented Nov 29, 2023

Ci failures look unrelated, I'll merge.

Thanks a lot for doing this @niyue !

@pitrou pitrou merged commit 6f497ec into apache:main Nov 29, 2023
40 of 43 checks passed
@pitrou pitrou removed the awaiting change review Awaiting change review label Nov 29, 2023
Copy link

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

There were 4 benchmark results indicating a performance regression:

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

dgreiss pushed a commit to dgreiss/arrow that referenced this pull request Feb 19, 2024
…ow Result (apache#38873)

### Rationale for this change
* This PR tries to make Gandiva `FunctionHolder` classes to return `arrow::Result` instead of using output parameters, and this tries to address the follow up task mentioned in apache#38632 (comment) and makes the code slightly simpler

### What changes are included in this PR?
* A refactoring task to return `arrow::Result` in Gandiva FunctionHolder classes

### Are these changes tested?
It should be covered by existing unit tests.

### Are there any user-facing changes?
No
* Closes: apache#38920

Authored-by: Yue Ni <niyue.com@gmail.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
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.

[C++][Gandiva] Refactor function holder to return arrow Result
4 participants