apache-flinkapache-hudi

HUDI compaction using Flink raises NullPointerException: Value must not be null


I followed the example on Hudi's website. Instead of using hudi-flink-bundle_2.11-0.9.0-SNAPSHOT.jar, I use hudi-flink1.16-bundle-0.13.0.jar, acquired from here.

Command:

$FLINK_HOME/bin/flink run \
  -c org.apache.hudi.sink.compact.HoodieFlinkCompactor \
  $FLINK_HOME/lib/hudi-flink1.16-bundle-0.13.0.jar \
  --path 'file://...sample_db/people'

Exception Trace:

 The program finished with the following exception:

org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: Value must not be null.
        at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:372)
        at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:222)
        at org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:98)
        at org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:843)
        at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:240)
        at org.apache.flink.client.cli.CliFrontend.parseAndRun(CliFrontend.java:1087)
        at org.apache.flink.client.cli.CliFrontend.lambda$main$10(CliFrontend.java:1165)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/javax.security.auth.Subject.doAs(Subject.java:423)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1878)
        at org.apache.flink.runtime.security.contexts.HadoopSecurityContext.runSecured(HadoopSecurityContext.java:41)
        at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1165)
Caused by: java.lang.NullPointerException: Value must not be null.
        at org.apache.flink.configuration.Configuration.setValueInternal(Configuration.java:775)
        at org.apache.flink.configuration.Configuration.setValueInternal(Configuration.java:787)
        at org.apache.flink.configuration.Configuration.setString(Configuration.java:200)
        at org.apache.hudi.util.CompactionUtil.setPreCombineField(CompactionUtil.java:133)
        at org.apache.hudi.sink.compact.HoodieFlinkCompactor$AsyncCompactionService.<init>(HoodieFlinkCompactor.java:177)
        at org.apache.hudi.sink.compact.HoodieFlinkCompactor.main(HoodieFlinkCompactor.java:75)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:355)

Has anyone also encounters this situation? What could possibly be the root cause for this?


Solution

  • Are you sure your table is MOR, not COW, as per the Javadoc for setPreCombineField():

      /**
       * Sets up the preCombine field into the given configuration {@code conf}
       * through reading from the hoodie table metadata.
       * <p>
       * This value is non-null as compaction can only be performed on MOR tables.
       * Of which, MOR tables will have non-null precombine fields.