From e4931744ebcb6380ec967636213c406fd80a735f Mon Sep 17 00:00:00 2001 From: Pratyaksh Sharma Date: Wed, 21 Oct 2020 12:06:25 +0530 Subject: [PATCH] [HUDI-1200] fixed NPE in CustomKeyGenerator (#2093) - config field is no longer transient in key generator - verified that the key generator object is shipped from the driver to executors, just the one time and reused for each record --- .../main/java/org/apache/hudi/keygen/CustomKeyGenerator.java | 1 - .../src/main/java/org/apache/hudi/keygen/KeyGenerator.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/hudi-spark/src/main/java/org/apache/hudi/keygen/CustomKeyGenerator.java b/hudi-spark/src/main/java/org/apache/hudi/keygen/CustomKeyGenerator.java index 2ac6b77b2..e4576882c 100644 --- a/hudi-spark/src/main/java/org/apache/hudi/keygen/CustomKeyGenerator.java +++ b/hudi-spark/src/main/java/org/apache/hudi/keygen/CustomKeyGenerator.java @@ -118,7 +118,6 @@ public class CustomKeyGenerator extends BuiltinKeyGenerator { partitionPath.append(DEFAULT_PARTITION_PATH_SEPARATOR); } partitionPath.deleteCharAt(partitionPath.length() - 1); - return partitionPath.toString(); } diff --git a/hudi-spark/src/main/java/org/apache/hudi/keygen/KeyGenerator.java b/hudi-spark/src/main/java/org/apache/hudi/keygen/KeyGenerator.java index 7c67f9aec..3b1db0857 100644 --- a/hudi-spark/src/main/java/org/apache/hudi/keygen/KeyGenerator.java +++ b/hudi-spark/src/main/java/org/apache/hudi/keygen/KeyGenerator.java @@ -41,7 +41,7 @@ public abstract class KeyGenerator implements Serializable, SparkKeyGeneratorInt private static final String STRUCT_NAME = "hoodieRowTopLevelField"; private static final String NAMESPACE = "hoodieRow"; - protected transient TypedProperties config; + protected TypedProperties config; private transient Function1 converterFn = null; protected KeyGenerator(TypedProperties config) {