This is an automated email from the ASF dual-hosted git repository. voonhous pushed a commit to branch release-1.2.1 in repository https://gitbox.apache.org/repos/asf/hudi.git
commit 49736bf3bc480fb5e526fb242fc06c7a5700e93b Author: voonhous <[email protected]> AuthorDate: Fri Jul 3 18:51:55 2026 +0800 refactor: Retire leftover Avro Schema usages in AvroSchemaUtils and LSMTimelineWriter (#19153) * refactor(common): Remove dead AvroSchemaUtils.createSchemaErrorString overload The Avro-typed createSchemaErrorString(String, Schema, Schema) has no callers in main or test; all sites use the HoodieSchema twin HoodieSchemaUtils.createSchemaErrorString(String, HoodieSchema, HoodieSchema). Retire the legacy Avro overload. Part of the Avro Schema -> HoodieSchema migration (#14263). * refactor(client): Drop redundant Avro Schema local in LSMTimelineWriter Inline HoodieSchema.fromAvroSchema(HoodieLSMTimelineInstant.getClassSchema()) as the sibling write paths already do (previously an intermediate Avro Schema local was wrapped a line later), removing the local and the now-unused org.apache.avro.Schema import. Log output is unchanged: HoodieSchema.toString() delegates to the wrapped Avro schema. Incidental (editor auto-format): two concatenated log statements in this file are normalized to parameterized slf4j form. Part of the Avro Schema -> HoodieSchema migration (#14263). (cherry picked from commit e38e043de9e59f5b455defb6739802e2eb94f15b) --- .../hudi/client/timeline/versioning/v2/LSMTimelineWriter.java | 10 ++++------ .../src/main/java/org/apache/hudi/avro/AvroSchemaUtils.java | 4 ---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/timeline/versioning/v2/LSMTimelineWriter.java b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/timeline/versioning/v2/LSMTimelineWriter.java index b555a0646183..97b2dc01d3ac 100644 --- a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/timeline/versioning/v2/LSMTimelineWriter.java +++ b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/timeline/versioning/v2/LSMTimelineWriter.java @@ -49,7 +49,6 @@ import org.apache.hudi.storage.StoragePath; import org.apache.hudi.table.HoodieTable; import lombok.extern.slf4j.Slf4j; -import org.apache.avro.Schema; import org.apache.avro.generic.IndexedRecord; import java.io.IOException; @@ -137,9 +136,8 @@ public class LSMTimelineWriter { throw new HoodieIOException("Failed to check archiving file before write: " + filePath, ioe); } try (HoodieFileWriter writer = openWriter(filePath)) { - Schema wrapperSchema = HoodieLSMTimelineInstant.getClassSchema(); - log.info("Writing schema " + wrapperSchema.toString()); - HoodieSchema schema = HoodieSchema.fromAvroSchema(wrapperSchema); + HoodieSchema schema = HoodieSchema.fromAvroSchema(HoodieLSMTimelineInstant.getClassSchema()); + log.info("Writing schema {}", schema); for (ActiveAction activeAction : activeActions) { try { preWriteCallback.ifPresent(callback -> callback.accept(activeAction)); @@ -147,7 +145,7 @@ public class LSMTimelineWriter { final HoodieLSMTimelineInstant metaEntry = MetadataConversionUtils.createLSMTimelineInstant(activeAction, metaClient); writer.write(metaEntry.getInstantTime(), new HoodieAvroIndexedRecord(metaEntry), schema); } catch (Exception e) { - log.error("Failed to write instant: " + activeAction.getInstantTime(), e); + log.error("Failed to write instant: {}", activeAction.getInstantTime(), e); exceptionHandler.ifPresent(handler -> handler.accept(e)); } } @@ -290,7 +288,7 @@ public class LSMTimelineWriter { compactFiles(candidateFiles, compactedFileName); // 4. update the manifest file updateManifest(candidateFiles, compactedFileName); - log.info("Finishes compaction of source files: " + candidateFiles); + log.info("Finishes compaction of source files: {}", candidateFiles); return Option.of(compactedFileName); } return Option.empty(); diff --git a/hudi-common/src/main/java/org/apache/hudi/avro/AvroSchemaUtils.java b/hudi-common/src/main/java/org/apache/hudi/avro/AvroSchemaUtils.java index 90a8e9274b8a..78ffcf572312 100644 --- a/hudi-common/src/main/java/org/apache/hudi/avro/AvroSchemaUtils.java +++ b/hudi-common/src/main/java/org/apache/hudi/avro/AvroSchemaUtils.java @@ -114,10 +114,6 @@ public class AvroSchemaUtils { return Schema.createUnion(Schema.create(Schema.Type.NULL), schema); } - public static String createSchemaErrorString(String errorMessage, Schema writerSchema, Schema tableSchema) { - return String.format("%s\nwriterSchema: %s\ntableSchema: %s", errorMessage, writerSchema, tableSchema); - } - /** * Create a new schema by force changing all the fields as nullable. *
