NVIDIA / NVIDIA/cudf

[BUG] Java: narrowing Table.writeParquetChunked to ParquetTableWriter breaks binary compatibility and downstream test mocks

Open
#23,972 1 comment 0 reactions 0 assignees View on GitHub
? - Needs Triage bug
Dominant language
C++
Stars
9.8k
Forks
1.1k
Avg merge
3d 6m
Merged PRs (30d)
278

Description

**Describe the bug**

[#23912](https://github.com/NVIDIA/cudf/pull/23912) narrowed the return type of all three public static `Table.writeParquetChunked` overloads from `TableWriter` to the newly public `ParquetTableWriter`. This was raised as a P1 during review and merged without a reply, and it has since broken a downstream consumer. I am filing this so the compatibility question is tracked somewhere other than a closed PR thread.

`res-life` [wrote](https://github.com/NVIDIA/cudf/pull/23912#discussion_r3910523834) on `java/src/main/java/ai/rapids/cudf/Table.java`, under the heading "[P1] Preserve binary compatibility for the existing factories":

> Changing the return type of these public static methods from `TableWriter` to `ParquetTableWriter` changes their JVM method descriptors. Existing applications compiled against the current API will still request a descriptor returning `TableWriter`, so upgrading the jar will make all three `writeParquetChunked` overloads fail with `NoSuchMethodError`; `javap -s` also shows that no compatibility bridge is emitted for these static methods. Please keep the existing factory signatures returning `TableWriter` and add a differently named factory that returns `ParquetTableWriter` for callers that need `closeAndGetFooter()`.

**Two distinct consequences**

The `NoSuchMethodError` above hits any consumer that upgrades the cuDF jar without recompiling, since the return type is part of the JVM method descriptor and the compiler emits no bridge method for static methods.

Separately, and already observed, consumers that *do* recompile can still break at the source level wherever the declared return type is reflected on. The `NVIDIA/cudf-spark` plugin installs a Mockito static mock on `Table` whose default answer returns a `TableWriter` mock; Mockito validates the returned instance against the invoked method's declared return type, so every call now throws. This has had the plugin's premerge red for all PRs since 2026-09-03 07:14 UTC:

```
org.mockito.exceptions.misusing.WrongTypeOfReturnValue: Default answer returned a result with the wrong type:
TableWriter$MockitoMock$438629446 cannot be returned by writeParquetChunked()
writeParquetChunked() should return ParquetTableWriter
at ai.rapids.cudf.Table.writeParquetChunked(Table.java:1614)
```

Contributor guide

Open the contributing guide

Research direction

Start in java/src/main/java/ai/rapids/cudf/Table.java and inspect the three public static writeParquetChunked overloads alongside the change from PR #23912. Reproduce the downstream NVIDIA/cudf-spark Mockito failure and verify that existing JVM descriptors and the mock's TableWriter return remain compatible, while callers needing closeAndGetFooter() still have a supported entry point.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.