You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by vh...@apache.org on 2026/01/08 13:31:52 UTC
(hudi) 01/01: Address comments
This is an automated email from the ASF dual-hosted git repository.
vhs pushed a commit to branch phase-18-HoodieAvroUtils-removal-p2
in repository https://gitbox.apache.org/repos/asf/hudi.git
commit 84bc08d0d5679a998fbcb537755797fe25d94dab
Author: voon <vo...@gmail.com>
AuthorDate: Thu Jan 8 21:31:36 2026 +0800
Address comments
---
.../transaction/ConcurrentSchemaEvolutionTableSchemaGetter.java | 3 +--
.../main/java/org/apache/hudi/common/table/HoodieTableConfig.java | 6 +++---
.../main/java/org/apache/hudi/common/table/TableSchemaResolver.java | 1 -
.../main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java | 2 +-
.../test/java/org/apache/hudi/table/catalog/TestHoodieCatalog.java | 3 ++-
.../java/org/apache/hudi/table/catalog/TestHoodieHiveCatalog.java | 3 ++-
6 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/ConcurrentSchemaEvolutionTableSchemaGetter.java b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/ConcurrentSchemaEvolutionTableSchemaGetter.java
index a51dbcc396cf..0bb7db3fa583 100644
--- a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/ConcurrentSchemaEvolutionTableSchemaGetter.java
+++ b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/ConcurrentSchemaEvolutionTableSchemaGetter.java
@@ -96,8 +96,7 @@ class ConcurrentSchemaEvolutionTableSchemaGetter {
}
private Option<HoodieSchema> getTableCreateSchemaWithoutMetaField() {
- return metaClient.getTableConfig().getTableCreateSchema()
- .map(HoodieSchema::fromAvroSchema);
+ return metaClient.getTableConfig().getTableCreateSchema();
}
private void setCachedLatestCommitWithValidSchema(Option<HoodieInstant> instantOption) {
diff --git a/hudi-common/src/main/java/org/apache/hudi/common/table/HoodieTableConfig.java b/hudi-common/src/main/java/org/apache/hudi/common/table/HoodieTableConfig.java
index c5bcfbaff6f6..cfcf203ebc40 100644
--- a/hudi-common/src/main/java/org/apache/hudi/common/table/HoodieTableConfig.java
+++ b/hudi-common/src/main/java/org/apache/hudi/common/table/HoodieTableConfig.java
@@ -44,6 +44,7 @@ import org.apache.hudi.common.model.PartialUpdateAvroPayload;
import org.apache.hudi.common.model.debezium.DebeziumConstants;
import org.apache.hudi.common.model.debezium.MySqlDebeziumAvroPayload;
import org.apache.hudi.common.model.debezium.PostgresDebeziumAvroPayload;
+import org.apache.hudi.common.schema.HoodieSchema;
import org.apache.hudi.common.table.cdc.HoodieCDCSupplementalLoggingMode;
import org.apache.hudi.common.table.timeline.HoodieInstantTimeGenerator;
import org.apache.hudi.common.table.timeline.versioning.TimelineLayoutVersion;
@@ -63,7 +64,6 @@ import org.apache.hudi.metadata.MetadataPartitionType;
import org.apache.hudi.storage.HoodieStorage;
import org.apache.hudi.storage.StoragePath;
-import org.apache.avro.Schema;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -1113,9 +1113,9 @@ public class HoodieTableConfig extends HoodieConfig {
return Option.ofNullable(getString(BOOTSTRAP_BASE_PATH));
}
- public Option<Schema> getTableCreateSchema() {
+ public Option<HoodieSchema> getTableCreateSchema() {
if (contains(CREATE_SCHEMA)) {
- return Option.of(new Schema.Parser().parse(getString(CREATE_SCHEMA)));
+ return Option.of(HoodieSchema.parse(getString(CREATE_SCHEMA)));
} else {
return Option.empty();
}
diff --git a/hudi-common/src/main/java/org/apache/hudi/common/table/TableSchemaResolver.java b/hudi-common/src/main/java/org/apache/hudi/common/table/TableSchemaResolver.java
index 9ba258ca0e2a..7b57915f9260 100644
--- a/hudi-common/src/main/java/org/apache/hudi/common/table/TableSchemaResolver.java
+++ b/hudi-common/src/main/java/org/apache/hudi/common/table/TableSchemaResolver.java
@@ -173,7 +173,6 @@ public class TableSchemaResolver {
: getTableSchemaFromLatestCommitMetadata(includeMetadataFields))
.or(() ->
metaClient.getTableConfig().getTableCreateSchema()
- .map(HoodieSchema::fromAvroSchema)
.map(tableSchema ->
includeMetadataFields
? HoodieSchemaUtils.addMetadataFields(tableSchema, hasOperationField.get())
diff --git a/hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java b/hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java
index 7fa98d0c6ebb..2af584104e9d 100644
--- a/hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java
+++ b/hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java
@@ -1608,7 +1608,7 @@ public class HoodieTableMetadataUtil {
// NOTE: Writer schema added to commit metadata will not contain Hudi's metadata fields
Option<HoodieSchema> tableSchema = writerSchema.isEmpty()
- ? tableConfig.getTableCreateSchema().map(HoodieSchema::fromAvroSchema) // the write schema does not set up correctly
+ ? tableConfig.getTableCreateSchema() // the write schema does not set up correctly
: writerSchema.map(schema -> tableConfig.populateMetaFields() ? addMetadataFields(schema) : schema)
.map(HoodieSchema::fromAvroSchema);
diff --git a/hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/table/catalog/TestHoodieCatalog.java b/hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/table/catalog/TestHoodieCatalog.java
index d8f41fd984ef..ab8ce6f58317 100644
--- a/hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/table/catalog/TestHoodieCatalog.java
+++ b/hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/table/catalog/TestHoodieCatalog.java
@@ -22,6 +22,7 @@ import org.apache.hudi.common.model.DefaultHoodieRecordPayload;
import org.apache.hudi.common.model.HoodieCommitMetadata;
import org.apache.hudi.common.model.HoodieReplaceCommitMetadata;
import org.apache.hudi.common.model.PartitionBucketIndexHashingConfig;
+import org.apache.hudi.common.schema.HoodieSchema;
import org.apache.hudi.common.table.HoodieTableConfig;
import org.apache.hudi.common.table.HoodieTableMetaClient;
import org.apache.hudi.common.table.timeline.HoodieInstant;
@@ -261,7 +262,7 @@ public class TestHoodieCatalog extends BaseTestHoodieCatalog {
HoodieTableConfig tableConfig = StreamerUtil.getTableConfig(
catalog.getTable(tablePath).getOptions().get(FlinkOptions.PATH.key()),
HadoopConfigurations.getHadoopConf(new Configuration())).get();
- Option<org.apache.avro.Schema> tableCreateSchema = tableConfig.getTableCreateSchema();
+ Option<HoodieSchema> tableCreateSchema = tableConfig.getTableCreateSchema();
assertTrue(tableCreateSchema.isPresent(), "Table should have been created");
assertThat(tableCreateSchema.get().getFullName(), is("hoodie.tb1.tb1_record"));
diff --git a/hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/table/catalog/TestHoodieHiveCatalog.java b/hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/table/catalog/TestHoodieHiveCatalog.java
index 795730e9b098..f3096b5d0df8 100644
--- a/hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/table/catalog/TestHoodieHiveCatalog.java
+++ b/hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/table/catalog/TestHoodieHiveCatalog.java
@@ -22,6 +22,7 @@ import org.apache.hudi.common.config.TypedProperties;
import org.apache.hudi.common.model.HoodieCommitMetadata;
import org.apache.hudi.common.model.HoodieReplaceCommitMetadata;
import org.apache.hudi.common.model.HoodieTableType;
+import org.apache.hudi.common.schema.HoodieSchema;
import org.apache.hudi.common.table.HoodieTableConfig;
import org.apache.hudi.common.table.HoodieTableMetaClient;
import org.apache.hudi.common.table.timeline.HoodieInstant;
@@ -220,7 +221,7 @@ public class TestHoodieHiveCatalog extends BaseTestHoodieCatalog {
// validate the full name of table create schema
HoodieTableConfig tableConfig = StreamerUtil.getTableConfig(table1.getOptions().get(FlinkOptions.PATH.key()), hoodieCatalog.getHiveConf()).get();
- Option<org.apache.avro.Schema> tableCreateSchema = tableConfig.getTableCreateSchema();
+ Option<HoodieSchema> tableCreateSchema = tableConfig.getTableCreateSchema();
assertTrue(tableCreateSchema.isPresent(), "Table should have been created");
assertThat(tableCreateSchema.get().getFullName(), is("hoodie.test.test_record"));