diff --git a/hudi-common/src/main/java/org/apache/hudi/common/util/InternalSchemaCache.java b/hudi-common/src/main/java/org/apache/hudi/common/util/InternalSchemaCache.java index 6485fdd9575c..05b482506f4d 100644 --- a/hudi-common/src/main/java/org/apache/hudi/common/util/InternalSchemaCache.java +++ b/hudi-common/src/main/java/org/apache/hudi/common/util/InternalSchemaCache.java @@ -217,7 +217,11 @@ public static InternalSchema getInternalSchemaByVersionId(long versionId, String } InternalSchema fileSchema = InternalSchemaUtils.searchSchema(versionId, SerDeHelper.parseSchemas(latestHistorySchema)); // step3: - return fileSchema.isEmptySchema() ? AvroInternalSchemaConverter.convert(HoodieAvroUtils.addMetadataFields(new Schema.Parser().parse(avroSchema))) : fileSchema; + return fileSchema.isEmptySchema() + ? StringUtils.isNullOrEmpty(avroSchema) + ? InternalSchema.getEmptyInternalSchema() + : AvroInternalSchemaConverter.convert(HoodieAvroUtils.addMetadataFields(new Schema.Parser().parse(avroSchema))) + : fileSchema; } public static InternalSchema getInternalSchemaByVersionId(long versionId, HoodieTableMetaClient metaClient) {