satishkotha commented on a change in pull request #1396: [HUDI-687] Stop incremental reader on RO table before a pending compaction URL: https://github.com/apache/incubator-hudi/pull/1396#discussion_r395386191
########## File path: hudi-client/src/test/java/org/apache/hudi/common/HoodieMergeOnReadTestUtils.java ########## @@ -47,27 +48,35 @@ public static List<GenericRecord> getRecordsUsingInputFormat(List<String> inputPaths, String basePath) { JobConf jobConf = new JobConf(); + return getRecordsUsingInputFormat(inputPaths, basePath, jobConf, new HoodieParquetRealtimeInputFormat()); + } + + public static List<GenericRecord> getRecordsUsingInputFormat(List<String> inputPaths, + String basePath, + JobConf jobConf, + HoodieParquetInputFormat inputFormat) { Schema schema = HoodieAvroUtils.addMetadataFields( new Schema.Parser().parse(HoodieTestDataGenerator.TRIP_EXAMPLE_SCHEMA)); - HoodieParquetRealtimeInputFormat inputFormat = new HoodieParquetRealtimeInputFormat(); setPropsForInputFormat(inputFormat, jobConf, schema, basePath); return inputPaths.stream().map(path -> { setInputPath(jobConf, path); List<GenericRecord> records = new ArrayList<>(); try { List<InputSplit> splits = Arrays.asList(inputFormat.getSplits(jobConf, 1)); - RecordReader recordReader = inputFormat.getRecordReader(splits.get(0), jobConf, null); - Void key = (Void) recordReader.createKey(); - ArrayWritable writable = (ArrayWritable) recordReader.createValue(); - while (recordReader.next(key, writable)) { - GenericRecordBuilder newRecord = new GenericRecordBuilder(schema); - // writable returns an array with [field1, field2, _hoodie_commit_time, - // _hoodie_commit_seqno] - Writable[] values = writable.get(); - schema.getFields().forEach(field -> { - newRecord.set(field, values[2]); - }); - records.add(newRecord.build()); + for (InputSplit split : splits) { Review comment: yes, correct. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services