voonhous commented on code in PR #17535:
URL: https://github.com/apache/hudi/pull/17535#discussion_r2609061624
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/ConcurrentSchemaEvolutionTableSchemaGetter.java:
##########
@@ -100,13 +94,17 @@ private Schema handlePartitionColumnsIfNeeded(Schema
schema) {
public Option<Schema> getTableAvroSchemaIfPresent(boolean
includeMetadataFields, Option<HoodieInstant> instant) {
return getTableAvroSchemaFromTimelineWithCache(instant) // Get table
schema from schema evolution timeline.
+ .map(HoodieSchema::fromAvroSchema)
.or(this::getTableCreateSchemaWithoutMetaField) // Fall back: read
create schema from table config.
- .map(tableSchema -> includeMetadataFields ?
HoodieAvroUtils.addMetadataFields(tableSchema, false) :
HoodieAvroUtils.removeMetadataFields(tableSchema))
- .map(this::handlePartitionColumnsIfNeeded);
+ .map(tableSchema -> includeMetadataFields ?
HoodieSchemaUtils.addMetadataFields(tableSchema, false) :
HoodieSchemaUtils.removeMetadataFields(tableSchema))
+ .map(this::handlePartitionColumnsIfNeeded)
+ .map(HoodieSchema::toAvroSchema);
}
- private Option<Schema> getTableCreateSchemaWithoutMetaField() {
- return metaClient.getTableConfig().getTableCreateSchema();
+ private Option<HoodieSchema> getTableCreateSchemaWithoutMetaField() {
+ return metaClient.getTableConfig().getTableCreateSchema()
+ .map(HoodieSchema::fromAvroSchema)
+ .or(Option.empty());
Review Comment:
Done
--
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]