yihua commented on code in PR #12781:
URL: https://github.com/apache/hudi/pull/12781#discussion_r1980325311
##########
hudi-common/src/main/java/org/apache/hudi/common/table/TableSchemaResolver.java:
##########
@@ -185,43 +176,32 @@ public Option<Schema> getTableAvroSchemaIfPresent(boolean
includeMetadataFields)
return getTableAvroSchemaInternal(includeMetadataFields, Option.empty());
}
- Option<Schema> getTableAvroSchemaInternal(boolean includeMetadataFields,
Option<HoodieInstant> instantOpt) {
- return (instantOpt.isPresent()
- ? getTableSchemaFromCommitMetadata(instantOpt.get(),
includeMetadataFields)
- : getTableSchemaFromLatestCommitMetadata(includeMetadataFields))
- .or(() -> getTableCreateSchemaWithMetadata(includeMetadataFields))
- .or(() -> getSchemaFromDataFileIfPresent(includeMetadataFields))
- .map(this::handlePartitionColumnsIfNeeded);
- }
-
- /**
- * Retrieves the table creation schema with metadata fields and partition
columns handled.
- *
- * @param includeMetadataFields whether to include metadata fields in the
schema
- * @return Option containing the fully processed schema if available, empty
Option otherwise
- */
- public Option<Schema> getTableCreateSchemaWithMetadata(boolean
includeMetadataFields) {
- return metaClient.getTableConfig().getTableCreateSchema()
- .map(tableSchema ->
- includeMetadataFields
- ? HoodieAvroUtils.addMetadataFields(tableSchema,
hasOperationField.get())
- : tableSchema)
- .map(this::handlePartitionColumnsIfNeeded);
- }
-
- /**
- * Handles partition column logic for a given schema.
- *
- * @param schema the input schema to process
- * @return the processed schema with partition columns handled appropriately
- */
- private Schema handlePartitionColumnsIfNeeded(Schema schema) {
- if (metaClient.getTableConfig().shouldDropPartitionColumns()) {
+ private Option<Schema> getTableAvroSchemaInternal(boolean
includeMetadataFields, Option<HoodieInstant> instantOpt) {
Review Comment:
Reviewed the changes and looks good.
--
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]