You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by ja...@apache.org on 2013/07/23 10:13:18 UTC
git commit: Add NegativeLong function. Reduce MethodGrabbingVisitor
verbosity. Make FunctionConverter contextual to location of loaded function
for class loader improvements. Add automatic test-jar generation to java-exec
for other module use.
Updated Branches:
refs/heads/master 93ddf2660 -> 113d4b9f8
Add NegativeLong function.
Reduce MethodGrabbingVisitor verbosity.
Make FunctionConverter contextual to location of loaded function for class loader improvements.
Add automatic test-jar generation to java-exec for other module use.
Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/113d4b9f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/113d4b9f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/113d4b9f
Branch: refs/heads/master
Commit: 113d4b9f8d98a317565dc464a72f714b7e1b2910
Parents: 93ddf26
Author: Jacques Nadeau <ja...@apache.org>
Authored: Tue Jul 23 00:00:28 2013 -0700
Committer: Jacques Nadeau <ja...@apache.org>
Committed: Tue Jul 23 00:46:20 2013 -0700
----------------------------------------------------------------------
sandbox/prototype/exec/java-exec/pom.xml | 103 +++++++++++--------
.../drill/exec/expr/fn/FunctionConverter.java | 2 +-
.../exec/expr/fn/MethodGrabbingVisitor.java | 4 +-
.../drill/exec/expr/fn/impl/MathFunctions.java | 17 +++
4 files changed, 78 insertions(+), 48 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/113d4b9f/sandbox/prototype/exec/java-exec/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox/prototype/exec/java-exec/pom.xml b/sandbox/prototype/exec/java-exec/pom.xml
index 8893044..63bf4ea 100644
--- a/sandbox/prototype/exec/java-exec/pom.xml
+++ b/sandbox/prototype/exec/java-exec/pom.xml
@@ -160,6 +160,18 @@
</executions>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
@@ -179,51 +191,52 @@
<exec executable="protoc">
<arg value="--java_out=${target.gen.source.path}" />
<arg value="--proto_path=${proto.cas.path}" />
- <arg value="--proto_path=${project.basedir}/../../common/src/main/protobuf/" />
- <arg line="${proto.files}" />
- </exec>
- </tasks>
- <sourceRoot>${target.gen.source.path}</sourceRoot>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>com.googlecode.fmpp-maven-plugin</groupId>
- <artifactId>fmpp-maven-plugin</artifactId>
- <version>1.0</version>
- <configuration>
- <cfgFile>src/main/codegen/ValueVectors/config.fmpp</cfgFile>
- <outputDirectory>target/generated-sources/org/apache/drill/exec/vector</outputDirectory>
- <templateDirectory>src/main/codegen/ValueVectors/templates</templateDirectory>
- </configuration>
- <executions>
- <execution>
- <id>generate-sources</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
+ <arg
+ value="--proto_path=${project.basedir}/../../common/src/main/protobuf/" />
+ <arg line="${proto.files}" />
+ </exec>
+ </tasks>
+ <sourceRoot>${target.gen.source.path}</sourceRoot>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>com.googlecode.fmpp-maven-plugin</groupId>
+ <artifactId>fmpp-maven-plugin</artifactId>
+ <version>1.0</version>
+ <configuration>
+ <cfgFile>src/main/codegen/ValueVectors/config.fmpp</cfgFile>
+ <outputDirectory>target/generated-sources/org/apache/drill/exec/vector</outputDirectory>
+ <templateDirectory>src/main/codegen/ValueVectors/templates</templateDirectory>
+ </configuration>
+ <executions>
+ <execution>
+ <id>generate-sources</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
- <!-- <plugin> -->
- <!-- <groupId>com.github.igor-petruk.protobuf</groupId> -->
- <!-- <artifactId>protobuf-maven-plugin</artifactId> -->
- <!-- <version>0.6.2</version> -->
- <!-- <executions> -->
- <!-- <execution> -->
- <!-- <goals> -->
- <!-- <goal>run</goal> -->
- <!-- </goals> -->
- <!-- </execution> -->
- <!-- </executions> -->
- <!-- </plugin> -->
- </plugins>
- </build>
+ <!-- <plugin> -->
+ <!-- <groupId>com.github.igor-petruk.protobuf</groupId> -->
+ <!-- <artifactId>protobuf-maven-plugin</artifactId> -->
+ <!-- <version>0.6.2</version> -->
+ <!-- <executions> -->
+ <!-- <execution> -->
+ <!-- <goals> -->
+ <!-- <goal>run</goal> -->
+ <!-- </goals> -->
+ <!-- </execution> -->
+ <!-- </executions> -->
+ <!-- </plugin> -->
+ </plugins>
+ </build>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/113d4b9f/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionConverter.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionConverter.java b/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionConverter.java
index 3525cbb..5babc78 100644
--- a/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionConverter.java
+++ b/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionConverter.java
@@ -142,7 +142,7 @@ public class FunctionConverter {
path = path.replaceFirst("\\$.*", "");
path = path.replace(".", File.separator);
path = "/" + path + ".java";
- URL u = Resources.getResource(FunctionConverter.class, path);
+ URL u = Resources.getResource(c, path);
InputSupplier<InputStream> supplier = Resources.newInputStreamSupplier(u);
try(InputStream is = supplier.getInput()){
if(is == null){
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/113d4b9f/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/MethodGrabbingVisitor.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/MethodGrabbingVisitor.java b/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/MethodGrabbingVisitor.java
index d46d008..c96d6e0 100644
--- a/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/MethodGrabbingVisitor.java
+++ b/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/MethodGrabbingVisitor.java
@@ -28,7 +28,7 @@ public class MethodGrabbingVisitor{
@Override
public void traverseClassDeclaration(ClassDeclaration cd) {
- logger.debug("Traversing: {}", cd.getClassName());
+// logger.debug("Traversing: {}", cd.getClassName());
boolean prevCapture = captureMethods;
captureMethods = c.getName().equals(cd.getClassName());
super.traverseClassDeclaration(cd);
@@ -37,7 +37,7 @@ public class MethodGrabbingVisitor{
@Override
public void traverseMethodDeclarator(MethodDeclarator md) {
- logger.debug(c.getName() + ": Found {}, include {}", md.name, captureMethods);
+// logger.debug(c.getName() + ": Found {}, include {}", md.name, captureMethods);
if(captureMethods){
StringWriter writer = new StringWriter();
ModifiedUnparseVisitor v = new ModifiedUnparseVisitor(writer);
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/113d4b9f/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/MathFunctions.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/MathFunctions.java b/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/MathFunctions.java
index 939e997..9808bd5 100644
--- a/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/MathFunctions.java
+++ b/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/MathFunctions.java
@@ -45,4 +45,21 @@ public class MathFunctions{
}
+ /**
+ * Define the actual absolute value implementation
+ */
+ @FunctionTemplate(name = "negative", scope = FunctionScope.SIMPLE, nulls = NullHandling.NULL_IF_NULL)
+ public static class Negative implements DrillFunc{
+
+ @Param LongHolder input;
+ @Output LongHolder out;
+
+ public void setup(RecordBatch b){}
+
+ public void eval(){
+ out.value = -input.value;
+ }
+
+ }
+
}