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

Accept r-value references in convert_table_for_return(): #10131

Merged
merged 6 commits into from
Jan 27, 2022

Conversation

mythrocks
Copy link
Contributor

@mythrocks mythrocks commented Jan 26, 2022

cudf::jni::convert_table_for_return() is usually used on tables returned from a libcudf API call.
It currently requires an l-value reference for its table argument. This necessitates parking the result of libcudf call in an avoidable temp variable.
This commit adds the option to use an r-value reference. This allows table expressions to be used directly, reducing clutter.

Note:

  1. The previous signature is retained, because not all call sites can use the r-value
    interface cleanly. (E.g. when the libcudf call is complex.)
  2. The third argument (vector<unique_ptr>) has been converted from l-ref to r-ref,
    so that an empty default can be introduced.

This commit also includes minor code cleanup in the periphery of calls to convert_table_for_return().

`cudf::jni::convert_table_for_return()` is usually used on tables returned from a libcudf API call.
It currently requires an l-value reference for its table argument. This necessitates parking the
result of libcudf call in an avoidable temp variable.
This commit adds the option to use an r-value reference. This allows table expressions to be used
directly, reducing clutter.

Note:
  1. The previous signature is retained, because not all call sites can use the r-value interface
     cleanly. (E.g. when the libcudf call is complex.)
  2. The third argument (vector<unique_ptr<column>>) has been converted from l-ref to r-ref,
     so that an empty default can be introduced.

This commit also includes minor code cleanup in the periphery of calls to `convert_table_for_return()`.
Call it collateral damage.
@mythrocks mythrocks self-assigned this Jan 26, 2022
@mythrocks mythrocks requested a review from a team as a code owner January 26, 2022 04:59
@github-actions github-actions bot added the Java Affects Java cuDF API. label Jan 26, 2022
@mythrocks mythrocks marked this pull request as draft January 26, 2022 04:59
@mythrocks mythrocks added code quality improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Jan 26, 2022
Added/Fixed jpointerArray::begin()/end() signatures.
@codecov
Copy link

codecov bot commented Jan 26, 2022

Codecov Report

Merging #10131 (c5340c2) into branch-22.04 (e24fa8f) will increase coverage by 0.05%.
The diff coverage is n/a.

Impacted file tree graph

@@               Coverage Diff                @@
##           branch-22.04   #10131      +/-   ##
================================================
+ Coverage         10.37%   10.43%   +0.05%     
================================================
  Files               119      119              
  Lines             20149    20594     +445     
================================================
+ Hits               2091     2148      +57     
- Misses            18058    18446     +388     
Impacted Files Coverage Δ
python/cudf/cudf/errors.py 0.00% <0.00%> (ø)
python/cudf/cudf/io/csv.py 0.00% <0.00%> (ø)
python/cudf/cudf/io/hdf.py 0.00% <0.00%> (ø)
python/cudf/cudf/io/orc.py 0.00% <0.00%> (ø)
python/cudf/cudf/__init__.py 0.00% <0.00%> (ø)
python/cudf/cudf/_version.py 0.00% <0.00%> (ø)
python/cudf/cudf/core/abc.py 0.00% <0.00%> (ø)
python/cudf/cudf/api/types.py 0.00% <0.00%> (ø)
python/cudf/cudf/io/dlpack.py 0.00% <0.00%> (ø)
python/cudf/cudf/core/frame.py 0.00% <0.00%> (ø)
... and 60 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1246116...c5340c2. Read the comment docs.

java/src/main/native/src/TableJni.cpp Outdated Show resolved Hide resolved
java/src/main/native/src/TableJni.cpp Outdated Show resolved Hide resolved
@mythrocks mythrocks marked this pull request as ready for review January 26, 2022 16:54
@mythrocks
Copy link
Contributor Author

mythrocks commented Jan 26, 2022

One more follow-up remains: To use auto judiciously to reduce code verbosity, mainly for the results of explicit casts. I'll fix the nullptr references there as well.

@mythrocks
Copy link
Contributor Author

Resolved merge conflicts. This will be checked in after the CI completes.

@mythrocks
Copy link
Contributor Author

Rerun tests

@mythrocks
Copy link
Contributor Author

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 7c69dae into rapidsai:branch-22.04 Jan 27, 2022
@mythrocks mythrocks deleted the jni-followup-table-jni branch January 27, 2022 23:08
@mythrocks
Copy link
Contributor Author

This has now been merged. Thanks for the reviews, @jlowe.

I'll have to delay the remaining follow up till next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement / enhancement to an existing function Java Affects Java cuDF API. non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants