Skip to content

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

Description

@amahussein

Describe the bug

#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 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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions