You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by si...@apache.org on 2022/01/19 16:04:27 UTC

[hudi] branch release-0.10.1 updated: [HUDI-3268] Fixing NullPointerException with HoodieFileIndex when keygenclass is null in table config (#4633)

This is an automated email from the ASF dual-hosted git repository.

sivabalan pushed a commit to branch release-0.10.1
in repository https://gitbox.apache.org/repos/asf/hudi.git


The following commit(s) were added to refs/heads/release-0.10.1 by this push:
     new 1d30495  [HUDI-3268] Fixing NullPointerException with HoodieFileIndex when keygenclass is null in table config (#4633)
1d30495 is described below

commit 1d3049540f2b9d36a81ff720e55d9db9f8151fd6
Author: Sivabalan Narayanan <si...@uber.com>
AuthorDate: Wed Jan 19 11:03:56 2022 -0500

    [HUDI-3268] Fixing NullPointerException with HoodieFileIndex when keygenclass is null in table config (#4633)
---
 .../hudi-spark/src/main/scala/org/apache/hudi/HoodieFileIndex.scala  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/hudi/HoodieFileIndex.scala b/hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/hudi/HoodieFileIndex.scala
index 23b504a..414adff 100644
--- a/hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/hudi/HoodieFileIndex.scala
+++ b/hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/hudi/HoodieFileIndex.scala
@@ -114,8 +114,9 @@ case class HoodieFileIndex(
     val nameFieldMap = generateNameFieldMap(Right(schema))
 
     if (partitionColumns.isPresent) {
-      if (tableConfig.getKeyGeneratorClassName.equalsIgnoreCase(classOf[TimestampBasedKeyGenerator].getName)
-          || tableConfig.getKeyGeneratorClassName.equalsIgnoreCase(classOf[TimestampBasedAvroKeyGenerator].getName)) {
+      if (tableConfig.getKeyGeneratorClassName != null &&
+        (tableConfig.getKeyGeneratorClassName.equalsIgnoreCase(classOf[TimestampBasedKeyGenerator].getName)
+          || tableConfig.getKeyGeneratorClassName.equalsIgnoreCase(classOf[TimestampBasedAvroKeyGenerator].getName))) {
         val partitionFields = partitionColumns.get().map(column => StructField(column, StringType))
         StructType(partitionFields)
       } else {