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

[Java] ArrowIPCTableWriter writes en empty batch in the case of an empty table. #11883

Merged
merged 1 commit into from
Oct 11, 2022

Conversation

firestarman
Copy link
Contributor

@firestarman firestarman commented Oct 8, 2022

closes #11882

Updated the ArrowIPCTableWriter to write en empty batch explicitly in the case of an empty table, because the Arrow IPC writer will write no batches out for this case, leading to an error as below when calling the Pyarrow.Table.from_batches without specifying a schema.

E                     File "pyarrow/table.pxi", line 1609, in pyarrow.lib.Table.from_batches
E                   ValueError: Must pass schema, or at least one RecordBatch

Signed-off-by: Liangcai Li [email protected]

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@firestarman firestarman requested a review from a team as a code owner October 8, 2022 10:08
@github-actions github-actions bot added the Java Affects Java cuDF API. label Oct 8, 2022
@firestarman firestarman added feature request New feature or request non-breaking Non-breaking change labels Oct 8, 2022
@codecov
Copy link

codecov bot commented Oct 8, 2022

Codecov Report

Base: 87.40% // Head: 87.48% // Increases project coverage by +0.07% 🎉

Coverage data is based on head (6997528) compared to base (f72c4ce).
Patch coverage: 84.03% of modified lines in pull request are covered.

Additional details and impacted files
@@               Coverage Diff                @@
##           branch-22.12   #11883      +/-   ##
================================================
+ Coverage         87.40%   87.48%   +0.07%     
================================================
  Files               133      133              
  Lines             21833    21866      +33     
================================================
+ Hits              19084    19129      +45     
+ Misses             2749     2737      -12     
Impacted Files Coverage Δ
python/cudf/cudf/core/udf/__init__.py 50.00% <ø> (ø)
python/cudf/cudf/utils/ioutils.py 79.47% <ø> (ø)
...thon/dask_cudf/dask_cudf/tests/test_distributed.py 18.86% <ø> (+4.94%) ⬆️
python/cudf/cudf/core/_base_index.py 82.20% <43.75%> (-3.35%) ⬇️
python/cudf/cudf/io/text.py 91.66% <66.66%> (-8.34%) ⬇️
python/strings_udf/strings_udf/__init__.py 86.27% <76.00%> (-10.61%) ⬇️
python/cudf/cudf/core/index.py 92.91% <95.08%> (+0.27%) ⬆️
python/cudf/cudf/__init__.py 90.69% <100.00%> (ø)
python/cudf/cudf/core/column/categorical.py 89.34% <100.00%> (ø)
python/cudf/cudf/core/scalar.py 90.52% <100.00%> (+1.25%) ⬆️
... and 7 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Comment on lines +7951 to +7957
boolean done = false;
int count = 0;
while (!done) {
try (Table t = reader.getNextIfAvailable()) {
if (t == null) {
done = true;
} else {
Copy link
Contributor

@ttnghia ttnghia Oct 8, 2022

Choose a reason for hiding this comment

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

Nit: We can do this:

Suggested change
boolean done = false;
int count = 0;
while (!done) {
try (Table t = reader.getNextIfAvailable()) {
if (t == null) {
done = true;
} else {
int count = 0;
while (true) {
try (Table t = reader.getNextIfAvailable()) {
if (t == null) {
break;
} else {

@firestarman
Copy link
Contributor Author

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 26f3e76 into rapidsai:branch-22.12 Oct 11, 2022
@firestarman firestarman deleted the empty-arrow-ipc branch October 11, 2022 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request Java Affects Java cuDF API. non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEA][Java] ArrowIPCTableWriter writes en empty batch in the case of an empty table.
2 participants