Skip to content

AVRO-4322: [Java] Guard fast-reader-only assertions in FastReaderBuilderJavaClassTest - #3923

Closed
iemejia wants to merge 1 commit into
apache:mainfrom
iemejia:AVRO-4322-fastread-test-guard
Closed

AVRO-4322: [Java] Guard fast-reader-only assertions in FastReaderBuilderJavaClassTest#3923
iemejia wants to merge 1 commit into
apache:mainfrom
iemejia:AVRO-4322-fastread-test-guard

Conversation

@iemejia

@iemejia iemejia commented Aug 6, 2026

Copy link
Copy Markdown
Member

Problem

FastReaderBuilderJavaClassTest contains three specificDataModelUses* tests that assert the java-class / java-key-class → target-class conversion (e.g. StringBigDecimal) for the SpecificData model.

That conversion is implemented only on the fast-reader path (FastReaderBuilder). When the fast reader is disabled (-Dorg.apache.avro.fastread=false), the classic path returns Utf8, so those three tests fail:

SpecificData should use the class in 'java-class' ==>
Unexpected type, expected: <java.math.BigDecimal> but was: <org.apache.avro.util.Utf8>

The avro module's test-without-fast-reader surefire execution (and the JDK-11/17/21 invoker runs) run with org.apache.avro.fastread=false, so this is a real failure. It is currently masked on CI by the Maven build cache skipping the unchanged avro module; it surfaces whenever that module is rebuilt.

Reproduce:

cd lang/java
mvn -pl avro surefire:test -Dtest=FastReaderBuilderJavaClassTest -Dorg.apache.avro.fastread=false
# -> Tests run: 6, Failures: 3

Fix

Guard the three fast-reader-only assertions with assumeTrue(SpecificData.get().isFastReaderEnabled(), ...), so they are skipped (not failed) when the fast reader is disabled. The genericDataModelIgnores* tests are unaffected.

Verification

# fast reader ON  -> Tests run: 6, Failures: 0, Skipped: 0
# fast reader OFF -> Tests run: 6, Failures: 0, Skipped: 3

Both BUILD SUCCESS.

…derJavaClassTest

The java-class / java-key-class -> target class conversion for SpecificData
is implemented only on the fast-reader path (FastReaderBuilder). The three
specificDataModelUses* tests assert this conversion unconditionally, so they
fail in the 'test-without-fast-reader' surefire execution (and the JDK
invoker runs) where org.apache.avro.fastread=false, returning Utf8 instead
of BigDecimal.

This latent failure is currently masked on CI by the Maven build cache
skipping the unchanged avro module; it surfaces whenever that module is
rebuilt. Skip those assertions via assumeTrue(isFastReaderEnabled()) when
the fast reader is disabled.
@github-actions github-actions Bot added the Java Pull Requests for Java binding label Aug 6, 2026
@iemejia
iemejia requested a review from RyanSkraba August 6, 2026 12:20
@RyanSkraba

Copy link
Copy Markdown
Contributor

I created #3924 to actually fix the test and run it with and without fastreader to make sure the behaviours are consistent!

@RyanSkraba RyanSkraba closed this Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Java Pull Requests for Java binding

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants