yihua commented on code in PR #12781:
URL: https://github.com/apache/hudi/pull/12781#discussion_r1978018396
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieWriteConfig.java:
##########
@@ -300,6 +300,13 @@ public class HoodieWriteConfig extends HoodieConfig {
.withDocumentation("Schema string representing the latest schema of the
table. Hudi passes this to "
+ "implementations of evolution of schema");
+ public static final ConfigProperty<Boolean>
ENABLE_SCHEMA_CONFLICT_RESOLUTION = ConfigProperty
+ .key(CONCURRENCY_PREFIX + "schema.conflict.resolution.enable")
+ .defaultValue(false)
Review Comment:
Let's turn this on by default in OSS so it can be tested more thoroughly
out-of-box during the release process.
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/HoodieTable.java:
##########
@@ -157,6 +158,19 @@ protected HoodieTable(HoodieWriteConfig config,
HoodieEngineContext context, Hoo
this.taskContextSupplier = context.getTaskContextSupplier();
}
+ @VisibleForTesting
+ protected HoodieTable(HoodieWriteConfig config, HoodieEngineContext context,
HoodieTableMetaClient metaClient, FileSystemViewManager viewManager,
TaskContextSupplier supplier) {
Review Comment:
Let's make it default visibility instead of `protected` if so? We should
only add new constructor or API if they are needed by production code to avoid
complexity and unnecessary APIs in the production code.
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/TableSchemaGetter.java:
##########
@@ -0,0 +1,354 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hudi.client.transaction;
+
+import org.apache.avro.JsonProperties;
+import org.apache.avro.Schema;
+import org.apache.avro.Schema.Field;
+import org.apache.hudi.avro.HoodieAvroUtils;
+import org.apache.hudi.common.HoodieSchemaNotFoundException;
+import org.apache.hudi.common.model.HoodieCommitMetadata;
+import org.apache.hudi.common.table.HoodieTableMetaClient;
+import org.apache.hudi.common.table.timeline.HoodieActiveTimeline;
+import org.apache.hudi.common.table.timeline.HoodieInstant;
+import org.apache.hudi.common.table.timeline.TimelineLayout;
+import org.apache.hudi.common.util.ClusteringUtils;
+import org.apache.hudi.common.util.Option;
+import org.apache.hudi.common.util.StringUtils;
+import org.apache.hudi.common.util.VisibleForTesting;
+import org.apache.hudi.common.util.collection.Pair;
+import org.apache.hudi.exception.HoodieException;
+import org.apache.hudi.internal.schema.HoodieSchemaException;
+import org.apache.hudi.util.Lazy;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Supplier;
+import java.util.stream.Stream;
+
+import static org.apache.hudi.avro.AvroSchemaUtils.appendFieldsToSchema;
+import static org.apache.hudi.avro.AvroSchemaUtils.containsFieldInSchema;
+import static org.apache.hudi.avro.AvroSchemaUtils.createNullableSchema;
+import static
org.apache.hudi.common.table.timeline.HoodieTimeline.COMMIT_ACTION;
+import static
org.apache.hudi.common.table.timeline.HoodieTimeline.DELTA_COMMIT_ACTION;
+import static
org.apache.hudi.common.table.timeline.HoodieTimeline.REPLACE_COMMIT_ACTION;
+import static
org.apache.hudi.common.table.timeline.InstantComparison.LESSER_THAN_OR_EQUALS;
+import static
org.apache.hudi.common.table.timeline.InstantComparison.compareTimestamps;
+
+/**
+ * Helper class to read table schema.
+ */
+class TableSchemaGetter {
Review Comment:
I still see this class as a standalone one. Have you pushed your latest
commits?
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/commit/BaseCommitActionExecutor.java:
##########
@@ -298,12 +296,17 @@ protected HoodieWriteMetadata<HoodieData<WriteStatus>>
executeClustering(HoodieC
// Disable auto commit. Strategy is only expected to write data in new
files.
config.setValue(HoodieWriteConfig.AUTO_COMMIT_ENABLE,
Boolean.FALSE.toString());
- final Schema schema = new
TableSchemaResolver(table.getMetaClient()).getTableAvroSchemaForClustering(false).get();
+ Option<Schema> schema;
Review Comment:
Let's revert the changes in this file instead so that there is no change on
this class in this PR.
--
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]