cshuo commented on code in PR #18738:
URL: https://github.com/apache/hudi/pull/18738#discussion_r3240603339
##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/configuration/OptionsResolver.java:
##########
@@ -157,13 +159,31 @@ public static boolean
isDefaultHoodieRecordPayloadClazz(Configuration conf) {
* Return value of {@link FlinkOptions#RECORD_KEY_FIELD} if it was set,
* or throw exception otherwise.
*/
+ @Nullable
public static String getRecordKeyStr(Configuration conf) {
+ return conf.get(FlinkOptions.RECORD_KEY_FIELD);
+ }
+
+ /**
+ * Return the record keys as an array.
+ */
+ public static String[] getRecordKeys(Configuration conf) {
Review Comment:
https://github.com/apache/hudi/blob/f2fdca26fef48d2d68a51d4ee98b03b2cbfbc93a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/keygen/KeyGenUtils.java#L333-L341
we can refer to this util method for safer key extracting.
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/keygen/TimestampBasedAvroKeyGenerator.java:
##########
@@ -73,7 +73,7 @@ public enum TimestampType implements Serializable {
protected final boolean encodePartitionPath;
public TimestampBasedAvroKeyGenerator(TypedProperties config) throws
IOException {
- this(config,
config.getString(KeyGeneratorOptions.RECORDKEY_FIELD_NAME.key()),
+ this(config,
config.getString(KeyGeneratorOptions.RECORDKEY_FIELD_NAME.key(), null),
Review Comment:
+1
--
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]