You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lens.apache.org by ar...@apache.org on 2015/10/08 12:43:21 UTC
lens git commit: LENS-739 : Generate udf jar for lens-regression
Repository: lens
Updated Branches:
refs/heads/master 2d7948d72 -> d4d4aa26a
LENS-739 : Generate udf jar for lens-regression
Project: http://git-wip-us.apache.org/repos/asf/lens/repo
Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/d4d4aa26
Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/d4d4aa26
Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/d4d4aa26
Branch: refs/heads/master
Commit: d4d4aa26a84f489eeef1cc9008660ac3ad570fa7
Parents: 2d7948d
Author: Archana H <ar...@gmail.com>
Authored: Thu Oct 8 16:02:51 2015 +0530
Committer: Arshad Matin <ar...@apache.org>
Committed: Thu Oct 8 16:02:51 2015 +0530
----------------------------------------------------------------------
lens-regression/pom.xml | 38 +++++++++++++++++++-
.../src/additional/java/SampleUdf.java | 17 +++++++++
2 files changed, 54 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lens/blob/d4d4aa26/lens-regression/pom.xml
----------------------------------------------------------------------
diff --git a/lens-regression/pom.xml b/lens-regression/pom.xml
index 560b4df..aa44a48 100644
--- a/lens-regression/pom.xml
+++ b/lens-regression/pom.xml
@@ -67,7 +67,43 @@
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
</dependency>
-
+ <dependency>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-exec</artifactId>
+ </dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>hive-udf-jars</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <target>
+ <property name="build.compiler" value="extJavac"/>
+ <property name="compile_classpath" refid="maven.compile.classpath"/>
+ <mkdir dir="${project.build.directory}/additional-classes"/>
+ <javac includeantruntime="false" srcdir="src/additional/java"
+ destdir="${project.build.directory}/additional-classes" classpath="${compile_classpath}"/>
+ <mkdir dir="${project.build.directory}/testjars"/>
+ <jar destfile="${project.build.directory}/testjars/hiveudftest.jar">
+ <fileset dir="${project.build.directory}/additional-classes" includes="SampleUdf.class"/>
+ </jar>
+ </target>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+
</project>
http://git-wip-us.apache.org/repos/asf/lens/blob/d4d4aa26/lens-regression/src/additional/java/SampleUdf.java
----------------------------------------------------------------------
diff --git a/lens-regression/src/additional/java/SampleUdf.java b/lens-regression/src/additional/java/SampleUdf.java
new file mode 100644
index 0000000..2c3e667
--- /dev/null
+++ b/lens-regression/src/additional/java/SampleUdf.java
@@ -0,0 +1,17 @@
+import org.apache.hadoop.hive.ql.exec.UDF;
+import org.apache.hadoop.io.Text;
+
+public final class SampleUdf extends UDF {
+ public Text evaluate(final Text s, Text sleepTime) throws InterruptedException {
+
+ if(sleepTime!=null){
+ Thread.sleep(Long.parseLong(sleepTime.toString()));
+ }else{
+ Thread.sleep(180000);
+ }
+
+ if (s == null) { return null; }
+
+ return new Text(s.toString().toLowerCase());
+ }
+}
\ No newline at end of file