alexeykudinkin commented on code in PR #5629:
URL: https://github.com/apache/hudi/pull/5629#discussion_r943808765
##########
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:
> One thing needs to be added, in addition to HoodieKey, getKeyWithParams
func also converts avro data to HoodieRecordPayload.
That's exactly what i'm referring to: this method is very cryptic with an
unclear contract and expectation what is being done by it in the end.
> I think the HoodieRecord returned by FileReader should be the original
data in file rather than the processed data. Because the callers of FileReader
need to process the HoodieRecord differently or not need to process it. We do
not need to converge the process logic to FileReader.
Can you please elaborate what you're referring to as "processed data"? I'm
still a little bit unclear what this "processing" means.
--
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]