Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-22161

UDF: FunctionRegistry synchronizes on org.apache.hadoop.hive.ql.udf.UDFType class

    XMLWordPrintableJSON

Details

    Description

      There's a hidden synchronization across threads when looking up isStateful and isDeterministic.

      https://github.com/apache/hive/blob/master/common/src/java/org/apache/hive/common/util/AnnotationUtils.java#L27

        // to avoid https://bugs.openjdk.java.net/browse/JDK-7122142
        public static <T extends Annotation> T getAnnotation(Class<?> clazz, Class<T> annotationClass) {
          synchronized (annotationClass) {
            return clazz.getAnnotation(annotationClass);
          }
        }
      

      This is serializing multiple threads initializing UDFs (or checking them during compilation) & also being locked across threads for each instance of GenericUDFOpEqual in the specific scenario.

      https://bugs.openjdk.java.net/browse/JDK-7122142 is fixed in jdk8+

      Attachments

        1. HIVE-22161.1.patch
          1 kB
          Gopal Vijayaraghavan

        Activity

          People

            gopalv Gopal Vijayaraghavan
            gopalv Gopal Vijayaraghavan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: