This is an automated email from the ASF dual-hosted git repository.
danny0405 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git
The following commit(s) were added to refs/heads/master by this push:
new 00ece7bce0a [MINOR] Fix npe for get internal schema (#9984)
00ece7bce0a is described below
commit 00ece7bce0a4a8d0019721a28049723821e01842
Author: watermelon12138 <[email protected]>
AuthorDate: Tue Nov 14 10:35:11 2023 +0800
[MINOR] Fix npe for get internal schema (#9984)
---
.../main/java/org/apache/hudi/common/util/InternalSchemaCache.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
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 6485fdd9575..05b482506f4 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 class InternalSchemaCache {
}
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) {