diff --git a/flink-formats/flink-avro/pom.xml b/flink-formats/flink-avro/pom.xml index 262d5c03cf823..831a0aac2e3da 100644 --- a/flink-formats/flink-avro/pom.xml +++ b/flink-formats/flink-avro/pom.xml @@ -257,6 +257,7 @@ under the License. ${project.basedir}/src/test/resources/avro ${project.basedir}/target/generated-test-sources/ + true diff --git a/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/AvroOutputFormatITCase.java b/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/AvroOutputFormatITCase.java index 1347366cf8551..9c10cf6ede20e 100644 --- a/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/AvroOutputFormatITCase.java +++ b/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/AvroOutputFormatITCase.java @@ -25,7 +25,6 @@ import org.apache.flink.core.fs.Path; import org.apache.flink.formats.avro.AvroOutputFormat.Codec; import org.apache.flink.formats.avro.generated.Colors; -import org.apache.flink.formats.avro.generated.Fixed2; import org.apache.flink.formats.avro.generated.User; import org.apache.flink.streaming.api.datastream.DataStream; import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; @@ -186,11 +185,9 @@ public User map(Tuple3 value) { user.setTypeTimestampMillis(Instant.parse("2014-03-01T12:12:12.321Z")); user.setTypeTimestampMicros(Instant.ofEpochSecond(0).plus(123456L, ChronoUnit.MICROS)); // 20.00 - user.setTypeDecimalBytes( - ByteBuffer.wrap(BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray())); + user.setTypeDecimalBytes(BigDecimal.valueOf(2000, 2)); // 20.00 - user.setTypeDecimalFixed( - new Fixed2(BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray())); + user.setTypeDecimalFixed(BigDecimal.valueOf(2000, 2)); return user; } } diff --git a/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/AvroOutputFormatTest.java b/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/AvroOutputFormatTest.java index 92f43ac7d6562..542cedeca72ab 100644 --- a/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/AvroOutputFormatTest.java +++ b/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/AvroOutputFormatTest.java @@ -23,7 +23,6 @@ import org.apache.flink.core.fs.FileSystem; import org.apache.flink.core.fs.Path; import org.apache.flink.formats.avro.generated.Colors; -import org.apache.flink.formats.avro.generated.Fixed2; import org.apache.flink.formats.avro.generated.User; import org.apache.flink.mock.Whitebox; @@ -200,11 +199,9 @@ public int getAttemptNumber() { user.setTypeTimestampMicros(Instant.ofEpochSecond(0).plus(123456L, ChronoUnit.MICROS)); // 20.00 - user.setTypeDecimalBytes( - ByteBuffer.wrap(BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray())); + user.setTypeDecimalBytes(BigDecimal.valueOf(2000, 2)); // 20.00 - user.setTypeDecimalFixed( - new Fixed2(BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray())); + user.setTypeDecimalFixed(BigDecimal.valueOf(2000, 2)); outputFormat.writeRecord(user); } diff --git a/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/AvroRecordInputFormatTest.java b/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/AvroRecordInputFormatTest.java index a3e2e6c0914d3..c2d2dfdf05d86 100644 --- a/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/AvroRecordInputFormatTest.java +++ b/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/AvroRecordInputFormatTest.java @@ -31,7 +31,6 @@ import org.apache.flink.core.memory.DataOutputViewStreamWrapper; import org.apache.flink.formats.avro.generated.Address; import org.apache.flink.formats.avro.generated.Colors; -import org.apache.flink.formats.avro.generated.Fixed2; import org.apache.flink.formats.avro.generated.User; import org.apache.flink.formats.avro.typeutils.AvroTypeInfo; import org.apache.flink.formats.avro.utils.AvroKryoSerializerUtils; @@ -140,11 +139,9 @@ public static void writeTestFile(File testFile) throws IOException { user1.setTypeTimestampMillis(Instant.parse("2014-03-01T12:12:12.321Z")); user1.setTypeTimestampMicros(Instant.ofEpochSecond(0).plus(123456L, ChronoUnit.MICROS)); // 20.00 - user1.setTypeDecimalBytes( - ByteBuffer.wrap(BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray())); + user1.setTypeDecimalBytes(BigDecimal.valueOf(2000, 2)); // 20.00 - user1.setTypeDecimalFixed( - new Fixed2(BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray())); + user1.setTypeDecimalFixed(BigDecimal.valueOf(2000, 2)); // Construct via builder User user2 = @@ -180,13 +177,9 @@ public static void writeTestFile(File testFile) throws IOException { .setTypeTimestampMicros( Instant.ofEpochSecond(0).plus(123456L, ChronoUnit.MICROS)) // 20.00 - .setTypeDecimalBytes( - ByteBuffer.wrap( - BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray())) + .setTypeDecimalBytes(BigDecimal.valueOf(2000, 2)) // 20.00 - .setTypeDecimalFixed( - new Fixed2( - BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray())) + .setTypeDecimalFixed(BigDecimal.valueOf(2000, 2)) .build(); DatumWriter userDatumWriter = new SpecificDatumWriter<>(User.class); DataFileWriter dataFileWriter = new DataFileWriter<>(userDatumWriter); diff --git a/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/AvroSplittableInputFormatTest.java b/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/AvroSplittableInputFormatTest.java index f6fe06342c2bb..903a50b8509f7 100644 --- a/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/AvroSplittableInputFormatTest.java +++ b/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/AvroSplittableInputFormatTest.java @@ -25,7 +25,6 @@ import org.apache.flink.formats.avro.generated.Address; import org.apache.flink.formats.avro.generated.Colors; import org.apache.flink.formats.avro.generated.Fixed16; -import org.apache.flink.formats.avro.generated.Fixed2; import org.apache.flink.formats.avro.generated.User; import org.apache.avro.file.DataFileWriter; @@ -120,11 +119,9 @@ void createFiles(@TempDir java.nio.file.Path tempDir) throws IOException { user1.setTypeTimestampMillis(Instant.parse("2014-03-01T12:12:12.321Z")); user1.setTypeTimestampMicros(Instant.ofEpochSecond(0).plus(123456L, ChronoUnit.MICROS)); // 20.00 - user1.setTypeDecimalBytes( - ByteBuffer.wrap(BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray())); + user1.setTypeDecimalBytes(BigDecimal.valueOf(2000, 2)); // 20.00 - user1.setTypeDecimalFixed( - new Fixed2(BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray())); + user1.setTypeDecimalFixed(BigDecimal.valueOf(2000, 2)); // Construct via builder User user2 = @@ -160,13 +157,9 @@ void createFiles(@TempDir java.nio.file.Path tempDir) throws IOException { .setTypeTimestampMicros( Instant.ofEpochSecond(0).plus(123456L, ChronoUnit.MICROS)) // 20.00 - .setTypeDecimalBytes( - ByteBuffer.wrap( - BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray())) + .setTypeDecimalBytes(BigDecimal.valueOf(2000, 2)) // 20.00 - .setTypeDecimalFixed( - new Fixed2( - BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray())) + .setTypeDecimalFixed(BigDecimal.valueOf(2000, 2)) .build(); DatumWriter userDatumWriter = new SpecificDatumWriter<>(User.class); DataFileWriter dataFileWriter = new DataFileWriter<>(userDatumWriter); @@ -199,11 +192,9 @@ void createFiles(@TempDir java.nio.file.Path tempDir) throws IOException { user.setTypeTimestampMillis(Instant.parse("2014-03-01T12:12:12.321Z")); user.setTypeTimestampMicros(Instant.ofEpochSecond(0).plus(123456L, ChronoUnit.MICROS)); // 20.00 - user.setTypeDecimalBytes( - ByteBuffer.wrap(BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray())); + user.setTypeDecimalBytes(BigDecimal.valueOf(2000, 2)); // 20.00 - user.setTypeDecimalFixed( - new Fixed2(BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray())); + user.setTypeDecimalFixed(BigDecimal.valueOf(2000, 2)); dataFileWriter.append(user); } diff --git a/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/EncoderDecoderTest.java b/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/EncoderDecoderTest.java index 65b470f0b5fd8..211178088fff0 100644 --- a/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/EncoderDecoderTest.java +++ b/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/EncoderDecoderTest.java @@ -299,8 +299,7 @@ void testGeneratedObjectWithNullableFields() { LocalTime.ofSecondOfDay(0).plus(123456L, ChronoUnit.MICROS), Instant.parse("2014-03-01T12:12:12.321Z"), Instant.ofEpochSecond(0).plus(123456L, ChronoUnit.MICROS), - ByteBuffer.wrap( - BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray()), // 20.00 + BigDecimal.valueOf(2000, 2), // 20.00 new Fixed2( BigDecimal.valueOf(2000, 2) .unscaledValue() diff --git a/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/utils/AvroTestUtils.java b/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/utils/AvroTestUtils.java index b4e12f8ca10ee..b184180d79f0a 100644 --- a/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/utils/AvroTestUtils.java +++ b/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/utils/AvroTestUtils.java @@ -24,7 +24,6 @@ import org.apache.flink.formats.avro.generated.Address; import org.apache.flink.formats.avro.generated.Colors; import org.apache.flink.formats.avro.generated.Fixed16; -import org.apache.flink.formats.avro.generated.Fixed2; import org.apache.flink.formats.avro.generated.Timestamps; import org.apache.flink.formats.avro.generated.User; import org.apache.flink.formats.avro.typeutils.AvroSerializerLargeGenericRecordTest; @@ -109,15 +108,8 @@ public final class AvroTestUtils { Instant.ofEpochSecond(0).plus(123456L, ChronoUnit.MICROS)) // byte array must contain the two's-complement representation of the // unscaled integer value in big-endian byte order - .setTypeDecimalBytes( - ByteBuffer.wrap( - BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray())) - // array of length n can store at most - // Math.floor(Math.log10(Math.pow(2, 8 * n - 1) - 1)) - // base-10 digits of precision - .setTypeDecimalFixed( - new Fixed2( - BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray())) + .setTypeDecimalBytes(BigDecimal.valueOf(2000, 2)) + .setTypeDecimalFixed(BigDecimal.valueOf(2000, 2)) .build(); final Row rowUser = new Row(23); diff --git a/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/utils/TestDataGenerator.java b/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/utils/TestDataGenerator.java index 13686bb2b5f23..056dd0dfd1801 100644 --- a/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/utils/TestDataGenerator.java +++ b/flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/utils/TestDataGenerator.java @@ -62,7 +62,7 @@ public static User generateRandomUser(Random rnd) { LocalTime.ofSecondOfDay(0).plus(123456L, ChronoUnit.MICROS), Instant.parse("2014-03-01T12:12:12.321Z"), Instant.ofEpochSecond(0).plus(123456L, ChronoUnit.MICROS), - ByteBuffer.wrap(BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray()), + BigDecimal.valueOf(2000, 2), new Fixed2(BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray())); } diff --git a/flink-formats/flink-avro/src/test/java/org/apache/flink/table/runtime/batch/AvroTypesITCase.java b/flink-formats/flink-avro/src/test/java/org/apache/flink/table/runtime/batch/AvroTypesITCase.java index 3c97e2269804c..a64f3f1df9f71 100644 --- a/flink-formats/flink-avro/src/test/java/org/apache/flink/table/runtime/batch/AvroTypesITCase.java +++ b/flink-formats/flink-avro/src/test/java/org/apache/flink/table/runtime/batch/AvroTypesITCase.java @@ -84,11 +84,8 @@ class AvroTypesITCase extends AbstractTestBase { .setTypeTimestampMillis(Instant.parse("2014-03-01T12:12:12.321Z")) .setTypeTimestampMicros( Instant.ofEpochSecond(0).plus(123456L, ChronoUnit.MICROS)) - .setTypeDecimalBytes( - ByteBuffer.wrap( - BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray())) - .setTypeDecimalFixed( - new Fixed2(BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray())) + .setTypeDecimalBytes(BigDecimal.valueOf(2000, 2)) + .setTypeDecimalFixed(BigDecimal.valueOf(2000, 2)) .build(); private static final User USER_2 = @@ -114,11 +111,8 @@ class AvroTypesITCase extends AbstractTestBase { .setTypeTimestampMillis(Instant.parse("2014-03-01T12:12:12.321Z")) .setTypeTimestampMicros( Instant.ofEpochSecond(0).plus(123456L, ChronoUnit.MICROS)) - .setTypeDecimalBytes( - ByteBuffer.wrap( - BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray())) - .setTypeDecimalFixed( - new Fixed2(BigDecimal.valueOf(2000, 2).unscaledValue().toByteArray())) + .setTypeDecimalBytes(BigDecimal.valueOf(2000, 2)) + .setTypeDecimalFixed(BigDecimal.valueOf(2000, 2)) .build(); private static final User USER_3 = diff --git a/flink-formats/flink-sql-avro-confluent-registry/src/main/resources/META-INF/NOTICE b/flink-formats/flink-sql-avro-confluent-registry/src/main/resources/META-INF/NOTICE index 9922d753a9e5d..5c816a2f21a2a 100644 --- a/flink-formats/flink-sql-avro-confluent-registry/src/main/resources/META-INF/NOTICE +++ b/flink-formats/flink-sql-avro-confluent-registry/src/main/resources/META-INF/NOTICE @@ -13,7 +13,7 @@ This project bundles the following dependencies under the Apache Software Licens - commons-io:commons-io:2.15.1 - io.confluent:common-utils:7.5.3 - io.confluent:kafka-schema-registry-client:7.5.3 -- org.apache.avro:avro:1.11.4 +- org.apache.avro:avro:1.12.1 - org.apache.commons:commons-compress:1.26.0 - org.apache.commons:commons-lang3:3.18.0 - org.apache.kafka:kafka-clients:7.5.3-ccs diff --git a/flink-formats/flink-sql-avro/src/main/resources/META-INF/NOTICE b/flink-formats/flink-sql-avro/src/main/resources/META-INF/NOTICE index 0456a35a6718a..ac7c1306e6f13 100644 --- a/flink-formats/flink-sql-avro/src/main/resources/META-INF/NOTICE +++ b/flink-formats/flink-sql-avro/src/main/resources/META-INF/NOTICE @@ -6,7 +6,7 @@ The Apache Software Foundation (http://www.apache.org/). This project bundles the following dependencies under the Apache Software License 2.0. (http://www.apache.org/licenses/LICENSE-2.0.txt) -- org.apache.avro:avro:1.11.4 +- org.apache.avro:avro:1.12.1 - com.fasterxml.jackson.core:jackson-core:2.20.1 - com.fasterxml.jackson.core:jackson-databind:2.20.1 - com.fasterxml.jackson.core:jackson-annotations:2.20 diff --git a/pom.xml b/pom.xml index df109cffb5f5c..a783e7310b9de 100644 --- a/pom.xml +++ b/pom.xml @@ -148,7 +148,7 @@ under the License. 5.4.0 - 1.11.4 + 1.12.1 1.9.14.jdk17-redhat-00001 2.20.1