drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jacq...@apache.org
Subject [11/13] drill git commit: DRILL-3742: Classpath scanning and build improvement
Date Mon, 26 Oct 2015 17:42:58 GMT
http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/common/src/main/java/org/apache/drill/common/scanner/persistence/ScanResult.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/scanner/persistence/ScanResult.java b/common/src/main/java/org/apache/drill/common/scanner/persistence/ScanResult.java
new file mode 100644
index 0000000..a85fa15
--- /dev/null
+++ b/common/src/main/java/org/apache/drill/common/scanner/persistence/ScanResult.java
@@ -0,0 +1,213 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.common.scanner.persistence;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static java.lang.String.format;
+import static java.util.Arrays.asList;
+import static java.util.Collections.unmodifiableList;
+import static java.util.Collections.unmodifiableSet;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.apache.drill.common.exceptions.DrillRuntimeException;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import com.google.common.base.Stopwatch;
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.Multimap;
+
+/**
+ * The root doc of the scan result
+ */
+public final class ScanResult {
+  private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ScanResult.class);
+
+  private final List<String> scannedPackages;
+  private final Set<String> scannedClasses;
+  private final Set<String> scannedAnnotations;
+  private final List<AnnotatedClassDescriptor> annotatedClasses;
+  private final List<ParentClassDescriptor> implementations;
+
+  private final Map<String, ParentClassDescriptor> parentClassByName;
+  private final Multimap<String, AnnotatedClassDescriptor> annotationsByName;
+
+  @JsonCreator public ScanResult(
+      @JsonProperty("scannedPackages") Collection<String> scannedPackages,
+      @JsonProperty("scannedClasses") Collection<String> scannedClasses,
+      @JsonProperty("scannedAnnotations") Collection<String> scannedAnnotations,
+      @JsonProperty("annotatedClasses") Collection<AnnotatedClassDescriptor> annotatedClasses,
+      @JsonProperty("implementations") Collection<ParentClassDescriptor> implementations) {
+    this.scannedPackages = unmodifiableList(new ArrayList<>(checkNotNull(scannedPackages)));
+    this.scannedClasses = unmodifiableSet(new HashSet<>(checkNotNull(scannedClasses)));
+    this.scannedAnnotations = unmodifiableSet(new HashSet<>(checkNotNull(scannedAnnotations)));
+    this.annotatedClasses = unmodifiableList(new ArrayList<>(checkNotNull(annotatedClasses)));
+    this.implementations = unmodifiableList(new ArrayList<>(checkNotNull(implementations)));
+    this.parentClassByName = new HashMap<>();
+    for (ParentClassDescriptor parentClassDescriptor : implementations) {
+      this.parentClassByName.put(parentClassDescriptor.getName(), parentClassDescriptor);
+    }
+    this.annotationsByName = HashMultimap.create();
+    for (AnnotatedClassDescriptor annotated : annotatedClasses) {
+      for (AnnotationDescriptor annotationDescriptor : annotated.getAnnotations()) {
+        if (scannedAnnotations.contains(annotationDescriptor.getAnnotationType())) {
+          this.annotationsByName.put(annotationDescriptor.getAnnotationType(), annotated);
+        }
+      }
+    }
+  }
+
+  /**
+   * @return packages that were scanned as defined in the drill configs
+   */
+  public List<String> getScannedPackages() {
+    return scannedPackages;
+  }
+
+  /**
+   * @return functions annotated with configured annotations
+   */
+  public List<AnnotatedClassDescriptor> getAnnotatedClasses() {
+    return annotatedClasses;
+  }
+
+  /**
+   * @return list of implementations per parent class
+   */
+  public List<ParentClassDescriptor> getImplementations() {
+    return implementations;
+  }
+
+  public Set<String> getScannedClasses() {
+    return scannedClasses;
+  }
+
+  public Set<String> getScannedAnnotations() {
+    return scannedAnnotations;
+  }
+
+  /**
+   * @param c the parent class name
+   * @return the descriptor for the implementations found
+   */
+  public ParentClassDescriptor getImplementations(String c) {
+    if (!scannedClasses.contains(c)) {
+      throw new IllegalArgumentException(
+          c + " is not scanned. "
+              + "Only implementations for the following classes are scanned: "
+              + scannedClasses);
+    }
+    return parentClassByName.get(c);
+  }
+
+  /**
+   * This will load all the scanned classes for this parent as a side effect
+   * @param c the parent
+   * @return all the classes found
+   */
+  public <T> Set<Class<? extends T>> getImplementations(Class<T> c) {
+    ParentClassDescriptor p = getImplementations(c.getName());
+    Stopwatch watch = new Stopwatch().start();
+    Set<Class<? extends T>> result = new HashSet<>();
+    try {
+      if (p != null) {
+        for (ChildClassDescriptor child : p.getChildren()) {
+          if (!child.isAbstract()) {
+            try {
+              result.add(Class.forName(child.getName()).asSubclass(c));
+            } catch (ClassNotFoundException e) {
+              throw new DrillRuntimeException("scanned class could not be found: " + child.getName(), e);
+            }
+          }
+        }
+      }
+      return result;
+    } finally {
+      logger.info(
+          format("loading %d classes for %s took %dms",
+              result.size(), c.getName(), watch.elapsed(MILLISECONDS)));
+    }
+  }
+
+
+  /**
+   * @param c the annotation class name
+   * @return the descriptor of the annotated class
+   */
+  public List<AnnotatedClassDescriptor> getAnnotatedClasses(String c) {
+    if (!scannedAnnotations.contains(c)) {
+      throw new IllegalArgumentException(
+          c + " is not scanned. "
+              + "Only the following Annotations are scanned: "
+              + scannedAnnotations);
+    }
+    return new ArrayList<>(annotationsByName.get(c));
+  }
+
+  @Override
+  public String toString() {
+    return "ScanResult ["
+        + "scannedPackages=" + scannedPackages + ", "
+        + "scannedClasses=" + scannedClasses + ", "
+        + "scannedAnnotations=" + scannedAnnotations + ", "
+        + "annotatedClasses=" + annotatedClasses + ", "
+        + "implementations=" + implementations + "]";
+  }
+
+  private <T> List<T> merge(Collection<T> a, Collection<T> b) {
+    final List<T> newList = new ArrayList<>(a);
+    newList.addAll(b);
+    return newList;
+  }
+
+  /**
+   * merges this and other together into a new result object
+   * @param other
+   * @return the resulting merge
+   */
+  public ScanResult merge(ScanResult other) {
+    final Multimap<String, ChildClassDescriptor> newImpls = HashMultimap.create();
+    for (Collection<ParentClassDescriptor> impls : asList(implementations, other.implementations)) {
+      for (ParentClassDescriptor c : impls) {
+        newImpls.putAll(c.getName(), c.getChildren());
+      }
+    }
+    List<ParentClassDescriptor> newImplementations = new ArrayList<>();
+    for (Entry<String, Collection<ChildClassDescriptor>> entry : newImpls.asMap().entrySet()) {
+      newImplementations.add(new ParentClassDescriptor(entry.getKey(), new ArrayList<>(entry.getValue())));
+    }
+
+    return new ScanResult(
+        merge(scannedPackages, other.scannedPackages),
+        merge(scannedClasses, other.scannedClasses),
+        merge(scannedAnnotations, other.scannedAnnotations),
+        merge(annotatedClasses, other.annotatedClasses),
+        newImplementations);
+  }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/common/src/main/java/org/apache/drill/common/scanner/persistence/TypeDescriptor.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/scanner/persistence/TypeDescriptor.java b/common/src/main/java/org/apache/drill/common/scanner/persistence/TypeDescriptor.java
new file mode 100644
index 0000000..f144cca
--- /dev/null
+++ b/common/src/main/java/org/apache/drill/common/scanner/persistence/TypeDescriptor.java
@@ -0,0 +1,115 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.common.scanner.persistence;
+
+import static java.lang.String.format;
+
+import org.apache.drill.common.exceptions.DrillRuntimeException;
+
+/**
+ * represents the type of a field
+ */
+public abstract class TypeDescriptor {
+
+  private final boolean primitive;
+  private final int arrayDim;
+
+  TypeDescriptor(boolean primitive, int arrayDim) {
+    this.primitive = primitive;
+    this.arrayDim = arrayDim;
+  }
+
+  public boolean isPrimitive() {
+    return primitive;
+  }
+
+  public boolean isArray() {
+    return arrayDim > 0;
+  }
+
+  /**
+   * @return the number of dimensions of the array or 0 if it's not an array
+   */
+  public int getArrayDim() {
+    return arrayDim;
+  }
+
+  /**
+   * @return the type (element type if an array)
+   */
+  public abstract Class<?> getType();
+
+  private static final class PrimitiveTypeDescriptor extends TypeDescriptor {
+    private final Class<?> type;
+
+    private static Class<?> getPrimitiveType(char descriptor) {
+      switch (descriptor) {
+      case 'V': return void.class;
+      case 'I': return int.class;
+      case 'B': return byte.class;
+      case 'J': return long.class;
+      case 'D': return double.class;
+      case 'F': return float.class;
+      case 'C': return char.class;
+      case 'S': return short.class;
+      case 'Z': return boolean.class;
+      default: throw new DrillRuntimeException("bad descriptor: " + descriptor);
+      }
+    }
+
+    private PrimitiveTypeDescriptor(char typeDescriptor, int arrayDepth) {
+      super(true, arrayDepth);
+      this.type = getPrimitiveType(typeDescriptor);
+    }
+
+    @Override
+    public Class<?> getType() {
+      return this.type;
+    }
+  }
+
+  private static final class ClassTypeDescriptor extends TypeDescriptor {
+    private String className;
+
+    private ClassTypeDescriptor(String className, int arrayDim) {
+      super(false, arrayDim);
+      this.className = className;
+    }
+
+    @Override
+    public Class<?> getType() {
+      try {
+        return Class.forName(className);
+      } catch (ClassNotFoundException e) {
+        throw new DrillRuntimeException(
+            format(
+                "Unexpected class load failure while attempting to load Function Registry (%s)",
+                className),
+            e);
+      }
+    }
+  }
+
+  public static TypeDescriptor forClass(String className, int arrayDim) {
+    return new ClassTypeDescriptor(className, arrayDim);
+  }
+
+  public static TypeDescriptor forPrimitive(char c, int arrayDim) {
+    return new PrimitiveTypeDescriptor(c, arrayDim);
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/common/src/main/java/org/apache/drill/common/util/PathScanner.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/util/PathScanner.java b/common/src/main/java/org/apache/drill/common/util/PathScanner.java
deleted file mode 100644
index 65bf9b5..0000000
--- a/common/src/main/java/org/apache/drill/common/util/PathScanner.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.drill.common.util;
-
-import java.io.IOException;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Modifier;
-import java.net.URL;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.drill.common.config.CommonConstants;
-import org.reflections.Reflections;
-import org.reflections.scanners.ResourcesScanner;
-import org.reflections.scanners.SubTypesScanner;
-import org.reflections.scanners.TypeAnnotationsScanner;
-import org.reflections.util.ConfigurationBuilder;
-
-import com.google.common.base.Stopwatch;
-import com.google.common.collect.Sets;
-
-public class PathScanner {
-  private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(PathScanner.class);
-
-  private static final SubTypesScanner subTypeScanner = new SubTypesScanner();
-  private static final TypeAnnotationsScanner annotationsScanner = new TypeAnnotationsScanner();
-  private static final ResourcesScanner resourcesScanner = new ResourcesScanner();
-  private static final Object SYNC = new Object();
-  static volatile Reflections REFLECTIONS = null;
-
-  public static <A extends Annotation, T> Map<A, Class<? extends T>> scanForAnnotatedImplementations(
-      Class<A> annotationClass, Class<T> baseClass, final List<String> scanPackages) {
-    final Collection<Class<? extends T>> providerClasses =
-        scanForImplementations(baseClass, scanPackages);
-
-    final Map<A, Class<? extends T>> map = new HashMap<A, Class<? extends T>>();
-
-    for (Class<? extends T> c : providerClasses) {
-      final A annotation = (A) c.getAnnotation(annotationClass);
-      if (annotation == null) {
-        continue;
-      }
-      map.put(annotation, c);
-    }
-
-    return map;
-  }
-
-  private static Reflections getReflections() {
-    if (REFLECTIONS == null) {
-      REFLECTIONS =
-          new Reflections(
-              new ConfigurationBuilder()
-                  .setUrls(getMarkedPaths())
-                  .setScanners(subTypeScanner, annotationsScanner, resourcesScanner));
-    }
-    return REFLECTIONS;
-  }
-
-  /**
-   * @param  scanPackages  note:  not currently used
-   */
-  public static <T> Class<?>[] scanForImplementationsArr(final Class<T> baseClass,
-                                                         final List<String> scanPackages) {
-    Collection<Class<? extends T>> imps = scanForImplementations(baseClass, scanPackages);
-    Class<?>[] arr = imps.toArray(new Class<?>[imps.size()]);
-    return arr;
-  }
-
-  /**
-   * @param  scanPackages  note:  not currently used
-   */
-  public static <T> Set<Class<? extends T>> scanForImplementations(final Class<T> baseClass,
-                                                                   final List<String> scanPackages) {
-    final Stopwatch w = new Stopwatch().start();
-    try {
-      synchronized(SYNC) {
-        final Set<Class<? extends T>> classes = getReflections().getSubTypesOf(baseClass);
-        for (Iterator<Class<? extends T>> i = classes.iterator(); i.hasNext();) {
-          final Class<? extends T> c = i.next();
-          assert baseClass.isAssignableFrom(c);
-          if (Modifier.isAbstract(c.getModifiers())) {
-            i.remove();
-          }
-        }
-        return classes;
-      }
-    } finally {
-      logger.debug("Implementations scanning took {} ms for {}.",
-                   w.elapsed(TimeUnit.MILLISECONDS),
-                   baseClass); // no .getName(), so it has "class "/"interface "
-    }
-  }
-
-  private static Collection<URL> getMarkedPaths() {
-    Collection<URL> urls =
-        forResource(CommonConstants.DRILL_JAR_MARKER_FILE_RESOURCE_PATHNAME, true);
-    return urls;
-  }
-
-  public static Collection<URL> getConfigURLs() {
-    return forResource(CommonConstants.DRILL_JAR_MARKER_FILE_RESOURCE_PATHNAME, false);
-  }
-
-  /**
-   * Gets URLs of any classpath resources with given resource pathname.
-   *
-   * @param  resourcePathname  resource pathname of classpath resource instances
-   *           to scan for (relative to specified class loaders' classpath roots)
-   * @param  returnRootPathname  whether to collect classpath root portion of
-   *           URL for each resource instead of full URL of each resource
-   * @param  classLoaders  not currently used (was: "set of class loaders in
-   *           which to look up resource; none (empty array) to specify to use
-   *           current thread's context class loader and {@link Reflections}'s
-   *           class loader")
-   * @returns  ...; empty set if none
-   */
-  public static Set<URL> forResource(final String resourcePathname,
-                                     final boolean returnRootPathname,
-                                     final ClassLoader... classLoaders) {
-    logger.debug("Scanning classpath for resources with pathname \"{}\".",
-                 resourcePathname);
-    final Set<URL> resultUrlSet = Sets.newHashSet();
-
-    final ClassLoader classLoader = PathScanner.class.getClassLoader();
-    try {
-      final Enumeration<URL> resourceUrls =
-          classLoader.getResources(resourcePathname);
-      while (resourceUrls.hasMoreElements()) {
-        final URL resourceUrl = resourceUrls.nextElement();
-        logger.trace("- found a(n) {} at {}.", resourcePathname, resourceUrl);
-
-        int index = resourceUrl.toExternalForm().lastIndexOf(resourcePathname);
-        if (index != -1 && returnRootPathname) {
-          final URL classpathRootUrl =
-              new URL(resourceUrl.toExternalForm().substring(0, index));
-          resultUrlSet.add(classpathRootUrl);
-          logger.debug("- collected resource's classpath root URL {}.",
-              classpathRootUrl);
-        } else {
-          resultUrlSet.add(resourceUrl);
-          logger.debug("- collected resource URL {}.", resourceUrl);
-        }
-      }
-    } catch (IOException e) {
-      if (Reflections.log != null) {
-        Reflections.log.error(
-            "Error scanning for resources named " + resourcePathname, e);
-      }
-    }
-
-    return resultUrlSet;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/common/src/main/resources/drill-module.conf
----------------------------------------------------------------------
diff --git a/common/src/main/resources/drill-module.conf b/common/src/main/resources/drill-module.conf
index c01939c..f8226f8 100644
--- a/common/src/main/resources/drill-module.conf
+++ b/common/src/main/resources/drill-module.conf
@@ -17,4 +17,17 @@
 //  This file tells Drill to consider this module when class path scanning.
 //  This file can also include any supplementary configuration information.
 //  This file is in HOCON format, see https://github.com/typesafehub/config/blob/master/HOCON.md for more information.
-drill.exec.storage.packages += org.apache.drill.exec.store.mock
+drill {
+  classpath.scanning {
+    base.classes : ${?drill.classpath.scanning.base.classes} [
+      org.apache.drill.common.logical.data.LogicalOperator,
+      org.apache.drill.common.logical.FormatPluginConfig,
+      org.apache.drill.common.logical.StoragePluginConfig
+    ],
+
+    packages : ${?drill.classpath.scanning.packages} [
+      org.apache.drill.exec.store.mock,
+      org.apache.drill.common.logical
+    ]
+  }
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/common/src/test/java/org/apache/drill/storage/CheckStorageConfig.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/drill/storage/CheckStorageConfig.java b/common/src/test/java/org/apache/drill/storage/CheckStorageConfig.java
index a3a8257..090b8f4 100644
--- a/common/src/test/java/org/apache/drill/storage/CheckStorageConfig.java
+++ b/common/src/test/java/org/apache/drill/storage/CheckStorageConfig.java
@@ -22,26 +22,30 @@ import static org.junit.Assert.assertEquals;
 import java.util.Collection;
 
 import org.apache.drill.common.config.DrillConfig;
+import org.apache.drill.common.config.LogicalPlanPersistence;
 import org.apache.drill.common.logical.LogicalPlan;
 import org.apache.drill.common.logical.StoragePluginConfig;
+import org.apache.drill.common.scanner.ClassPathScanner;
+import org.apache.drill.common.scanner.persistence.ScanResult;
 import org.apache.drill.common.util.FileUtils;
-import org.apache.drill.common.util.PathScanner;
 import org.apache.drill.test.DrillTest;
 import org.junit.Test;
 
-import com.google.common.collect.Lists;
-
 public class CheckStorageConfig extends DrillTest {
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(CheckStorageConfig.class);
 
   @Test
   public void ensureStorageEnginePickup() {
-    Collection<?> engines = PathScanner.scanForImplementations(StoragePluginConfig.class, Lists.newArrayList("org"));
+    DrillConfig config = DrillConfig.create();
+    ScanResult scan = ClassPathScanner.fromPrescan(config);
+    Collection<?> engines = scan.getImplementations(StoragePluginConfig.class);
     assertEquals(engines.size(), 1);
   }
 
   @Test
   public void checkPlanParsing() throws Exception{
-    LogicalPlan plan = LogicalPlan.parse(DrillConfig.create(), FileUtils.getResourceAsString("/storage_engine_plan.json"));
+    DrillConfig config = DrillConfig.create();
+    ScanResult scan = ClassPathScanner.fromPrescan(config);
+    LogicalPlan plan = LogicalPlan.parse(new LogicalPlanPersistence(config, scan), FileUtils.getResourceAsString("/storage_engine_plan.json"));
   }
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/common/src/test/resources/drill-module.conf
----------------------------------------------------------------------
diff --git a/common/src/test/resources/drill-module.conf b/common/src/test/resources/drill-module.conf
index 5b9605a..4236559 100644
--- a/common/src/test/resources/drill-module.conf
+++ b/common/src/test/resources/drill-module.conf
@@ -14,4 +14,4 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-drill.logical.storage.packages += "org.apache.drill.storage"
+drill.classpath.scanning.packages += "org.apache.drill.storage"

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/contrib/storage-hbase/src/main/resources/drill-module.conf
----------------------------------------------------------------------
diff --git a/contrib/storage-hbase/src/main/resources/drill-module.conf b/contrib/storage-hbase/src/main/resources/drill-module.conf
index 0f0a0c6..150a3bb 100644
--- a/contrib/storage-hbase/src/main/resources/drill-module.conf
+++ b/contrib/storage-hbase/src/main/resources/drill-module.conf
@@ -17,7 +17,13 @@
 //  This file can also include any supplementary configuration information.
 //  This file is in HOCON format, see https://github.com/typesafehub/config/blob/master/HOCON.md for more information.
 
-drill.exec: {
+drill: {
+  classpath.scanning: {
+    packages += "org.apache.drill.exec.store.hbase"
+    packages += "org.apache.drill.exec.expr.fn.impl.conv"
+  }
+
+  exec: {
 
   sys.store.provider: {
     # HBasePStoreProvider is disabled by default
@@ -35,4 +41,5 @@ drill.exec: {
     samplerows.count: 100,
     sizecalculator.enabled: true
   }
+  }
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseTableProvider.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseTableProvider.java b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseTableProvider.java
index 5f2d6c7..9ff1b08 100644
--- a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseTableProvider.java
+++ b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseTableProvider.java
@@ -22,6 +22,8 @@ import static org.junit.Assert.assertEquals;
 import java.io.IOException;
 import java.util.Map.Entry;
 
+import org.apache.drill.common.config.LogicalPlanPersistence;
+import org.apache.drill.exec.planner.PhysicalPlanReaderTestFactory;
 import org.apache.drill.exec.store.hbase.config.HBasePStoreProvider;
 import org.apache.drill.exec.store.sys.PStore;
 import org.apache.drill.exec.store.sys.PStoreConfig;
@@ -41,7 +43,8 @@ public class TestHBaseTableProvider extends BaseHBaseTest {
 
   @Test
   public void testTableProvider() throws IOException {
-    PStore<String> hbaseStore = provider.getStore(PStoreConfig.newJacksonBuilder(config.getMapper(), String.class).name("hbase").build());
+    LogicalPlanPersistence lp = PhysicalPlanReaderTestFactory.defaultLogicalPlanPersistence(config);
+    PStore<String> hbaseStore = provider.getStore(PStoreConfig.newJacksonBuilder(lp.getMapper(), String.class).name("hbase").build());
     hbaseStore.put("", "v0");
     hbaseStore.put("k1", "v1");
     hbaseStore.put("k2", "v2");
@@ -60,7 +63,7 @@ public class TestHBaseTableProvider extends BaseHBaseTest {
     }
     assertEquals(7, rowCount);
 
-    PStore<String> hbaseTestStore = provider.getStore(PStoreConfig.newJacksonBuilder(config.getMapper(), String.class).name("hbase.test").build());
+    PStore<String> hbaseTestStore = provider.getStore(PStoreConfig.newJacksonBuilder(lp.getMapper(), String.class).name("hbase.test").build());
     hbaseTestStore.put("", "v0");
     hbaseTestStore.put("k1", "v1");
     hbaseTestStore.put("k2", "v2");

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/contrib/storage-hive/core/pom.xml
----------------------------------------------------------------------
diff --git a/contrib/storage-hive/core/pom.xml b/contrib/storage-hive/core/pom.xml
index 124c222..f083507 100644
--- a/contrib/storage-hive/core/pom.xml
+++ b/contrib/storage-hive/core/pom.xml
@@ -104,9 +104,9 @@
   <build>
     <plugins>
       <plugin>
-        <groupId>com.googlecode.fmpp-maven-plugin</groupId>
-        <artifactId>fmpp-maven-plugin</artifactId>
-        <version>1.0</version>
+        <groupId>org.apache.drill.tools</groupId>
+        <artifactId>drill-fmpp-maven-plugin</artifactId>
+        <version>${project.version}</version>
         <dependencies>
           <dependency>
             <groupId>org.freemarker</groupId>
@@ -114,36 +114,17 @@
             <version>2.3.19</version>
           </dependency>
         </dependencies>
-        <configuration>
-          <cfgFile>src/main/codegen/config.fmpp</cfgFile>
-          <outputDirectory>target/generated-sources</outputDirectory>
-          <templateDirectory>src/main/codegen/templates</templateDirectory>
-        </configuration>
         <executions>
           <execution>
             <id>generate-fmpp-sources</id>
-            <phase>initialize</phase>
+            <phase>generate-sources</phase>
             <goals>
               <goal>generate</goal>
             </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>build-helper-maven-plugin</artifactId>
-        <version>1.5</version>
-        <executions>
-          <execution>
-            <id>add-fmpp-sources</id>
-            <phase>validate</phase>
-            <goals>
-              <goal>add-source</goal>
-            </goals>
             <configuration>
-              <sources>
-                <source>${project.build.directory}/generated-sources</source>
-              </sources>
+              <config>src/main/codegen/config.fmpp</config>
+              <output>${project.build.directory}/generated-sources</output>
+              <templates>src/main/codegen/templates</templates>
             </configuration>
           </execution>
         </executions>

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/expr/fn/HiveFunctionRegistry.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/expr/fn/HiveFunctionRegistry.java b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/expr/fn/HiveFunctionRegistry.java
index 13fb107..728954d 100644
--- a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/expr/fn/HiveFunctionRegistry.java
+++ b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/expr/fn/HiveFunctionRegistry.java
@@ -22,10 +22,11 @@ import java.util.Set;
 
 import org.apache.drill.common.config.DrillConfig;
 import org.apache.drill.common.expression.FunctionCall;
+import org.apache.drill.common.scanner.ClassPathScanner;
+import org.apache.drill.common.scanner.persistence.ScanResult;
 import org.apache.drill.common.types.TypeProtos.MajorType;
 import org.apache.drill.common.types.TypeProtos.MinorType;
 import org.apache.drill.common.types.Types;
-import org.apache.drill.common.util.PathScanner;
 import org.apache.drill.exec.expr.fn.impl.hive.ObjectInspectorHelper;
 import org.apache.drill.exec.planner.sql.DrillOperatorTable;
 import org.apache.drill.exec.planner.sql.HiveUDFOperator;
@@ -53,12 +54,14 @@ public class HiveFunctionRegistry implements PluggableFunctionRegistry{
    * @param config
    */
   public HiveFunctionRegistry(DrillConfig config) {
-    Set<Class<? extends GenericUDF>> genericUDFClasses = PathScanner.scanForImplementations(GenericUDF.class, null);
+    // TODO: see if we can avoid this. We can't change the constructor right now.
+    ScanResult classpathScan = ClassPathScanner.fromPrescan(config);
+    Set<Class<? extends GenericUDF>> genericUDFClasses = classpathScan.getImplementations(GenericUDF.class);
     for (Class<? extends GenericUDF> clazz : genericUDFClasses) {
       register(clazz, methodsGenericUDF);
     }
 
-    Set<Class<? extends UDF>> udfClasses = PathScanner.scanForImplementations(UDF.class, null);
+    Set<Class<? extends UDF>> udfClasses = classpathScan.getImplementations(UDF.class);
     for (Class<? extends UDF> clazz : udfClasses) {
       register(clazz, methodsUDF);
     }

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/contrib/storage-hive/core/src/main/resources/drill-module.conf
----------------------------------------------------------------------
diff --git a/contrib/storage-hive/core/src/main/resources/drill-module.conf b/contrib/storage-hive/core/src/main/resources/drill-module.conf
index 271395e..bef453b 100644
--- a/contrib/storage-hive/core/src/main/resources/drill-module.conf
+++ b/contrib/storage-hive/core/src/main/resources/drill-module.conf
@@ -2,4 +2,16 @@
 //  This file can also include any supplementary configuration information.
 //  This file is in HOCON format, see https://github.com/typesafehub/config/blob/master/HOCON.md for more information.
 
-drill.logical.function.packages += "org.apache.hadoop.hive"
+drill {
+  classpath.scanning {
+    base.classes : ${?drill.classpath.scanning.base.classes} [
+      org.apache.hadoop.hive.ql.udf.generic.GenericUDF,
+      org.apache.hadoop.hive.ql.exec.UDF
+    ],
+
+    packages : ${?drill.classpath.scanning.packages} [
+      org.apache.hadoop.hive,
+      org.apache.drill.exec.fn.hive
+    ]
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/contrib/storage-hive/core/src/test/resources/drill-module.conf
----------------------------------------------------------------------
diff --git a/contrib/storage-hive/core/src/test/resources/drill-module.conf b/contrib/storage-hive/core/src/test/resources/drill-module.conf
index 271395e..7451eae 100644
--- a/contrib/storage-hive/core/src/test/resources/drill-module.conf
+++ b/contrib/storage-hive/core/src/test/resources/drill-module.conf
@@ -2,4 +2,4 @@
 //  This file can also include any supplementary configuration information.
 //  This file is in HOCON format, see https://github.com/typesafehub/config/blob/master/HOCON.md for more information.
 
-drill.logical.function.packages += "org.apache.hadoop.hive"
+drill.classpath.scanning.packages += "org.apache.hadoop.hive"

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/contrib/storage-hive/hive-exec-shade/src/main/resources/drill-module.conf
----------------------------------------------------------------------
diff --git a/contrib/storage-hive/hive-exec-shade/src/main/resources/drill-module.conf b/contrib/storage-hive/hive-exec-shade/src/main/resources/drill-module.conf
index 271395e..7451eae 100644
--- a/contrib/storage-hive/hive-exec-shade/src/main/resources/drill-module.conf
+++ b/contrib/storage-hive/hive-exec-shade/src/main/resources/drill-module.conf
@@ -2,4 +2,4 @@
 //  This file can also include any supplementary configuration information.
 //  This file is in HOCON format, see https://github.com/typesafehub/config/blob/master/HOCON.md for more information.
 
-drill.logical.function.packages += "org.apache.hadoop.hive"
+drill.classpath.scanning.packages += "org.apache.hadoop.hive"

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/contrib/storage-jdbc/src/main/resources/drill-module.conf
----------------------------------------------------------------------
diff --git a/contrib/storage-jdbc/src/main/resources/drill-module.conf b/contrib/storage-jdbc/src/main/resources/drill-module.conf
index 721a599..0f98d05 100755
--- a/contrib/storage-jdbc/src/main/resources/drill-module.conf
+++ b/contrib/storage-jdbc/src/main/resources/drill-module.conf
@@ -16,3 +16,6 @@
 //  This file tells Drill to consider this module when class path scanning.
 //  This file can also include any supplementary configuration information.
 //  This file is in HOCON format, see https://github.com/typesafehub/config/blob/master/HOCON.md for more information.
+drill.classpath.scanning: {
+  packages += "org.apache.drill.exec.store.jdbc"
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/contrib/storage-mongo/src/main/resources/drill-module.conf
----------------------------------------------------------------------
diff --git a/contrib/storage-mongo/src/main/resources/drill-module.conf b/contrib/storage-mongo/src/main/resources/drill-module.conf
index d44d3e4..81490f0 100644
--- a/contrib/storage-mongo/src/main/resources/drill-module.conf
+++ b/contrib/storage-mongo/src/main/resources/drill-module.conf
@@ -16,7 +16,9 @@
 //  This file tells Drill to consider this module when class path scanning.
 //  This file can also include any supplementary configuration information.
 //  This file is in HOCON format, see https://github.com/typesafehub/config/blob/master/HOCON.md for more information.
-
+drill.classpath.scanning: {
+  packages += "org.apache.drill.exec.store.mongo"
+}
 drill.exec: {
 
   sys.store.provider: {
@@ -25,4 +27,4 @@ drill.exec: {
     }
   }
 
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/contrib/storage-mongo/src/test/java/org/apache/drill/exec/store/mongo/MongoTestConstants.java
----------------------------------------------------------------------
diff --git a/contrib/storage-mongo/src/test/java/org/apache/drill/exec/store/mongo/MongoTestConstants.java b/contrib/storage-mongo/src/test/java/org/apache/drill/exec/store/mongo/MongoTestConstants.java
index d050961..809fb75 100644
--- a/contrib/storage-mongo/src/test/java/org/apache/drill/exec/store/mongo/MongoTestConstants.java
+++ b/contrib/storage-mongo/src/test/java/org/apache/drill/exec/store/mongo/MongoTestConstants.java
@@ -20,6 +20,7 @@ package org.apache.drill.exec.store.mongo;
 public interface MongoTestConstants {
 
   public static final String LOCALHOST = "localhost";
+  // TODO: DRILL-3934: add some randomization to this as it fails when running concurrent builds
   public static final int CONFIG_SERVER_PORT = 27019;
   public static final int MONGOD_1_PORT = 27020;
   public static final int MONGOD_2_PORT = 27021;

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/exec/java-exec/pom.xml
----------------------------------------------------------------------
diff --git a/exec/java-exec/pom.xml b/exec/java-exec/pom.xml
index fec9ca7..2079921 100644
--- a/exec/java-exec/pom.xml
+++ b/exec/java-exec/pom.xml
@@ -470,12 +470,10 @@
       <plugin>
         <artifactId>maven-resources-plugin</artifactId>
         <executions>
-          <execution>
+          <execution> <!-- copy all templates in the same location to compile them at once -->
             <id>copy-fmpp-resources</id>
             <phase>initialize</phase>
-            <goals>
-              <goal>copy-resources</goal>
-            </goals>
+            <goals><goal>copy-resources</goal></goals>
             <configuration>
               <outputDirectory>${project.build.directory}/codegen</outputDirectory>
               <resources>
@@ -486,36 +484,11 @@
               </resources>
             </configuration>
           </execution>
-          <execution>
-            <id>copy-java-sources</id>
-            <phase>process-sources</phase>
-            <goals>
-              <goal>copy-resources</goal>
-            </goals>
-            <configuration>
-              <outputDirectory>${basedir}/target/classes/</outputDirectory>
-              <resources>
-                <resource>
-                  <directory>src/main/java</directory>
-                  <filtering>true</filtering>
-                </resource>
-                <resource>
-                  <directory>src/test/java</directory>
-                  <filtering>true</filtering>
-                </resource>
-                <resource>
-                  <directory>target/generated-sources</directory>
-                  <!-- <include>*/org</include> -->
-                  <filtering>true</filtering>
-                </resource>
-              </resources>
-            </configuration>
-          </execution>
         </executions>
       </plugin>
       <plugin>
         <!-- Extract parser grammar template from calcite-core.jar and put 
-          it under ${project.build.directory} where all freemarker templates are. -->
+          it under ${project.build.directory}/codegen/templates where all freemarker templates are. -->
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-dependency-plugin</artifactId>
         <version>2.8</version>
@@ -534,17 +507,17 @@
                   <type>jar</type>
                   <overWrite>true</overWrite>
                   <outputDirectory>${project.build.directory}/</outputDirectory>
-                  <includes>**/Parser.jj</includes>
+                  <includes>codegen/templates/Parser.jj</includes>
                 </artifactItem>
               </artifactItems>
             </configuration>
           </execution>
         </executions>
       </plugin>
-      <plugin>
-        <groupId>com.googlecode.fmpp-maven-plugin</groupId>
-        <artifactId>fmpp-maven-plugin</artifactId>
-        <version>1.0</version>
+      <plugin> <!-- generate sources from fmpp -->
+        <groupId>org.apache.drill.tools</groupId>
+        <artifactId>drill-fmpp-maven-plugin</artifactId>
+        <version>${project.version}</version>
         <dependencies>
           <dependency>
             <groupId>org.freemarker</groupId>
@@ -554,49 +527,26 @@
         </dependencies>
         <executions>
           <execution>
-            <id>generate-fmpp-sources</id>
+            <id>generate-fmpp</id>
             <phase>generate-sources</phase>
-            <goals>
-              <goal>generate</goal>
-            </goals>
+            <goals><goal>generate</goal></goals>
             <configuration>
-              <cfgFile>${project.build.directory}/codegen/config.fmpp</cfgFile>
-              <outputDirectory>target/generated-sources</outputDirectory>
-              <templateDirectory>${project.build.directory}/codegen/templates</templateDirectory>
+              <config>src/main/codegen/config.fmpp</config>
+              <output>${project.build.directory}/generated-sources</output>
+              <templates>${project.build.directory}/codegen/templates</templates>
             </configuration>
           </execution>
         </executions>
       </plugin>
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>build-helper-maven-plugin</artifactId>
-        <version>1.5</version>
-        <executions>
-          <execution>
-            <id>add-generated-sources</id>
-            <phase>process-sources</phase>
-            <goals>
-              <goal>add-source</goal>
-            </goals>
-            <configuration>
-              <sources>
-                <source>${project.build.directory}/generated-sources</source>
-              </sources>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
+      <plugin> <!-- generate the parser (Parser.jj is itself generated wit fmpp above) -->
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>javacc-maven-plugin</artifactId>
         <version>2.4</version>
         <executions>
           <execution>
-            <phase>generate-sources</phase>
             <id>javacc</id>
-            <goals>
-              <goal>javacc</goal>
-            </goals>
+            <phase>generate-sources</phase>
+            <goals><goal>javacc</goal></goals>
             <configuration>
               <sourceDirectory>${project.build.directory}/generated-sources/</sourceDirectory>
               <includes>
@@ -609,6 +559,70 @@
           </execution>
         </executions>
       </plugin>
+      <plugin> <!-- source file must end up in the jar for janino parsing -->
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <version>1.9.1</version>
+        <executions>
+          <execution>
+            <id>add-sources-as-resources</id>
+            <phase>process-sources</phase>
+            <goals>
+              <goal>add-resource</goal>
+            </goals>
+            <configuration>
+              <resources>
+                <resource>
+                  <directory>src/main/java</directory>
+                </resource>
+                <resource>
+                  <directory>${project.build.directory}/generated-sources</directory>
+                </resource>
+              </resources>
+            </configuration>
+          </execution>
+          <execution>
+            <id>add-test-sources-as-resources</id>
+            <phase>process-test-sources</phase>
+            <goals>
+              <goal>add-test-resource</goal>
+            </goals>
+            <configuration>
+              <resources>
+                <resource>
+                  <directory>src/test/java</directory>
+                </resource>
+              </resources>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin> <!-- classpath scanning  -->
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <version>1.2.1</version>
+        <dependencies>
+          <dependency>
+            <groupId>org.apache.drill</groupId>
+            <artifactId>drill-common</artifactId>
+            <version>${project.version}</version>
+            <classifier>tests</classifier>
+          </dependency>
+        </dependencies>
+        <executions>
+          <execution>
+            <phase>process-classes</phase>
+            <goals><goal>java</goal></goals>
+          </execution>
+        </executions>
+        <configuration>
+          <mainClass>org.apache.drill.common.scanner.BuildTimeScan</mainClass>
+          <includePluginDependencies>true</includePluginDependencies>
+          <arguments>
+            <argument>${project.build.outputDirectory}</argument>
+          </arguments>
+        </configuration>
+      </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
@@ -619,9 +633,7 @@
               in a different profile -->
             <id>default-test</id>
             <phase>test</phase>
-            <goals>
-              <goal>test</goal>
-            </goals>
+            <goals><goal>test</goal></goals>
             <configuration>
               <excludes>
                 <exclude>**/TestLargeFileCompilation.java</exclude>
@@ -644,8 +656,8 @@
               <pluginExecutions>
                 <pluginExecution>
                   <pluginExecutionFilter>
-                    <groupId>com.googlecode.fmpp-maven-plugin</groupId>
-                    <artifactId>fmpp-maven-plugin</artifactId>
+                    <groupId>org.apache.drill.tools</groupId>
+                    <artifactId>drill-fmpp-maven-plugin</artifactId>
                     <versionRange>[1.0,)</versionRange>
                     <goals>
                       <goal>generate</goal>

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/exec/java-exec/src/main/java/org/apache/drill/exec/ExecConstants.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/ExecConstants.java b/exec/java-exec/src/main/java/org/apache/drill/exec/ExecConstants.java
index c9554af..db7f68d 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/ExecConstants.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/ExecConstants.java
@@ -42,14 +42,12 @@ public interface ExecConstants {
   public static final String BIT_RETRY_TIMES = "drill.exec.rpc.bit.server.retry.count";
   public static final String BIT_RETRY_DELAY = "drill.exec.rpc.bit.server.retry.delay";
   public static final String BIT_TIMEOUT = "drill.exec.bit.timeout" ;
-  public static final String STORAGE_ENGINE_SCAN_PACKAGES = "drill.exec.storage.packages";
   public static final String SERVICE_NAME = "drill.exec.cluster-id";
   public static final String INITIAL_BIT_PORT = "drill.exec.rpc.bit.server.port";
   public static final String BIT_RPC_TIMEOUT = "drill.exec.rpc.bit.timeout";
   public static final String INITIAL_USER_PORT = "drill.exec.rpc.user.server.port";
   public static final String USER_RPC_TIMEOUT = "drill.exec.rpc.user.timeout";
   public static final String METRICS_CONTEXT_NAME = "drill.exec.metrics.context";
-  public static final String FUNCTION_PACKAGES = "drill.exec.functions";
   public static final String USE_IP_ADDRESS = "drill.exec.rpc.use.ip";
   public static final String METRICS_JMX_OUTPUT_ENABLED = "drill.exec.metrics.jmx.enabled";
   public static final String METRICS_LOG_OUTPUT_ENABLED = "drill.exec.metrics.log.enabled";
@@ -90,7 +88,6 @@ public interface ExecConstants {
   public static final String SYS_STORE_PROVIDER_LOCAL_ENABLE_WRITE = "drill.exec.sys.store.provider.local.write";
   public static final String IMPERSONATION_ENABLED = "drill.exec.impersonation.enabled";
   public static final String IMPERSONATION_MAX_CHAINED_USER_HOPS = "drill.exec.impersonation.max_chained_user_hops";
-  public static final String USER_AUTHENTICATOR_IMPL_PACKAGES = "drill.exec.security.user.auth.packages";
   public static final String USER_AUTHENTICATION_ENABLED = "drill.exec.security.user.auth.enabled";
   public static final String USER_AUTHENTICATOR_IMPL = "drill.exec.security.user.auth.impl";
   public static final String PAM_AUTHENTICATOR_PROFILES = "drill.exec.security.user.auth.pam_profiles";

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/exec/java-exec/src/main/java/org/apache/drill/exec/client/PrintingResultsListener.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/client/PrintingResultsListener.java b/exec/java-exec/src/main/java/org/apache/drill/exec/client/PrintingResultsListener.java
index 61d9ed6..186f289 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/client/PrintingResultsListener.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/client/PrintingResultsListener.java
@@ -25,6 +25,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.drill.common.DrillAutoCloseables;
 import org.apache.drill.common.config.DrillConfig;
+import org.apache.drill.common.exceptions.DrillRuntimeException;
 import org.apache.drill.common.exceptions.UserException;
 import org.apache.drill.exec.client.QuerySubmitter.Format;
 import org.apache.drill.exec.exception.SchemaChangeException;
@@ -112,6 +113,7 @@ public class PrintingResultsListener implements UserResultsListener {
   public int await() throws Exception {
     latch.await();
     if (exception != null) {
+      exception.addSuppressed(new DrillRuntimeException("Exception in executor threadpool"));
       throw exception;
     }
     return count.get();

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/exec/java-exec/src/main/java/org/apache/drill/exec/compile/CodeCompiler.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/CodeCompiler.java b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/CodeCompiler.java
index f0147ef..3f9da07 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/CodeCompiler.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/CodeCompiler.java
@@ -25,6 +25,7 @@ import org.apache.drill.common.config.DrillConfig;
 import org.apache.drill.exec.ExecConstants;
 import org.apache.drill.exec.exception.ClassTransformationException;
 import org.apache.drill.exec.expr.CodeGenerator;
+import org.apache.drill.exec.server.DrillbitContext;
 import org.apache.drill.exec.server.options.OptionManager;
 import org.apache.drill.exec.server.options.SystemOptionManager;
 import org.apache.drill.exec.store.sys.local.LocalPStoreProvider;
@@ -91,10 +92,6 @@ public class CodeCompiler {
     }
   }
 
-  public static CodeCompiler getTestCompiler(DrillConfig c) throws IOException{
-    return new CodeCompiler(c, new SystemOptionManager(c, new LocalPStoreProvider(c)).init());
-  }
-
   /**
    * Flush the compiled classes from the cache.
    *

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/exec/java-exec/src/main/java/org/apache/drill/exec/dotdrill/DotDrillFile.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/dotdrill/DotDrillFile.java b/exec/java-exec/src/main/java/org/apache/drill/exec/dotdrill/DotDrillFile.java
index efa8cc7..1946cee 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/dotdrill/DotDrillFile.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/dotdrill/DotDrillFile.java
@@ -18,6 +18,7 @@
 package org.apache.drill.exec.dotdrill;
 
 import org.apache.drill.common.config.DrillConfig;
+import org.apache.drill.common.config.LogicalPlanPersistence;
 import org.apache.drill.exec.store.dfs.DrillFileSystem;
 import org.apache.hadoop.fs.FileStatus;
 
@@ -67,10 +68,10 @@ public class DotDrillFile {
     return fileName.substring(0, fileName.lastIndexOf(type.getEnding()));
   }
 
-  public View getView(DrillConfig config) throws IOException {
+  public View getView(LogicalPlanPersistence lpPersistence) throws IOException {
     Preconditions.checkArgument(type == DotDrillType.VIEW);
     try(InputStream is = fs.open(status.getPath())){
-      return config.getMapper().readValue(is, View.class);
+      return lpPersistence.getMapper().readValue(is, View.class);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/exec/java-exec/src/main/java/org/apache/drill/exec/expr/DrillFuncHolderExpr.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/DrillFuncHolderExpr.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/DrillFuncHolderExpr.java
index 0dba609..96b0485 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/DrillFuncHolderExpr.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/DrillFuncHolderExpr.java
@@ -60,7 +60,7 @@ public class DrillFuncHolderExpr extends FunctionHolderExpression implements Ite
 
   @Override
   public boolean isRandom() {
-    return holder.isRandom();
+    return !holder.isDeterministic();
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/exec/java-exec/src/main/java/org/apache/drill/exec/expr/annotations/FunctionTemplate.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/annotations/FunctionTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/annotations/FunctionTemplate.java
index 7cafab5..be0fa13 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/annotations/FunctionTemplate.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/annotations/FunctionTemplate.java
@@ -57,7 +57,7 @@ public @interface FunctionTemplate {
   NullHandling nulls() default NullHandling.INTERNAL;
   boolean isBinaryCommutative() default false;
   boolean isRandom()  default false;
-
+  String desc() default "";
   FunctionCostCategory costCategory() default FunctionCostCategory.SIMPLE;
 
   public static enum NullHandling {

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillAggFuncHolder.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillAggFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillAggFuncHolder.java
index add3734..9493b4d 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillAggFuncHolder.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillAggFuncHolder.java
@@ -17,6 +17,9 @@
  */
 package org.apache.drill.exec.expr.fn;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
 import java.util.List;
 import java.util.Map;
 
@@ -44,35 +47,30 @@ import com.sun.codemodel.JMod;
 import com.sun.codemodel.JType;
 import com.sun.codemodel.JVar;
 
-class DrillAggFuncHolder extends DrillFuncHolder{
+class DrillAggFuncHolder extends DrillFuncHolder {
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DrillAggFuncHolder.class);
 
-  private final String setup;
-  private final String reset;
-  private final String add;
-  private final String output;
-  private final String cleanup;
-
-  public DrillAggFuncHolder(FunctionScope scope, NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom,
-      String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars,
-      Map<String, String> methods, List<String> imports) {
-    this(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars, methods, imports, FunctionCostCategory.getDefault());
+  private String setup() {
+    return meth("setup");
+  }
+  private String reset() {
+    return meth("reset", false);
+  }
+  private String add() {
+    return meth("add");
+  }
+  private String output() {
+    return meth("output");
+  }
+  private String cleanup() {
+    return meth("cleanup", false);
   }
 
-  public DrillAggFuncHolder(FunctionScope scope, NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom,
-      String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars,
-      Map<String, String> methods, List<String> imports, FunctionCostCategory costCategory) {
-    super(scope, nullHandling, isBinaryCommutative, isRandom,
-      registeredNames, parameters, returnValue, workspaceVars, methods, imports, costCategory);
-    Preconditions.checkArgument(nullHandling == NullHandling.INTERNAL, "An aggregation function is required to do its own null handling.");
-    setup = methods.get("setup");
-    reset = methods.get("reset");
-    add = methods.get("add");
-    output = methods.get("output");
-    cleanup = methods.get("cleanup");
-    Preconditions.checkNotNull(add);
-    Preconditions.checkNotNull(output);
-    Preconditions.checkNotNull(reset);
+  public DrillAggFuncHolder(
+      FunctionAttributes attributes,
+      FunctionInitializer initializer) {
+    super(attributes, initializer);
+    checkArgument(attributes.getNullHandling() == NullHandling.INTERNAL, "An aggregation function is required to do its own null handling.");
   }
 
   @Override
@@ -89,7 +87,7 @@ class DrillAggFuncHolder extends DrillFuncHolder{
   public JVar[] renderStart(ClassGenerator<?> g, HoldingContainer[] inputVariables) {
     if (!g.getMappingSet().isHashAggMapping()) {  //Declare workspace vars for non-hash-aggregation.
         JVar[] workspaceJVars = declareWorkspaceVariables(g);
-        generateBody(g, BlockType.SETUP, setup, null, workspaceJVars, true);
+        generateBody(g, BlockType.SETUP, setup(), null, workspaceJVars, true);
         return workspaceJVars;
       } else {  //Declare workspace vars and workspace vectors for hash aggregation.
 
@@ -118,7 +116,7 @@ class DrillAggFuncHolder extends DrillFuncHolder{
         forLoop.test(ivar.lt(sizeVar));
         forLoop.update(ivar.assignPlus(JExpr.lit(1)));
 
-        JBlock subBlock = generateInitWorkspaceBlockHA(g, BlockType.SETUP, setup, workspaceJVars, ivar);
+        JBlock subBlock = generateInitWorkspaceBlockHA(g, BlockType.SETUP, setup(), workspaceJVars, ivar);
         forLoop.body().add(subBlock);
         return workspaceJVars;
       }
@@ -129,7 +127,7 @@ class DrillAggFuncHolder extends DrillFuncHolder{
 
   @Override
   public void renderMiddle(ClassGenerator<?> g, HoldingContainer[] inputVariables, JVar[]  workspaceJVars) {
-    addProtectedBlock(g, g.getBlock(BlockType.EVAL), add, inputVariables, workspaceJVars, false);
+    addProtectedBlock(g, g.getBlock(BlockType.EVAL), add(), inputVariables, workspaceJVars, false);
   }
 
 
@@ -139,13 +137,13 @@ class DrillAggFuncHolder extends DrillFuncHolder{
     JBlock sub = new JBlock();
     g.getEvalBlock().add(sub);
     JVar internalOutput = sub.decl(JMod.FINAL, g.getHolderType(returnValue.type), returnValue.name, JExpr._new(g.getHolderType(returnValue.type)));
-    addProtectedBlock(g, sub, output, null, workspaceJVars, false);
+    addProtectedBlock(g, sub, output(), null, workspaceJVars, false);
     sub.assign(out.getHolder(), internalOutput);
         //hash aggregate uses workspace vectors. Initialization is done in "setup" and does not require "reset" block.
         if (!g.getMappingSet().isHashAggMapping()) {
-          generateBody(g, BlockType.RESET, reset, null, workspaceJVars, false);
+          generateBody(g, BlockType.RESET, reset(), null, workspaceJVars, false);
         }
-       generateBody(g, BlockType.CLEANUP, cleanup, null, workspaceJVars, false);
+       generateBody(g, BlockType.CLEANUP, cleanup(), null, workspaceJVars, false);
 
     return out;
   }

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillBooleanOPHolder.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillBooleanOPHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillBooleanOPHolder.java
index d270888..af1d84f 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillBooleanOPHolder.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillBooleanOPHolder.java
@@ -18,21 +18,10 @@
 
 package org.apache.drill.exec.expr.fn;
 
-import java.util.List;
-import java.util.Map;
-
-import org.apache.drill.exec.expr.DrillSimpleFunc;
-import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionCostCategory;
-import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope;
-import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling;
-
 public class DrillBooleanOPHolder extends DrillSimpleFuncHolder{
 
-  public DrillBooleanOPHolder(FunctionScope scope, NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom,
-      String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars,
-      Map<String, String> methods, List<String> imports, FunctionCostCategory costCategory, Class<? extends DrillSimpleFunc> drillFuncClass) {
-    super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars,
-        methods, imports, costCategory, drillFuncClass);
+  public DrillBooleanOPHolder(FunctionAttributes functionAttributes, FunctionInitializer initializer) {
+    super(functionAttributes, initializer);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillComplexWriterFuncHolder.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillComplexWriterFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillComplexWriterFuncHolder.java
index 9999c36..f7ad1b3 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillComplexWriterFuncHolder.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillComplexWriterFuncHolder.java
@@ -18,21 +18,15 @@
 
 package org.apache.drill.exec.expr.fn;
 
-import java.util.List;
-import java.util.Map;
-
 import org.apache.drill.common.expression.FieldReference;
 import org.apache.drill.exec.expr.ClassGenerator;
 import org.apache.drill.exec.expr.ClassGenerator.HoldingContainer;
-import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope;
-import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling;
 import org.apache.drill.exec.physical.impl.project.ProjectRecordBatch;
 import org.apache.drill.exec.vector.complex.impl.ComplexWriterImpl;
 import org.apache.drill.exec.vector.complex.writer.BaseWriter.ComplexWriter;
 
 import com.sun.codemodel.JBlock;
 import com.sun.codemodel.JClass;
-import com.sun.codemodel.JConditional;
 import com.sun.codemodel.JExpr;
 import com.sun.codemodel.JExpression;
 import com.sun.codemodel.JInvocation;
@@ -42,10 +36,8 @@ public class DrillComplexWriterFuncHolder extends DrillSimpleFuncHolder{
 
   private FieldReference ref;
 
-  public DrillComplexWriterFuncHolder(FunctionScope scope, NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom,
-      String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars,
-      Map<String, String> methods, List<String> imports) {
-    super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars, methods, imports);
+  public DrillComplexWriterFuncHolder(FunctionAttributes functionAttributes, FunctionInitializer initializer) {
+    super(functionAttributes, initializer);
   }
 
   public void setReference(FieldReference ref) {

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalAddFuncHolder.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalAddFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalAddFuncHolder.java
index aae7da8..00ad1f5 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalAddFuncHolder.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalAddFuncHolder.java
@@ -32,11 +32,8 @@ import org.apache.drill.exec.util.DecimalUtility;
 
 public class DrillDecimalAddFuncHolder extends DrillSimpleFuncHolder{
 
-
-  public DrillDecimalAddFuncHolder(FunctionScope scope, NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom,
-                                        String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars,
-                                        Map<String, String> methods, List<String> imports, FunctionTemplate.FunctionCostCategory costCategory, Class<? extends DrillSimpleFunc> drillFuncClass) {
-    super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars, methods, imports, costCategory, drillFuncClass);
+  public DrillDecimalAddFuncHolder(FunctionAttributes functionAttributes, FunctionInitializer initializer) {
+    super(functionAttributes, initializer);
   }
 
   /*

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalAggFuncHolder.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalAggFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalAggFuncHolder.java
index 51d21aa..78d865c 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalAggFuncHolder.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalAggFuncHolder.java
@@ -18,15 +18,14 @@
 package org.apache.drill.exec.expr.fn;
 
 import java.util.List;
-import java.util.Map;
 
 import org.apache.drill.common.expression.LogicalExpression;
 import org.apache.drill.common.types.TypeProtos;
-import org.apache.drill.exec.expr.annotations.FunctionTemplate;
 
 public class DrillDecimalAggFuncHolder extends DrillAggFuncHolder {
-  public DrillDecimalAggFuncHolder(FunctionTemplate.FunctionScope scope, FunctionTemplate.NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom, String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars, Map<String, String> methods, List<String> imports) {
-    super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars, methods, imports);
+
+  public DrillDecimalAggFuncHolder(FunctionAttributes attributes, FunctionInitializer initializer) {
+    super(attributes, initializer);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalCastFuncHolder.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalCastFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalCastFuncHolder.java
index 73151c9..2fb9e28 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalCastFuncHolder.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalCastFuncHolder.java
@@ -18,26 +18,19 @@
 package org.apache.drill.exec.expr.fn;
 
 import java.util.List;
-import java.util.Map;
 
 import org.apache.drill.common.exceptions.DrillRuntimeException;
 import org.apache.drill.common.expression.LogicalExpression;
 import org.apache.drill.common.expression.ValueExpressions;
 import org.apache.drill.common.types.TypeProtos;
 import org.apache.drill.common.types.TypeProtos.MajorType;
-import org.apache.drill.exec.expr.DrillSimpleFunc;
-import org.apache.drill.exec.expr.annotations.FunctionTemplate;
-import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope;
 import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling;
 
 public class DrillDecimalCastFuncHolder extends DrillSimpleFuncHolder {
 
-
-    public DrillDecimalCastFuncHolder(FunctionScope scope, NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom,
-                                          String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars,
-                                          Map<String, String> methods, List<String> imports, FunctionTemplate.FunctionCostCategory costCategory, Class<? extends DrillSimpleFunc> drillFuncClass) {
-        super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars, methods, imports, costCategory, drillFuncClass);
-    }
+  public DrillDecimalCastFuncHolder(FunctionAttributes functionAttributes, FunctionInitializer initializer) {
+    super(functionAttributes, initializer);
+  }
 
     @Override
     public MajorType getReturnType(List<LogicalExpression> args) {

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalDivScaleFuncHolder.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalDivScaleFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalDivScaleFuncHolder.java
index cee7312..c867890 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalDivScaleFuncHolder.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalDivScaleFuncHolder.java
@@ -18,25 +18,18 @@
 package org.apache.drill.exec.expr.fn;
 
 import java.util.List;
-import java.util.Map;
 
 import org.apache.drill.common.expression.LogicalExpression;
 import org.apache.drill.common.types.TypeProtos;
 import org.apache.drill.common.types.TypeProtos.MajorType;
 import org.apache.drill.common.util.DecimalScalePrecisionDivideFunction;
-import org.apache.drill.exec.expr.DrillSimpleFunc;
-import org.apache.drill.exec.expr.annotations.FunctionTemplate;
-import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope;
 import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling;
 import org.apache.drill.exec.util.DecimalUtility;
 
 public class DrillDecimalDivScaleFuncHolder extends DrillSimpleFuncHolder{
 
-
-  public DrillDecimalDivScaleFuncHolder(FunctionScope scope, NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom,
-                                        String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars,
-                                        Map<String, String> methods, List<String> imports, FunctionTemplate.FunctionCostCategory costCategory, Class<? extends DrillSimpleFunc> drillFuncClass) {
-    super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars, methods, imports, costCategory, drillFuncClass);
+  public DrillDecimalDivScaleFuncHolder(FunctionAttributes functionAttributes, FunctionInitializer initializer) {
+    super(functionAttributes, initializer);
   }
 
   /*

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalMaxScaleFuncHolder.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalMaxScaleFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalMaxScaleFuncHolder.java
index 2aff09f..e0b8f9a 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalMaxScaleFuncHolder.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalMaxScaleFuncHolder.java
@@ -28,15 +28,11 @@ import org.apache.drill.exec.expr.annotations.FunctionTemplate;
 import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope;
 import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling;
 
-public class DrillDecimalMaxScaleFuncHolder extends DrillSimpleFuncHolder{
+public class DrillDecimalMaxScaleFuncHolder extends DrillSimpleFuncHolder {
 
-
-    public DrillDecimalMaxScaleFuncHolder(FunctionScope scope, NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom,
-    String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars,
-    Map<String, String> methods, List<String> imports, FunctionTemplate.FunctionCostCategory costCategory, Class<? extends DrillSimpleFunc> drillFuncClass) {
-        super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars,
-            methods, imports, costCategory, drillFuncClass);
-    }
+  public DrillDecimalMaxScaleFuncHolder(FunctionAttributes functionAttributes, FunctionInitializer initializer) {
+    super(functionAttributes, initializer);
+  }
 
     @Override
     public MajorType getReturnType(List<LogicalExpression> args) {

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalModScaleFuncHolder.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalModScaleFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalModScaleFuncHolder.java
index 5faec84..b373fa9 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalModScaleFuncHolder.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalModScaleFuncHolder.java
@@ -32,11 +32,8 @@ import org.apache.drill.exec.util.DecimalUtility;
 
 public class DrillDecimalModScaleFuncHolder extends DrillSimpleFuncHolder{
 
-
-  public DrillDecimalModScaleFuncHolder(FunctionScope scope, NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom,
-                                        String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars,
-                                        Map<String, String> methods, List<String> imports, FunctionTemplate.FunctionCostCategory costCategory, Class<? extends DrillSimpleFunc> drillFuncClass) {
-    super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars, methods, imports, costCategory, drillFuncClass);
+  public DrillDecimalModScaleFuncHolder(FunctionAttributes functionAttributes, FunctionInitializer initializer) {
+    super(functionAttributes, initializer);
   }
 
   /*

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalSetScaleFuncHolder.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalSetScaleFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalSetScaleFuncHolder.java
index 8e6bdb5..a10d6ea 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalSetScaleFuncHolder.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalSetScaleFuncHolder.java
@@ -18,24 +18,17 @@
 package org.apache.drill.exec.expr.fn;
 
 import java.util.List;
-import java.util.Map;
 
 import org.apache.drill.common.expression.LogicalExpression;
 import org.apache.drill.common.expression.ValueExpressions;
 import org.apache.drill.common.types.TypeProtos;
 import org.apache.drill.common.types.TypeProtos.MajorType;
-import org.apache.drill.exec.expr.DrillSimpleFunc;
-import org.apache.drill.exec.expr.annotations.FunctionTemplate;
-import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope;
 import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling;
 
 public class DrillDecimalSetScaleFuncHolder extends DrillSimpleFuncHolder{
 
-
-  public DrillDecimalSetScaleFuncHolder(FunctionScope scope, NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom,
-                                        String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars,
-                                        Map<String, String> methods, List<String> imports, FunctionTemplate.FunctionCostCategory costCategory, Class<? extends DrillSimpleFunc> drillFuncClass) {
-    super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars, methods, imports, costCategory, drillFuncClass);
+  public DrillDecimalSetScaleFuncHolder(FunctionAttributes functionAttributes, FunctionInitializer initializer) {
+    super(functionAttributes, initializer);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalSumAggFuncHolder.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalSumAggFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalSumAggFuncHolder.java
index 2988be5..89ea7cc 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalSumAggFuncHolder.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalSumAggFuncHolder.java
@@ -18,15 +18,14 @@
 package org.apache.drill.exec.expr.fn;
 
 import java.util.List;
-import java.util.Map;
 
 import org.apache.drill.common.expression.LogicalExpression;
 import org.apache.drill.common.types.TypeProtos;
-import org.apache.drill.exec.expr.annotations.FunctionTemplate;
 
 public class DrillDecimalSumAggFuncHolder extends DrillAggFuncHolder {
-  public DrillDecimalSumAggFuncHolder(FunctionTemplate.FunctionScope scope, FunctionTemplate.NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom, String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars, Map<String, String> methods, List<String> imports) {
-    super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars, methods, imports);
+
+  public DrillDecimalSumAggFuncHolder(FunctionAttributes attributes, FunctionInitializer initializer) {
+    super(attributes, initializer);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalSumScaleFuncHolder.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalSumScaleFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalSumScaleFuncHolder.java
index 24b1eb0..d45e674 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalSumScaleFuncHolder.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalSumScaleFuncHolder.java
@@ -18,26 +18,20 @@
 package org.apache.drill.exec.expr.fn;
 
 import java.util.List;
-import java.util.Map;
 
 import org.apache.drill.common.expression.LogicalExpression;
 import org.apache.drill.common.types.TypeProtos;
 import org.apache.drill.common.types.TypeProtos.MajorType;
 import org.apache.drill.common.util.DecimalScalePrecisionMulFunction;
-import org.apache.drill.exec.expr.DrillSimpleFunc;
-import org.apache.drill.exec.expr.annotations.FunctionTemplate;
-import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope;
 import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling;
 import org.apache.drill.exec.util.DecimalUtility;
 
 public class DrillDecimalSumScaleFuncHolder extends DrillSimpleFuncHolder{
 
 
-    public DrillDecimalSumScaleFuncHolder(FunctionScope scope, NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom,
-                                          String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars,
-                                          Map<String, String> methods, List<String> imports, FunctionTemplate.FunctionCostCategory costCategory, Class<? extends DrillSimpleFunc> drillFuncClass) {
-        super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars, methods, imports, costCategory, drillFuncClass);
-    }
+  public DrillDecimalSumScaleFuncHolder(FunctionAttributes functionAttributes, FunctionInitializer initializer) {
+    super(functionAttributes, initializer);
+  }
 
     @Override
     public MajorType getReturnType(List<LogicalExpression> args) {

http://git-wip-us.apache.org/repos/asf/drill/blob/dbcab0fe/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalZeroScaleFuncHolder.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalZeroScaleFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalZeroScaleFuncHolder.java
index 6fb9ed6..f941750 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalZeroScaleFuncHolder.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalZeroScaleFuncHolder.java
@@ -30,11 +30,8 @@ import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling;
 
 public class DrillDecimalZeroScaleFuncHolder extends DrillSimpleFuncHolder{
 
-
-  public DrillDecimalZeroScaleFuncHolder(FunctionScope scope, NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom,
-                                        String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars,
-                                        Map<String, String> methods, List<String> imports, FunctionTemplate.FunctionCostCategory costCategory, Class<? extends DrillSimpleFunc> drillFuncClass) {
-    super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars, methods, imports, costCategory, drillFuncClass);
+  public DrillDecimalZeroScaleFuncHolder(FunctionAttributes functionAttributes, FunctionInitializer initializer) {
+    super(functionAttributes, initializer);
   }
 
   /* This function scope is used when we need to remove the scale part.


Mime
View raw message