jonvex commented on code in PR #11943:
URL: https://github.com/apache/hudi/pull/11943#discussion_r1803275406
##########
hudi-common/src/main/java/org/apache/hudi/common/table/log/block/HoodieAvroDataBlock.java:
##########
@@ -105,6 +106,8 @@ protected byte[] serializeRecords(List<HoodieRecord>
records, HoodieStorage stor
Schema schema = new
Schema.Parser().parse(super.getLogBlockHeader().get(HeaderMetadataType.SCHEMA));
GenericDatumWriter<IndexedRecord> writer = new
GenericDatumWriter<>(schema);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ Function<HoodieRecord<?>, IndexedRecord> recordConverter =
HoodieIOFactory.getIOFactory(storage)
+ .toIndexedRecord(schema, new Properties(),
records.get(0).getRecordType());
Review Comment:
did that: https://github.com/apache/hudi/pull/12115
##########
hudi-common/src/main/java/org/apache/hudi/common/table/log/block/HoodieAvroDataBlock.java:
##########
@@ -143,10 +146,9 @@ protected byte[] serializeRecords(List<HoodieRecord>
records, HoodieStorage stor
@Override
protected <T> ClosableIterator<HoodieRecord<T>> deserializeRecords(byte[]
content, HoodieRecordType type) throws IOException {
checkState(this.readerSchema != null, "Reader's schema has to be
non-null");
- checkArgument(type != HoodieRecordType.SPARK, "Not support read avro to
spark record");
- // TODO AvroSparkReader need
RecordIterator iterator = RecordIterator.getInstance(this, content);
- return new CloseableMappingIterator<>(iterator, data -> (HoodieRecord<T>)
new HoodieAvroIndexedRecord(data));
+ Function<IndexedRecord, HoodieRecord<?>> recordConverter =
HoodieIOFactory.getIOFactory(getBlockContentLocation().get().getStorage()).fromIndexedRecord(type);
+ return new CloseableMappingIterator<>(iterator, data -> (HoodieRecord<T>)
recordConverter.apply(data));
Review Comment:
same: https://github.com/apache/hudi/pull/12115
--
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]