chenjunjiedada commented on a change in pull request #1266:
URL: https://github.com/apache/iceberg/pull/1266#discussion_r465086661



##########
File path: flink/src/test/java/org/apache/iceberg/flink/data/RandomData.java
##########
@@ -88,20 +93,46 @@ public Row next() {
     };
   }
 
+  private static Iterable<Record> generateIcebergGenerics(Schema schema, int 
numRecords,
+                                                   
Supplier<RandomGenericData.RandomDataGenerator<Record>> supplier) {
+    return () -> new Iterator<Record>() {
+      private final RandomGenericData.RandomDataGenerator<Record> generator = 
supplier.get();
+      private int count = 0;
+
+      @Override
+      public boolean hasNext() {
+        return count < numRecords;
+      }
+
+      @Override
+      public Record next() {
+        if (!hasNext()) {
+          throw new NoSuchElementException();
+        }
+        ++count;
+        return (Record) TypeUtil.visit(schema, generator);
+      }
+    };
+  }
+
+
+  public static Iterable<Record> generateRecords(Schema schema, int 
numRecords, long seed) {
+    return RandomGenericData.generate(schema, numRecords, seed);
+  }
+
   public static Iterable<Row> generate(Schema schema, int numRecords, long 
seed) {
     return generateData(schema, numRecords, () -> new 
RandomRowGenerator(seed));
   }
 
-  public static Iterable<Row> generateFallbackData(Schema schema, int 
numRecords, long seed, long numDictRows) {
-    return generateData(schema, numRecords, () -> new FallbackGenerator(seed, 
numDictRows));
+  public static Iterable<Record> generateFallbackRecords(Schema schema, int 
numRecords, long seed, long numDictRows) {
+    return generateIcebergGenerics(schema, numRecords, () -> new 
FallbackGenerator(seed, numDictRows));
   }
 
-  public static Iterable<Row> generateDictionaryEncodableData(Schema schema, 
int numRecords, long seed) {
-    return generateData(schema, numRecords, () -> new 
DictionaryEncodedGenerator(seed));
+  public static Iterable<Record> generateDictionaryEncodableRecords(Schema 
schema, int numRecords, long seed) {

Review comment:
       Done.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to