stevenzwu commented on code in PR #19645:
URL: https://github.com/apache/flink/pull/19645#discussion_r865463606


##########
flink-formats/flink-avro/src/test/java/org/apache/flink/formats/avro/utils/AvroTestUtils.java:
##########
@@ -259,6 +265,51 @@ public static Tuple3<GenericRecord, Row, Schema> 
getGenericTestData() {
         return t;
     }
 
+    /**
+     * Craft a large Avro Schema which contains more than 0xFFFF characters.
+     *
+     * <p>0xFFFF is the magical number that once a java string length is above 
it, then the
+     * serialization scheme changes
+     */
+    public static Schema getLargeSchema() {
+        SchemaBuilder.FieldAssembler<Schema> fields =
+                SchemaBuilder.record("LargeAvroSchema")
+                        
.namespace(AvroSerializerLargeGenericRecordTest.class.getName())
+                        .fields();
+        int fieldIndex = 0;
+        List<
+                        BiFunction<
+                                SchemaBuilder.FieldAssembler<Schema>,
+                                String,
+                                SchemaBuilder.FieldAssembler<Schema>>>
+                fieldsToAssemble =
+                        ImmutableList.of(
+                                SchemaBuilder.FieldAssembler::optionalInt,
+                                SchemaBuilder.FieldAssembler::optionalString,
+                                SchemaBuilder.FieldAssembler::optionalDouble,
+                                SchemaBuilder.FieldAssembler::optionalLong,
+                                SchemaBuilder.FieldAssembler::optionalBytes);
+        while (fieldIndex < 10000) {

Review Comment:
   nit: a for loop is a little simpler



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to