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-37751: [C++][Gandiva] Avoid registering exported functions multiple times in gandiva #37752

Merged
merged 3 commits into from
Oct 16, 2023

Conversation

niyue
Copy link
Contributor

@niyue niyue commented Sep 16, 2023

Rationale for this change

Try to fix #37751

What changes are included in this PR?

The exported functions defined in gandiva are registered multiple times unnecessarily. This PR tries to address this issue.

Are these changes tested?

Yes.

Are there any user-facing changes?

No

@github-actions
Copy link

Thanks for opening a pull request!

If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose

Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename the pull request title in the following format?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

In the case of PARQUET issues on JIRA the title also supports:

PARQUET-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

See also:

cpp/src/gandiva/engine.cc Outdated Show resolved Hide resolved
@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Sep 16, 2023
REGISTER_EXPORTED_FUNCS(ExportedTimeFunctions);
REGISTER_EXPORTED_FUNCS(ExportedDecimalFunctions);
REGISTER_EXPORTED_FUNCS(ExportedStringFunctions);
REGISTER_EXPORTED_FUNCS(ExportedHashFunctions);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All the REGISTER_EXPORTED_FUNCS are moved into a exported_funcs.cc file, which makes the registration API to be called from 7 * 6 times down to 6 times.

@niyue niyue changed the title Avoid registering exported functions multiple times in gandiva. [GH-37751] [C++] [Gandiva] Avoid registering exported functions multiple times in gandiva Sep 16, 2023
@niyue niyue force-pushed the bugfix/avoid-dup-registration branch 5 times, most recently from bc2c673 to 5eaf0f8 Compare September 17, 2023 04:21
Copy link
Collaborator

@js8544 js8544 left a comment

Choose a reason for hiding this comment

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

Some minor nits. Can you also add a unit test to make sure each function is only registered once?

cpp/src/gandiva/exported_funcs_registry.h Show resolved Hide resolved
cpp/src/gandiva/engine.cc Show resolved Hide resolved
@js8544
Copy link
Collaborator

js8544 commented Sep 17, 2023

Can you also fix the lint issue in CI?

@niyue niyue force-pushed the bugfix/avoid-dup-registration branch 2 times, most recently from 9ebb6b4 to 92fbf55 Compare September 17, 2023 13:14
@niyue
Copy link
Contributor Author

niyue commented Sep 17, 2023

Can you also fix the lint issue in CI?

Sure. I fixed the lint issue in CI in the new commit.

@niyue
Copy link
Contributor Author

niyue commented Sep 17, 2023

Can you also add a unit test to make sure each function is only registered once?

@js8544 I tried to do that, but currently the registered() method of ExportedFuncsRegistry is a private method, and it is not possible to retrieve the list of currently registered functions from the registry externally, so it is not possible to add such a unit test unless we make the registered() method public. Do you have any recommendation for this? Thanks.

UPDATE:
I used the FRIEND_TEST macro to test this private method now

@niyue niyue force-pushed the bugfix/avoid-dup-registration branch 3 times, most recently from 5482a47 to af90fa2 Compare September 21, 2023 13:41
@niyue
Copy link
Contributor Author

niyue commented Sep 22, 2023

@js8544 this PR is ready for review. There is still one check failing, but it seemed irrelevant with my change (may be caused by CI network issue as far as I can tell). Any comment is appreciated. Thanks.

@kou kou changed the title [GH-37751] [C++] [Gandiva] Avoid registering exported functions multiple times in gandiva [GH-37751] [C++][Gandiva] Avoid registering exported functions multiple times in gandiva Sep 23, 2023
@niyue niyue force-pushed the bugfix/avoid-dup-registration branch from af90fa2 to 3cf1766 Compare October 5, 2023 05:19
@niyue
Copy link
Contributor Author

niyue commented Oct 5, 2023

@js8544 I've resolved the remaining issues and rebased to the latest commit, could you please take a look again? Thanks.

@pitrou
Copy link
Member

pitrou commented Oct 11, 2023

@github-actions crossbow submit -g cpp

@apache apache deleted a comment from github-actions bot Oct 11, 2023
Copy link
Collaborator

@js8544 js8544 left a comment

Choose a reason for hiding this comment

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

+1, just a simple nit.

@github-actions
Copy link

Revision: 3925cad

Submitted crossbow builds: ursacomputing/crossbow @ actions-0aa03adfc8

Task Status
test-alpine-linux-cpp Github Actions
test-build-cpp-fuzz Github Actions
test-conda-cpp Github Actions
test-conda-cpp-valgrind Azure
test-cuda-cpp Github Actions
test-debian-11-cpp-amd64 Github Actions
test-debian-11-cpp-i386 Github Actions
test-fedora-35-cpp Github Actions
test-ubuntu-20.04-cpp Github Actions
test-ubuntu-20.04-cpp-bundled Github Actions
test-ubuntu-20.04-cpp-minimal-with-formats Github Actions
test-ubuntu-20.04-cpp-thread-sanitizer Github Actions
test-ubuntu-22.04-cpp Github Actions
test-ubuntu-22.04-cpp-20 Github Actions
test-ubuntu-22.04-cpp-no-threading Github Actions

@pitrou
Copy link
Member

pitrou commented Oct 11, 2023

@github-actions crossbow submit -g python

@github-actions
Copy link

Revision: 9e7ebb5

Submitted crossbow builds: ursacomputing/crossbow @ actions-d691ca469b

Task Status
test-conda-python-3.10 Github Actions
test-conda-python-3.10-cython2 Github Actions
test-conda-python-3.10-hdfs-2.9.2 Github Actions
test-conda-python-3.10-hdfs-3.2.1 Github Actions
test-conda-python-3.10-pandas-latest Github Actions
test-conda-python-3.10-pandas-nightly Github Actions
test-conda-python-3.10-spark-v3.4.1 Github Actions
test-conda-python-3.10-substrait Github Actions
test-conda-python-3.11 Github Actions
test-conda-python-3.11-dask-latest Github Actions
test-conda-python-3.11-dask-upstream_devel Github Actions
test-conda-python-3.11-hypothesis Github Actions
test-conda-python-3.11-pandas-upstream_devel Github Actions
test-conda-python-3.11-spark-master Github Actions
test-conda-python-3.8 Github Actions
test-conda-python-3.8-pandas-1.0 Github Actions
test-conda-python-3.8-spark-v3.4.1 Github Actions
test-conda-python-3.9 Github Actions
test-conda-python-3.9-pandas-latest Github Actions
test-cuda-python Github Actions
test-debian-11-python-3 Azure
test-fedora-35-python-3 Azure
test-ubuntu-20.04-python-3 Azure
test-ubuntu-22.04-python-3 Github Actions

… of testing and use pointers as returned value for consistent with coding convention.
@niyue niyue force-pushed the bugfix/avoid-dup-registration branch from 9e7ebb5 to 49ea793 Compare October 16, 2023 01:21
@js8544
Copy link
Collaborator

js8544 commented Oct 16, 2023

Thanks! LGTM now. Will need @pitrou's approval to merge.

@pitrou pitrou changed the title [GH-37751] [C++][Gandiva] Avoid registering exported functions multiple times in gandiva GH-37751: [C++][Gandiva] Avoid registering exported functions multiple times in gandiva Oct 16, 2023
@pitrou pitrou merged commit 47314e8 into apache:main Oct 16, 2023
33 of 35 checks passed
@pitrou pitrou removed the awaiting committer review Awaiting committer review label Oct 16, 2023
@github-actions github-actions bot added the awaiting committer review Awaiting committer review label Oct 16, 2023
@conbench-apache-arrow
Copy link

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

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

JerAguilon pushed a commit to JerAguilon/arrow that referenced this pull request Oct 23, 2023
…ultiple times in gandiva (apache#37752)

### Rationale for this change
Try to fix apache#37751

### What changes are included in this PR?

The exported functions defined in gandiva are registered multiple times unnecessarily. This PR tries to address this issue.

### Are these changes tested?

Yes.

### Are there any user-facing changes?
No

Authored-by: Yue Ni <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
loicalleyne pushed a commit to loicalleyne/arrow that referenced this pull request Nov 13, 2023
…ultiple times in gandiva (apache#37752)

### Rationale for this change
Try to fix apache#37751

### What changes are included in this PR?

The exported functions defined in gandiva are registered multiple times unnecessarily. This PR tries to address this issue.

### Are these changes tested?

Yes.

### Are there any user-facing changes?
No

Authored-by: Yue Ni <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
dgreiss pushed a commit to dgreiss/arrow that referenced this pull request Feb 19, 2024
…ultiple times in gandiva (apache#37752)

### Rationale for this change
Try to fix apache#37751

### What changes are included in this PR?

The exported functions defined in gandiva are registered multiple times unnecessarily. This PR tries to address this issue.

### Are these changes tested?

Yes.

### Are there any user-facing changes?
No

Authored-by: Yue Ni <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
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] Exported functions are registered multiple times in gandiva
3 participants