yanghua commented on a change in pull request #2430: URL: https://github.com/apache/hudi/pull/2430#discussion_r561719568
########## File path: hudi-flink/src/main/java/org/apache/hudi/operator/FlinkOptions.java ########## @@ -0,0 +1,249 @@ +/* + * 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.operator; + +import org.apache.hudi.config.HoodieWriteConfig; +import org.apache.hudi.streamer.FlinkStreamerConfig; +import org.apache.hudi.common.model.OverwriteWithLatestAvroPayload; +import org.apache.hudi.keygen.SimpleAvroKeyGenerator; +import org.apache.hudi.keygen.constant.KeyGeneratorOptions; +import org.apache.hudi.util.StreamerUtil; + +import org.apache.flink.configuration.ConfigOption; +import org.apache.flink.configuration.ConfigOptions; +import org.apache.flink.configuration.Configuration; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Hoodie Flink config options. + * + * <p>It has the options for Hoodie table read and write. It also defines some utilities. + */ +public class FlinkOptions { + private FlinkOptions() { + } + + // ------------------------------------------------------------------------ + // Base Options + // ------------------------------------------------------------------------ + public static final ConfigOption<String> PATH = ConfigOptions + .key("path") + .stringType() + .noDefaultValue() + .withDescription("Base path for the target hoodie table." + + "\nThe path would be created if it does not exist,\n" + + "otherwise a Hoodie table expects to be initialized successfully"); + + public static final ConfigOption<String> PROPS_FILE_PATH = ConfigOptions + .key("properties-file.path") + .stringType() + .noDefaultValue() + .withDescription("Path to properties file on local-fs or dfs, with configurations for \n" + + "hoodie client, schema provider, key generator and data source. For hoodie client props, sane defaults are\n" + + "used, but recommend use to provide basic things like metrics endpoints, hive configs etc. For sources, refer\n" + + "to individual classes, for supported properties"); + + // ------------------------------------------------------------------------ + // Read Options + // ------------------------------------------------------------------------ + public static final ConfigOption<String> READ_SCHEMA_FILE_PATH = ConfigOptions + .key("read.schema.file.path") + .stringType() + .noDefaultValue() + .withDescription("Avro schema file path, the parsed schema is used for deserializing"); + + // ------------------------------------------------------------------------ + // Write Options + // ------------------------------------------------------------------------ + public static final ConfigOption<String> TABLE_NAME = ConfigOptions + .key(HoodieWriteConfig.TABLE_NAME) + .stringType() + .noDefaultValue() + .withDescription("Table name to register to Hive metastore"); + + public static final ConfigOption<String> TABLE_TYPE = ConfigOptions + .key("write.table.type") + .stringType() + .defaultValue("COPY_ON_WRITE") + .withDescription("Type of table to write. COPY_ON_WRITE (or) MERGE_ON_READ"); + + public static final ConfigOption<String> OPERATION = ConfigOptions + .key("write.operation") + .stringType() + .defaultValue("upsert") + .withDescription("The write operation, that this write should do"); + + public static final ConfigOption<String> PRECOMBINE_FIELD = ConfigOptions + .key("write.precombine.field") Review comment: > The config options in HoodieWriteConfig are too verbose. That's true. But for the same configuration, if we have multiple pointers to it, it will bring the risk of losing control. In the future, if we have some changes to this configuration, such as making it depreciated. We may lose our unified control over it. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
