Class NullCheckingForGet

java.lang.Object
org.apache.arrow.vector.NullCheckingForGet

public class NullCheckingForGet extends Object
Configuration class to determine if null checking should be enabled or disabled for the "get" methods. For example, the get method of class org.apache.arrow.vector.Float8Vector first checks if the value at the given index is null, before retrieving the value. This configuration will turn on and off such checks.

Null checking is on by default. You can disable it by setting either the system property or the environmental variable to "false". The system property is named "arrow.enable_null_check_for_get" and the environmental variable is named "ARROW_ENABLE_NULL_CHECK_FOR_GET". When both the system property and the environmental variable are set, the system property takes precedence.

Disabling null-checking in the "get" methods may lead to performance improvements. For example, suppose we have the following micro-benchmark:


 Float8Vector vector = ...

 public void test() {
   sum = 0;
   for (int i = 0; i < 1024; i++) {
     vector.set(i, i + 10.0);
     safeSum += vector.get(i);
   }
 }

 

Performance evaluations of the micro-benchmark with the JMH framework reveal that, disabling null checking has the following effects: 1. The amounts of byte code and assembly code generated by JIT are both smaller. 2. The performance improves by about 30% (2.819 ± 0.005 us/op vs. 4.069 ± 0.004 us/op).

Therefore, for scenarios where the user can be sure that the null-checking is unnecessary, it is beneficial to disable it with this configuration.

  • Field Details

    • NULL_CHECKING_ENABLED

      public static final boolean NULL_CHECKING_ENABLED
      The flag to indicate if null checking is enabled for "get" methods.