This is an automated email from the ASF dual-hosted git repository.
opwvhk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/main by this push:
new 00a07745f9 Fix build after AVRO-3230
00a07745f9 is described below
commit 00a07745f9f419f9fc0ffd05dd88e1cffc4935ed
Author: Oscar Westra van Holthe - Kind <[email protected]>
AuthorDate: Fri May 30 12:23:53 2025 +0200
Fix build after AVRO-3230
This explicitly enables and disables fastreader to ensure both are
tested.
---
.../org/apache/avro/TestReadingWritingDataInEvolvedSchemas.java | 4 +++-
.../java/org/apache/avro/TestSchemaCompatibilityEnumDefaults.java | 7 +++++--
lang/java/avro/src/test/java/org/apache/avro/TestUnionError.java | 5 ++++-
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git
a/lang/java/avro/src/test/java/org/apache/avro/TestReadingWritingDataInEvolvedSchemas.java
b/lang/java/avro/src/test/java/org/apache/avro/TestReadingWritingDataInEvolvedSchemas.java
index 89fedc75ca..2b392eb4ef 100644
---
a/lang/java/avro/src/test/java/org/apache/avro/TestReadingWritingDataInEvolvedSchemas.java
+++
b/lang/java/avro/src/test/java/org/apache/avro/TestReadingWritingDataInEvolvedSchemas.java
@@ -438,7 +438,9 @@ public class TestReadingWritingDataInEvolvedSchemas {
if (blob == null) {
return null;
}
- GenericDatumReader<Record> reader = new GenericDatumReader<>();
+ GenericData data = new GenericData();
+ data.setFastReaderEnabled(true);
+ GenericDatumReader<Record> reader = new GenericDatumReader<>(null, null,
data);
reader.setExpected(expectedSchema);
reader.setSchema(schemaOfBlob);
Decoder decoder = encoderType == EncoderType.BINARY ?
DecoderFactory.get().binaryDecoder(blob, null)
diff --git
a/lang/java/avro/src/test/java/org/apache/avro/TestSchemaCompatibilityEnumDefaults.java
b/lang/java/avro/src/test/java/org/apache/avro/TestSchemaCompatibilityEnumDefaults.java
index 82ec27d01b..44d468c7de 100644
---
a/lang/java/avro/src/test/java/org/apache/avro/TestSchemaCompatibilityEnumDefaults.java
+++
b/lang/java/avro/src/test/java/org/apache/avro/TestSchemaCompatibilityEnumDefaults.java
@@ -27,6 +27,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.ByteArrayOutputStream;
+import java.util.concurrent.Callable;
+
import org.apache.avro.generic.GenericData;
import org.apache.avro.generic.GenericDatumReader;
import org.apache.avro.generic.GenericDatumWriter;
@@ -127,8 +129,9 @@ public class TestSchemaCompatibilityEnumDefaults {
byte[] bytes = baos.toByteArray();
Decoder decoder = DecoderFactory.get().resolvingDecoder(writerSchema,
readerSchema,
DecoderFactory.get().binaryDecoder(bytes, null));
- DatumReader<Object> datumReader = new GenericDatumReader<>(readerSchema);
+ GenericData data = new GenericData();
+ data.setFastReaderEnabled(false);
+ DatumReader<Object> datumReader = new GenericDatumReader<>(readerSchema,
readerSchema, data);
return (GenericRecord) datumReader.read(null, decoder);
}
-
}
diff --git a/lang/java/avro/src/test/java/org/apache/avro/TestUnionError.java
b/lang/java/avro/src/test/java/org/apache/avro/TestUnionError.java
index 9d398d635f..63576f2151 100644
--- a/lang/java/avro/src/test/java/org/apache/avro/TestUnionError.java
+++ b/lang/java/avro/src/test/java/org/apache/avro/TestUnionError.java
@@ -23,6 +23,7 @@ import org.apache.avro.generic.GenericDatumWriter;
import org.apache.avro.generic.GenericRecord;
import org.apache.avro.io.BinaryDecoder;
import org.apache.avro.io.BinaryEncoder;
+import org.apache.avro.io.DatumReader;
import org.apache.avro.io.DecoderFactory;
import org.apache.avro.io.EncoderFactory;
@@ -77,7 +78,9 @@ public class TestUnionError {
InputStream ins = new ByteArrayInputStream(outs.toByteArray());
BinaryDecoder decoder = DecoderFactory.get().binaryDecoder(ins, null);
- GenericDatumReader<GenericRecord> datumReader = new
GenericDatumReader<>(writerSchema, readerSchema);
+ GenericData data = new GenericData();
+ data.setFastReaderEnabled(false);
+ GenericDatumReader<GenericRecord> datumReader = new
GenericDatumReader<>(writerSchema, readerSchema, data);
AvroTypeException avroException = assertThrows(AvroTypeException.class, ()
-> datumReader.read(null, decoder));
assertEquals("Field \"c\" content mismatch: Found B, expecting union[A,
float]", avroException.getMessage());
}