alexeykudinkin commented on code in PR #5629:
URL: https://github.com/apache/hudi/pull/5629#discussion_r938253077
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/common/table/log/HoodieFileSliceReader.java:
##########
@@ -20,62 +20,33 @@
package org.apache.hudi.common.table.log;
import org.apache.hudi.common.model.HoodieRecord;
-import org.apache.hudi.common.model.HoodieRecordPayload;
import org.apache.hudi.common.util.Option;
-import org.apache.hudi.common.util.SpillableMapUtils;
import org.apache.hudi.common.util.collection.Pair;
-import org.apache.hudi.config.HoodiePayloadConfig;
-import org.apache.hudi.exception.HoodieIOException;
import org.apache.hudi.io.storage.HoodieFileReader;
import org.apache.avro.Schema;
-import org.apache.avro.generic.GenericRecord;
import java.io.IOException;
import java.util.Iterator;
-import java.util.stream.StreamSupport;
+import java.util.Properties;
/**
* Reads records from base file and merges any updates from log files and
provides iterable over all records in the file slice.
*/
-public class HoodieFileSliceReader<T extends HoodieRecordPayload> implements
Iterator<HoodieRecord<T>> {
+public class HoodieFileSliceReader<T> implements Iterator<HoodieRecord<T>> {
+
private final Iterator<HoodieRecord<T>> recordsIterator;
public static HoodieFileSliceReader getFileSliceReader(
- Option<HoodieFileReader> baseFileReader, HoodieMergedLogRecordScanner
scanner, Schema schema, String payloadClass,
- String preCombineField, Option<Pair<String, String>>
simpleKeyGenFieldsOpt) throws IOException {
+ Option<HoodieFileReader> baseFileReader, HoodieMergedLogRecordScanner
scanner, Schema schema, Properties props, Option<Pair<String, String>>
simpleKeyGenFieldsOpt) throws IOException {
if (baseFileReader.isPresent()) {
- Iterator baseIterator = baseFileReader.get().getRecordIterator(schema);
+ Iterator<HoodieRecord> baseIterator =
baseFileReader.get().getRecordIterator(schema);
while (baseIterator.hasNext()) {
- GenericRecord record = (GenericRecord) baseIterator.next();
- HoodieRecord<? extends HoodieRecordPayload> hoodieRecord = transform(
- record, scanner, payloadClass, preCombineField,
simpleKeyGenFieldsOpt);
- scanner.processNextRecord(hoodieRecord);
+ scanner.processNextRecord(baseIterator.next().getKeyWithParams(schema,
props,
Review Comment:
Suggested transition doesn't make sense:
1. Previously, file-reader was producing `GenericRecord`s hence we had
`transform` method that was wrapping them into `HoodieRecord`
2. Now, we have file-reader instance that produces `HoodieRecord`, and so
calling the method `getKeyWithParams` that returns another `HoodieRecord`
doesn't really make sense.
Can you please explain why do we need it and why can't we return proper
record from the file-reader in the first place?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]