nsivabalan commented on code in PR #9377:
URL: https://github.com/apache/hudi/pull/9377#discussion_r1286476217
##########
hudi-common/src/main/java/org/apache/hudi/common/config/TimestampKeyGeneratorConfig.java:
##########
@@ -94,6 +104,7 @@ public class TimestampKeyGeneratorConfig {
public static final ConfigProperty<String> DATE_TIME_PARSER = ConfigProperty
.key("hoodie.deltastreamer.keygen.datetime.parser.class")
.defaultValue("org.apache.hudi.keygen.parser.HoodieDateTimeParser")
+ .withAlternatives("hoodie.keygen.datetime.parser.class")
Review Comment:
shouldn't this needs to reversed.
.key("hoodie.keygen.datetime.parser.class")
.defaultValue("org.apache.hudi.keygen.parser.HoodieDateTimeParser")
.withAlternatives("hoodie.detlastreamer.keygen.datetime.parser.class")
##########
hudi-common/src/main/java/org/apache/hudi/common/util/ConfigUtils.java:
##########
@@ -61,11 +91,69 @@ public static List<String> split2List(String param) {
.map(String::trim).distinct().collect(Collectors.toList());
}
+ /**
+ * Convert the key-value config to a map.The format of the config
+ * is a key-value pair just like "k1=v1\nk2=v2\nk3=v3".
+ *
+ * @param keyValueConfig
+ * @return
+ */
+ public static Map<String, String> toMap(String keyValueConfig) {
Review Comment:
do we have tests for this?
##########
hudi-common/src/main/java/org/apache/hudi/common/util/ConfigUtils.java:
##########
@@ -80,4 +168,184 @@ public static <T extends Enum<T>> String[]
enumNames(Class<T> enumType) {
T[] enumConstants = enumType.getEnumConstants();
return Arrays.stream(enumConstants).map(Enum::name).toArray(String[]::new);
}
+
+ public static Option<String> stripPrefix(String prop, ConfigProperty<String>
prefixConfig) {
Review Comment:
java docs please
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/schema/KafkaOffsetPostProcessor.java:
##########
@@ -43,7 +45,7 @@ public static class Config {
HoodieStreamerConfig.KAFKA_APPEND_OFFSETS;
public static boolean shouldAddOffsets(TypedProperties props) {
- return props.getBoolean(HoodieStreamerConfig.KAFKA_APPEND_OFFSETS.key(),
Boolean.parseBoolean(HoodieStreamerConfig.KAFKA_APPEND_OFFSETS.defaultValue()));
+ return getBooleanWithAltKeys(props,
HoodieStreamerConfig.KAFKA_APPEND_OFFSETS);
Review Comment:
not required in this patch.
but we should have two apis. one which return default if not found. another
which returns null
```
getBooleanWithAltKeys
getBooleanWithAltKeysOrDefault
```
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/config/SqlFileBasedSourceConfig.java:
##########
@@ -0,0 +1,52 @@
+/*
+ * 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.utilities.config;
+
+import org.apache.hudi.common.config.ConfigClassProperty;
+import org.apache.hudi.common.config.ConfigGroups;
+import org.apache.hudi.common.config.ConfigProperty;
+
+import javax.annotation.concurrent.Immutable;
+
+import static
org.apache.hudi.common.util.ConfigUtils.DELTA_STREAMER_CONFIG_PREFIX;
+import static org.apache.hudi.common.util.ConfigUtils.STREAMER_CONFIG_PREFIX;
+
+@Immutable
+@ConfigClassProperty(name = "File-based SQL Source Configs",
+ groupName = ConfigGroups.Names.HUDI_STREAMER,
+ subGroupName = ConfigGroups.SubGroupNames.DELTA_STREAMER_SOURCE,
+ description = "Configurations controlling the behavior of File-based SQL
Source in Hudi Streamer.")
+public class SqlFileBasedSourceConfig {
+
+ public static final ConfigProperty<String> SOURCE_SQL_FILE = ConfigProperty
+ .key(STREAMER_CONFIG_PREFIX + "source.sql.file")
Review Comment:
if these configs are being added only in 0.14.0, why do we need older ones?
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/AvroKafkaSource.java:
##########
@@ -63,16 +74,15 @@ public AvroKafkaSource(TypedProperties props,
JavaSparkContext sparkContext, Spa
this.originalSchemaProvider = schemaProvider;
props.put(NATIVE_KAFKA_KEY_DESERIALIZER_PROP,
StringDeserializer.class.getName());
- deserializerClassName =
props.getString(DataSourceWriteOptions.KAFKA_AVRO_VALUE_DESERIALIZER_CLASS().key(),
-
DataSourceWriteOptions.KAFKA_AVRO_VALUE_DESERIALIZER_CLASS().defaultValue());
+ deserializerClassName = getStringWithAltKeys(props,
KAFKA_AVRO_VALUE_DESERIALIZER_CLASS);
try {
props.put(NATIVE_KAFKA_VALUE_DESERIALIZER_PROP,
Class.forName(deserializerClassName).getName());
if
(deserializerClassName.equals(KafkaAvroSchemaDeserializer.class.getName())) {
if (schemaProvider == null) {
throw new HoodieReadFromSourceException("SchemaProvider has to be
set to use KafkaAvroSchemaDeserializer");
}
- props.put(KAFKA_AVRO_VALUE_DESERIALIZER_SCHEMA,
schemaProvider.getSourceSchema().toString());
+ props.put(KAFKA_VALUE_DESERIALIZER_SCHEMA.key(),
schemaProvider.getSourceSchema().toString());
Review Comment:
KAFKA_AVRO_VALUE_DESERIALIZER_SCHEMA and not KAFKA_VALUE_DESERIALIZER_SCHEMA
"AVRO" is missing
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/streamer/HoodieMultiTableStreamer.java:
##########
@@ -118,9 +126,11 @@ private void
populateTableExecutionContextList(TypedProperties properties, Strin
String database = tableWithDatabase.length > 1 ? tableWithDatabase[0] :
"default";
String currentTable = tableWithDatabase.length > 1 ?
tableWithDatabase[1] : table;
String configProp = HoodieStreamerConfig.INGESTION_PREFIX + database +
Constants.DELIMITER + currentTable + Constants.INGESTION_CONFIG_SUFFIX;
- String configFilePath = properties.getString(configProp,
Helpers.getDefaultConfigFilePath(configFolder, database, currentTable));
+ String oldConfigProp = HoodieStreamerConfig.OLD_INGESTION_PREFIX +
database + Constants.DELIMITER + currentTable +
Constants.INGESTION_CONFIG_SUFFIX;
Review Comment:
can you check if the last arg/var is correct here
--
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]