You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2015/09/30 21:29:24 UTC

[12/14] hive git commit: HIVE-11920: ADD JAR failing with URL schemes other than file/ivy/hdfs (Jason Dere, reviewed by Hari Subramaniyan)

HIVE-11920: ADD JAR failing with URL schemes other than file/ivy/hdfs (Jason Dere, reviewed by Hari Subramaniyan)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/8c8cc19f
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/8c8cc19f
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/8c8cc19f

Branch: refs/heads/llap
Commit: 8c8cc19fd4b2ddfc616905a021fd0588878ab121
Parents: 265e42c
Author: Jason Dere <jd...@hortonworks.com>
Authored: Wed Sep 30 11:21:31 2015 -0700
Committer: Jason Dere <jd...@hortonworks.com>
Committed: Wed Sep 30 11:21:31 2015 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hive/ql/session/SessionState.java |  9 ++-------
 ql/src/test/queries/clientpositive/add_jar_pfile.q      |  8 ++++++++
 ql/src/test/results/clientpositive/add_jar_pfile.q.out  | 12 ++++++++++++
 3 files changed, 22 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/8c8cc19f/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java b/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
index 0bd347c..dc8c336 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
@@ -1252,11 +1252,8 @@ public class SessionState {
     String scheme = uri.getScheme() == null ? null : uri.getScheme().toLowerCase();
     if (scheme == null || scheme.equals("file")) {
       return "file";
-    } else if (scheme.equals("hdfs") || scheme.equals("ivy")) {
-      return scheme;
-    } else {
-      throw new RuntimeException("invalid url: " + uri + ", expecting ( file | hdfs | ivy)  as url scheme. ");
     }
+    return scheme;
   }
 
   List<URI> resolveAndDownload(ResourceType t, String value, boolean convertToUnix) throws URISyntaxException,
@@ -1266,10 +1263,8 @@ public class SessionState {
       return Arrays.asList(uri);
     } else if (getURLType(value).equals("ivy")) {
       return dependencyResolver.downloadDependencies(uri);
-    } else if (getURLType(value).equals("hdfs")) {
-      return Arrays.asList(createURI(downloadResource(value, convertToUnix)));
     } else {
-      throw new RuntimeException("Invalid url " + uri);
+      return Arrays.asList(createURI(downloadResource(value, convertToUnix)));
     }
   }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/8c8cc19f/ql/src/test/queries/clientpositive/add_jar_pfile.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/add_jar_pfile.q b/ql/src/test/queries/clientpositive/add_jar_pfile.q
new file mode 100644
index 0000000..ed55518
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/add_jar_pfile.q
@@ -0,0 +1,8 @@
+
+dfs -copyFromLocal ${system:maven.local.repository}/org/apache/hive/hive-contrib/${system:hive.version}/hive-contrib-${system:hive.version}.jar pfile://${system:test.tmp.dir}/hive-contrib-${system:hive.version}.jar;
+
+add jar pfile://${system:test.tmp.dir}/hive-contrib-${system:hive.version}.jar;
+
+CREATE TEMPORARY FUNCTION example_add AS 'org.apache.hadoop.hive.contrib.udf.example.UDFExampleAdd';
+
+DROP TEMPORARY FUNCTION example_add;

http://git-wip-us.apache.org/repos/asf/hive/blob/8c8cc19f/ql/src/test/results/clientpositive/add_jar_pfile.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/add_jar_pfile.q.out b/ql/src/test/results/clientpositive/add_jar_pfile.q.out
new file mode 100644
index 0000000..60c65cc
--- /dev/null
+++ b/ql/src/test/results/clientpositive/add_jar_pfile.q.out
@@ -0,0 +1,12 @@
+PREHOOK: query: CREATE TEMPORARY FUNCTION example_add AS 'org.apache.hadoop.hive.contrib.udf.example.UDFExampleAdd'
+PREHOOK: type: CREATEFUNCTION
+PREHOOK: Output: example_add
+POSTHOOK: query: CREATE TEMPORARY FUNCTION example_add AS 'org.apache.hadoop.hive.contrib.udf.example.UDFExampleAdd'
+POSTHOOK: type: CREATEFUNCTION
+POSTHOOK: Output: example_add
+PREHOOK: query: DROP TEMPORARY FUNCTION example_add
+PREHOOK: type: DROPFUNCTION
+PREHOOK: Output: example_add
+POSTHOOK: query: DROP TEMPORARY FUNCTION example_add
+POSTHOOK: type: DROPFUNCTION
+POSTHOOK: Output: example_add