4848import org .apache .hudi .storage .HoodieStorage ;
4949import org .apache .hudi .storage .StoragePath ;
5050
51- import org .apache .avro .Schema ;
5251import org .slf4j .Logger ;
5352import org .slf4j .LoggerFactory ;
5453
@@ -628,13 +627,13 @@ private void processDataBlock(HoodieDataBlock dataBlock, Option<KeySpec> keySpec
628627 ? Option .empty ()
629628 : Option .of (Pair .of (recordKeyField , partitionPathFieldOpt .orElse (null )));
630629
631- Pair <ClosableIterator <HoodieRecord >, Schema > recordsIteratorSchemaPair =
630+ Pair <ClosableIterator <HoodieRecord >, HoodieSchema > recordsIteratorSchemaPair =
632631 getRecordsIterator (dataBlock , keySpecOpt );
633632
634633 try (ClosableIterator <HoodieRecord > recordIterator = recordsIteratorSchemaPair .getLeft ()) {
635634 while (recordIterator .hasNext ()) {
636635 HoodieRecord completedRecord = recordIterator .next ()
637- .wrapIntoHoodieRecordPayloadWithParams (HoodieSchema . fromAvroSchema ( recordsIteratorSchemaPair .getRight () ),
636+ .wrapIntoHoodieRecordPayloadWithParams (recordsIteratorSchemaPair .getRight (),
638637 hoodieTableMetaClient .getTableConfig ().getProps (),
639638 recordKeyPartitionPathFieldPair ,
640639 this .withOperationField ,
@@ -799,7 +798,7 @@ public List<String> getValidBlockInstants() {
799798 return validBlockInstants ;
800799 }
801800
802- private Pair <ClosableIterator <HoodieRecord >, Schema > getRecordsIterator (
801+ private Pair <ClosableIterator <HoodieRecord >, HoodieSchema > getRecordsIterator (
803802 HoodieDataBlock dataBlock , Option <KeySpec > keySpecOpt ) throws IOException {
804803 ClosableIterator <HoodieRecord > blockRecordsIterator ;
805804 if (keySpecOpt .isPresent ()) {
@@ -810,7 +809,7 @@ private Pair<ClosableIterator<HoodieRecord>, Schema> getRecordsIterator(
810809 blockRecordsIterator = (ClosableIterator ) dataBlock .getRecordIterator (recordType );
811810 }
812811
813- Option <Pair <Function <HoodieRecord , HoodieRecord >, Schema >> schemaEvolutionTransformerOpt =
812+ Option <Pair <Function <HoodieRecord , HoodieRecord >, HoodieSchema >> schemaEvolutionTransformerOpt =
814813 composeEvolvedSchemaTransformer (dataBlock );
815814
816815 // In case when schema has been evolved original persisted records will have to be
@@ -819,8 +818,8 @@ private Pair<ClosableIterator<HoodieRecord>, Schema> getRecordsIterator(
819818 schemaEvolutionTransformerOpt .map (Pair ::getLeft )
820819 .orElse (Function .identity ());
821820
822- Schema schema = schemaEvolutionTransformerOpt .map (Pair ::getRight )
823- .orElseGet (() -> dataBlock .getSchema (). toAvroSchema () );
821+ HoodieSchema schema = schemaEvolutionTransformerOpt .map (Pair ::getRight )
822+ .orElseGet (() -> dataBlock .getSchema ());
824823
825824 return Pair .of (new CloseableMappingIterator <>(blockRecordsIterator , transformer ), schema );
826825 }
@@ -834,7 +833,7 @@ private Pair<ClosableIterator<HoodieRecord>, Schema> getRecordsIterator(
834833 * @param dataBlock current processed block
835834 * @return final read schema.
836835 */
837- private Option <Pair <Function <HoodieRecord , HoodieRecord >, Schema >> composeEvolvedSchemaTransformer (
836+ private Option <Pair <Function <HoodieRecord , HoodieRecord >, HoodieSchema >> composeEvolvedSchemaTransformer (
838837 HoodieDataBlock dataBlock ) {
839838 if (internalSchema .isEmptySchema ()) {
840839 return Option .empty ();
@@ -844,13 +843,13 @@ private Option<Pair<Function<HoodieRecord, HoodieRecord>, Schema>> composeEvolve
844843 InternalSchema fileSchema = InternalSchemaCache .searchSchemaAndCache (currentInstantTime , hoodieTableMetaClient );
845844 InternalSchema mergedInternalSchema = new InternalSchemaMerger (fileSchema , internalSchema ,
846845 true , false ).mergeSchema ();
847- Schema mergedAvroSchema = InternalSchemaConverter .convert (mergedInternalSchema , readerSchema .getFullName ()). toAvroSchema ( );
846+ HoodieSchema mergedAvroSchema = InternalSchemaConverter .convert (mergedInternalSchema , readerSchema .getFullName ());
848847
849848 return Option .of (Pair .of ((record ) -> {
850849 return record .rewriteRecordWithNewSchema (
851850 dataBlock .getSchema (),
852851 this .hoodieTableMetaClient .getTableConfig ().getProps (),
853- HoodieSchema . fromAvroSchema ( mergedAvroSchema ) ,
852+ mergedAvroSchema ,
854853 Collections .emptyMap ());
855854 }, mergedAvroSchema ));
856855 }
0 commit comments