You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2013/07/09 11:07:43 UTC

svn commit: r1501145 [2/13] - in /hive/branches/vectorization: ./ beeline/src/java/org/apache/hive/beeline/ beeline/src/test/org/apache/hive/beeline/src/test/ cli/src/java/org/apache/hadoop/hive/cli/ common/src/java/org/apache/hadoop/hive/common/metric...

Modified: hive/branches/vectorization/hcatalog/build.xml
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/hcatalog/build.xml?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/hcatalog/build.xml (original)
+++ hive/branches/vectorization/hcatalog/build.xml Tue Jul  9 09:07:35 2013
@@ -26,7 +26,8 @@
   <!-- <import file="../build-common.xml"/> -->
 
     <property name="path.to.basedir" location="${basedir}"/>
-
+    <property name="test.result.dir" location="${build.dir.hive}/hcatalog/test"
+              description="location to place TEST-*.xml files so that hive's testreport includes them"/>
     <loadproperties srcfile="${basedir}/build.properties"/>
 
     <!--
@@ -91,16 +92,29 @@
     <target name="gen-test" description="Generate tests, a no-op for hcat"/>
 
     <target name="test" depends="jar" description="run unit tests">
+        <mkdir dir="${test.result.dir}"/>
         <!-- Placed in a parallel structure so that the tests keep going
              even if some fail.  Otherwise a failure in one of the earlier ant
              call terminates the target and the rest do not run.  -->
         <parallel threadCount="1">
-            <ant target="test" dir="core" inheritAll="false"/>
-            <ant target="test" dir="hcatalog-pig-adapter" inheritAll="false"/>
-            <ant target="test" dir="server-extensions" inheritAll="false"/>
-            <ant target="test" dir="webhcat/svr" inheritAll="false"/>
-            <ant target="test" dir="webhcat/java-client" inheritAll="false"/>
-            <ant target="test" dir="storage-handlers/hbase" inheritAll="false"/>
+            <ant target="test" dir="core" inheritAll="false">
+                <property name="test.result.dir" location="${test.result.dir}"/>
+            </ant>
+            <ant target="test" dir="hcatalog-pig-adapter" inheritAll="false">
+                <property name="test.result.dir" location="${test.result.dir}"/>
+            </ant>
+            <ant target="test" dir="server-extensions" inheritAll="false">
+                <property name="test.result.dir" location="${test.result.dir}"/>
+            </ant>
+            <ant target="test" dir="webhcat/svr" inheritAll="false">
+                <property name="test.result.dir" location="${test.result.dir}"/>
+            </ant>
+            <ant target="test" dir="webhcat/java-client" inheritAll="false">
+                <property name="test.result.dir" location="${test.result.dir}"/>
+            </ant>
+            <ant target="test" dir="storage-handlers/hbase" inheritAll="false">
+                <property name="test.result.dir" location="${test.result.dir}"/>
+            </ant>
             <!-- One checkstyle run for the whole repo. Runs after junit tests
             to piggyback on resolved jars. -->
             <path id="checkstyle.class.path">
@@ -174,6 +188,7 @@
     <!-- Clean up children -->
     <target name="clean-test" description="Cleanup test artifacts">
         <echo message="${ant.project.name}"/>
+        <delete dir="${test.result.dir}"/>
         <delete dir="${build.dir}"/>
         <ant target="clean-test" dir="core" inheritAll="false"/>
         <ant target="clean-test" dir="hcatalog-pig-adapter" inheritAll="false"/>

Modified: hive/branches/vectorization/hcatalog/src/test/e2e/hcatalog/build.xml
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/hcatalog/src/test/e2e/hcatalog/build.xml?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/hcatalog/src/test/e2e/hcatalog/build.xml (original)
+++ hive/branches/vectorization/hcatalog/src/test/e2e/hcatalog/build.xml Tue Jul  9 09:07:35 2013
@@ -280,6 +280,8 @@
             <arg value="${test.location}/tests/hive.conf"/>
             <arg value="${test.location}/tests/hcat.conf"/>
             <arg value="${test.location}/tests/hadoop.conf"/>
+            <arg value="${test.location}/tests/hive_nightly.conf"/>
+            <arg value="${test.location}/tests/hive_cmdline.conf"/>
         </exec>
     </target>
 

Modified: hive/branches/vectorization/hcatalog/src/test/e2e/hcatalog/tools/test/floatpostprocessor.pl
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/hcatalog/src/test/e2e/hcatalog/tools/test/floatpostprocessor.pl?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/hcatalog/src/test/e2e/hcatalog/tools/test/floatpostprocessor.pl (original)
+++ hive/branches/vectorization/hcatalog/src/test/e2e/hcatalog/tools/test/floatpostprocessor.pl Tue Jul  9 09:07:35 2013
@@ -42,7 +42,7 @@ sub postprocess($)
 	for (my $i = 0; $i < @fields; $i++) {
 		if ($i != 0) { print($delim); }
 		if ($floats[$i]) {
-			printf("%.3f", $fields[$i]);
+			printf("%.2f", $fields[$i]);
 		} else {
 			print($fields[$i]);
 		}

Modified: hive/branches/vectorization/hcatalog/src/test/e2e/templeton/README.txt
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/hcatalog/src/test/e2e/templeton/README.txt?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/hcatalog/src/test/e2e/templeton/README.txt (original)
+++ hive/branches/vectorization/hcatalog/src/test/e2e/templeton/README.txt Tue Jul  9 09:07:35 2013
@@ -20,10 +20,37 @@ End to end tests
 End to end tests in templeton runs tests against an existing templeton server.
 It runs hcat, mapreduce, streaming, hive and pig tests.
 
+It's a good idea to look at current versions of
+http://hive.apache.org/docs/hcat_r0.5.0/rest_server_install.html and
+http://hive.apache.org/docs/hcat_r0.5.0/configuration.html before proceeding.
+
+
+(Note that by default, webhcat-default.xml templeton.hive.properties sets
+hive.metastore.uris=thrift://localhost:9933, thus WebHCat will expect
+an external metastore to be running.
+to start hive metastore: ./bin/hive --service metastore -p 9933)
+
+launch templeton server: ./hcatalog/sbin/webhcat_server.sh start
+
+to control which DB the metastore uses put something like
+<property>
+  <name>javax.jdo.option.ConnectionURL</name>
+  <value>jdbc:derby:;databaseName=/Users/ekoifman/dev/data/tmp/metastore_db_e2e;create=true</value>
+  <description>Controls which DB engine metastore will use for persistence. In particular,
+  where Derby will create it's data files.</description>
+</property>
+
+in hive-site.xml
+)
+
+
 !!!! NOTE !!!!
 --------------
 USE SVN TO CHECKOUT CODE FOR RUNNING TESTS AS THE TEST
   HARNESS IS EXTERNED FROM PIG. GIT WILL NOT IMPORT IT
+  (if you are using GIT, check out http://svn.apache.org/repos/asf/hive/trunk (or whichever branch)
+  (http://hive.apache.org/version_control.html) and symlink
+  hcatalog/src/test/e2e/harness/ to corresponding harness/ in SVN tree)
 
 Test cases
 ----------
@@ -57,11 +84,19 @@ Tips:
 
 
 3. Copy contents of src/test/e2e/templeton/inpdir to hdfs
+(e.g. ./bin/hadoop fs -put ~/dev/hive/hcatalog/src/test/e2e/templeton/inpdir/ webhcate2e)
 
 4. You will need to two jars in the same HDFS directory as the contents of inpdir.  piggybank.jar, which can
 be obtained from Pig.  The second is the hadoop-examples.jar, which can be obtained from your Hadoop distribution.
 This should be called hexamples.jar when it is uploaded to HDFS.
+Also see http://hive.apache.org/docs/hcat_r0.5.0/rest_server_install.html#Hadoop+Distributed+Cache for notes on
+additional JAR files to copy to HDFS.
+
+5. Make sure TEMPLETON_HOME evnironment variable is set
+
 
+6. hadoop/conf/core-site.xml should have items described in
+http://hive.apache.org/docs/hcat_r0.5.0/rest_server_install.html#Permissions
 
 Running the tests
 -----------------
@@ -73,6 +108,7 @@ ant test -Dinpdir.hdfs=<location of inpd
 If you want to run specific test group you can specify the group, for example:  -Dtests.to.run='-t TestHive'
 
 If you want to run specific test in a group group you can specify the test, for example:  -Dtests.to.run='-t TestHive_1'
+For example, tests/ddl.conf has several groups such as 'name' => 'REST_DDL_TABLE_BASIC'; use REST_DDL_TABLE_BASIC as the name
 
 
 Running the hcat authorization tests
@@ -110,3 +146,7 @@ ant clean; ant e2e
 This assumes you've got webhdfs at the address above, the inpdir info in /user/templeton, and templeton running on the default port.  You can change any of those properties in the build file.
 
 It's best to set HADOOP_HOME_WARN_SUPPRESS=true everywhere you can.
+Also useful to add to conf/hadoop-env.sh
+export HADOOP_OPTS="-Djava.security.krb5.realm=OX.AC.UK -Djava.security.krb5.kdc=kdc0.ox.ac.uk:kdc1.ox.ac.uk"
+to prevent warning about SCDynamicStore which may throw some tests off
+(http://stackoverflow.com/questions/7134723/hadoop-on-osx-unable-to-load-realm-info-from-scdynamicstore)

Modified: hive/branches/vectorization/hcatalog/src/test/e2e/templeton/build.xml
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/hcatalog/src/test/e2e/templeton/build.xml?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/hcatalog/src/test/e2e/templeton/build.xml (original)
+++ hive/branches/vectorization/hcatalog/src/test/e2e/templeton/build.xml Tue Jul  9 09:07:35 2013
@@ -24,6 +24,7 @@
     <property name="test.src" value="${basedir}/tests"/>
     <property name="driver.src" value="${basedir}/drivers"/>
     <property name="conf.src" value="${basedir}/conf"/>
+    <property name="resource.src" value="${basedir}/resource"/>
     <property name="harness.dir" value="${basedir}/../harness"/>
     <property name="harness.tar" value="${harness.dir}/harness.tar"/>
     <property name="inpdir.local" value="${basedir}/inpdir/"/>
@@ -51,6 +52,7 @@
         <mkdir dir="${tar.dir}"/>
         <mkdir dir="${tar.dir}/tests"/>
         <mkdir dir="${tar.dir}/conf"/>
+        <mkdir dir="${tar.dir}/resource"/>
         <copy todir="${tar.dir}/tests">
             <fileset dir="${test.src}">
             </fileset>
@@ -61,6 +63,9 @@
         <copy todir="${tar.dir}/conf">
             <fileset dir="${conf.src}"/>
         </copy>
+        <copy todir="${tar.dir}/resource">
+            <fileset dir="${resource.src}"/>
+        </copy>
         <tar destfile="${tar.name}" basedir="${tar.dir}"/>
     </target>
 

Modified: hive/branches/vectorization/hcatalog/src/test/e2e/templeton/tests/ddl.conf
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/hcatalog/src/test/e2e/templeton/tests/ddl.conf?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/hcatalog/src/test/e2e/templeton/tests/ddl.conf (original)
+++ hive/branches/vectorization/hcatalog/src/test/e2e/templeton/tests/ddl.conf Tue Jul  9 09:07:35 2013
@@ -283,8 +283,8 @@ $cfg = 
      'status_code' => 200,
                                 #	  'json_field_substr_match' => {'table-name' => 'templeton_testtab1'}, 
      'json_field_match_object' => { 'columns' => '[
-                 { "name" : "i", "type" : "int"},
-                 { "name" : "j", "type" : "bigint", "comment" : "some comment"  }
+                 { "name" : "i", "type" : "int", "comment" : "from deserializer" },
+                 { "name" : "j", "type" : "bigint", "comment" : "from deserializer"  }
            ]' },
     },
     {                           #drop table
@@ -299,7 +299,7 @@ $cfg = 
      'method' => 'GET',
      'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/templeton_testdb1/table/templeton_testtab1?user.name=:UNAME:',
      'status_code' => 404, 
-     'json_field_substr_match' => {'error' => 'templeton_testtab1 does not exist'},
+     'json_field_substr_match' => {'error' => 'FAILED: SemanticException \[Error 10001\]: Table not found templeton_testtab1'},
     },
     {
                                 #-ve test , describe on non existent table
@@ -307,7 +307,7 @@ $cfg = 
      'method' => 'GET',
      'url' => ':TEMPLETON_URL:/templeton/v1/ddl/database/templeton_testdb1/table/templeton_testtab1?user.name=:UNAME:&format=extended:',
      'status_code' => 404, 
-     'json_field_substr_match' => {'error' => 'templeton_testtab1 does not exist'},
+     'json_field_substr_match' => {'error' => 'FAILED: SemanticException \[Error 10001\]: Table not found templeton_testtab1'},
     },
 
    ]
@@ -399,16 +399,15 @@ $cfg = 
      {'columns' => '[
 	      {
                   "name" : "i",
-                  "type" : "int"
+                  "type" : "int", "comment" : "from deserializer"
               },
 	     {
                   "name" : "j",
-                  "type" : "bigint"
+                  "type" : "bigint", "comment" : "from deserializer"
               },
 	     {
-                  "comment" : "IP Address of the User",
                   "name" : "ip",
-                  "type" : "string"
+                  "type" : "string", "comment" : "from deserializer"
               }
             ]',
       "partitionColumns" => '[
@@ -480,8 +479,8 @@ $cfg = 
      'status_code' => 200,
      #	  'json_field_substr_match' => {'table-name' => 'templeton_testtab1'}, 
      'json_field_match_object' => { 'columns' => '[
-                 { "name" : "i", "type" : "int" },
-                 { "name" : "j", "type" : "bigint" }
+                 { "name" : "i", "type" : "int", "comment" : "from deserializer" },
+                 { "name" : "j", "type" : "bigint", "comment" : "from deserializer" }
            ]' },
     },
 
@@ -626,16 +625,15 @@ STORED AS rcfile
       "columns" => '[
 		{
 		    "name" : "i",
-		    "type" : "int"
+		    "type" : "int", "comment" : "from deserializer"
 		},
 	       {
 		   "name" : "j",
-		   "type" : "bigint"
+		   "type" : "bigint", "comment" : "from deserializer"
 	       },
 	       {
-		   "comment" : "IP Address of the User",
 		   "name" : "ip",
-		   "type" : "string"
+		   "type" : "string", "comment" : "from deserializer"
 	      }
 	    ]',
 
@@ -679,16 +677,15 @@ STORED AS rcfile
       "columns" => '[
 		{
 		    "name" : "i",
-		    "type" : "int"
+		    "type" : "int", "comment" : "from deserializer"
 		},
 	       {
 		   "name" : "j",
-		   "type" : "bigint"
+		   "type" : "bigint", "comment" : "from deserializer"
 	       },
 	       {
-		   "comment" : "IP Address of the User",
 		   "name" : "ip",
-		   "type" : "string"
+		   "type" : "string", "comment" : "from deserializer"
 	      }
 	    ]',
 
@@ -735,7 +732,7 @@ STORED AS rcfile
      'status_code' => 404,
      'json_field_substr_match' => 
        {
-        'error' => 'Partition.*for table templetontest_parts does not exist'
+        'error' => 'FAILED: SemanticException \[Error 10006\]: Partition not found \{dt=20120101\, country=IN\}'
        },
     },
 
@@ -782,8 +779,8 @@ STORED AS rcfile
      'json_field_match_object' => 
      {
       'columns' => '[
-                 { "name" : "i", "type" : "int", "comment" : "column with comment"},
-                 { "name" : "j", "type" : "bigint" }
+                 { "name" : "i", "type" : "int", "comment" : "from deserializer"},
+                 { "name" : "j", "type" : "bigint", "comment" : "from deserializer" }
            ]' 
      },
     },
@@ -802,7 +799,7 @@ STORED AS rcfile
      },
      'json_field_match_object' => 
      {
-      'column' => '{ "name" : "i", "type" : "int", "comment" : "column with comment" }' 
+      'column' => '{ "name" : "i", "type" : "int", "comment" : "from deserializer" }' 
      },
     },
 

Modified: hive/branches/vectorization/hcatalog/storage-handlers/hbase/build.xml
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/hcatalog/storage-handlers/hbase/build.xml?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/hcatalog/storage-handlers/hbase/build.xml (original)
+++ hive/branches/vectorization/hcatalog/storage-handlers/hbase/build.xml Tue Jul  9 09:07:35 2013
@@ -63,7 +63,6 @@
     <property name="test.tmp.dir" value="${test.build.dir}/temp" />
     <property name="test.data.dir" value="${test.build.dir}/data" />
     <property name="test.timeout" value="2700000" />
-    <property name="test.junit.output.format" value="plain" />
     <property name="test.output" value="no"/>
     <property name="hive.conf.dir" value="${hive.root}/conf"/>
 

Modified: hive/branches/vectorization/hcatalog/webhcat/svr/src/main/bin/webhcat_config.sh
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/hcatalog/webhcat/svr/src/main/bin/webhcat_config.sh?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/hcatalog/webhcat/svr/src/main/bin/webhcat_config.sh (original)
+++ hive/branches/vectorization/hcatalog/webhcat/svr/src/main/bin/webhcat_config.sh Tue Jul  9 09:07:35 2013
@@ -46,7 +46,7 @@ SLEEP_TIME_AFTER_START=10
 #================================================
 
 #These parameters can be overriden by webhcat-env.sh
-# the root of the WEBHCAT installation
+# the root of the WEBHCAT installation  ('this' is defined in webhcat_server.sh)
 export WEBHCAT_PREFIX=`dirname "$this"`/..
 
 #check to see if the conf dir is given as an optional argument
@@ -62,9 +62,9 @@ then
 fi
 
 # Allow alternate conf dir location.
-if [ -e "${WEBHCAT_PREFIX}/etc/webhcat/webhcat-env.sh" ]; then
+if [ -e "${WEBHCAT_PREFIX}/etc/webhcat/webhcat-env.sh" -o -e "${WEBHCAT_PREFIX}/etc/webhcat/webhcat-site.xml" ]; then
   DEFAULT_CONF_DIR=${WEBHCAT_PREFIX}/"etc/webhcat"
-elif [ -e "${WEBHCAT_PREFIX}/conf/webhcat-env.sh" ]; then
+elif [ -e "${WEBHCAT_PREFIX}/conf/webhcat-env.sh" -o -e "${WEBHCAT_PREFIX}/etc/webhcat/webhcat-site.xml" ]; then
   DEFAULT_CONF_DIR=${WEBHCAT_PREFIX}/"conf"
 else
   DEFAULT_CONF_DIR="/etc/webhcat"

Modified: hive/branches/vectorization/hcatalog/webhcat/svr/src/main/config/webhcat-default.xml
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/hcatalog/webhcat/svr/src/main/config/webhcat-default.xml?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/hcatalog/webhcat/svr/src/main/config/webhcat-default.xml (original)
+++ hive/branches/vectorization/hcatalog/webhcat/svr/src/main/config/webhcat-default.xml Tue Jul  9 09:07:35 2013
@@ -225,4 +225,14 @@
     <description>The maximum age of a templeton job</description>
   </property>
 
+  <property>
+    <name>templeton.hadoop.queue.name</name>
+    <value>default</value>
+    <description>
+    MapReduce queue name where WebHCat map-only jobs will be
+    submitted to. Can be used to avoid a deadlock where all map slots
+    in the cluster are taken over by Templeton launcher tasks.
+    </description>
+  </property>
+
 </configuration>

Modified: hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/AppConfig.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/AppConfig.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/AppConfig.java (original)
+++ hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/AppConfig.java Tue Jul  9 09:07:35 2013
@@ -83,6 +83,7 @@ public class AppConfig extends Configura
     public static final String EXEC_MAX_BYTES_NAME = "templeton.exec.max-output-bytes";
     public static final String EXEC_MAX_PROCS_NAME = "templeton.exec.max-procs";
     public static final String EXEC_TIMEOUT_NAME   = "templeton.exec.timeout";
+    public static final String HADOOP_QUEUE_NAME   = "templeton.hadoop.queue.name";
     public static final String HADOOP_NAME         = "templeton.hadoop";
     public static final String HADOOP_CONF_DIR     = "templeton.hadoop.conf.dir";
     public static final String HCAT_NAME           = "templeton.hcat";
@@ -115,6 +116,7 @@ public class AppConfig extends Configura
     public static final String HADOOP_SPECULATIVE_NAME
         = "mapred.map.tasks.speculative.execution";
     public static final String HADOOP_CHILD_JAVA_OPTS = "mapred.child.java.opts";
+    public static final String UNIT_TEST_MODE     = "templeton.unit.test.mode";
 
     
     private static final Log LOG = LogFactory.getLog(AppConfig.class);
@@ -175,6 +177,7 @@ public class AppConfig extends Configura
 
     public String templetonJar()     { return get(TEMPLETON_JAR_NAME); }
     public String libJars()          { return get(LIB_JARS_NAME); }
+    public String hadoopQueueName()  { return get(HADOOP_QUEUE_NAME); }
     public String clusterHadoop()    { return get(HADOOP_NAME); }
     public String clusterHcat()      { return get(HCAT_NAME); }
     public String pigPath()          { return get(PIG_PATH_NAME); }

Modified: hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/BadParam.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/BadParam.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/BadParam.java (original)
+++ hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/BadParam.java Tue Jul  9 09:07:35 2013
@@ -18,11 +18,13 @@
  */
 package org.apache.hcatalog.templeton;
 
+import org.eclipse.jetty.http.HttpStatus;
+
 /**
  * Missing required or badly configured paramater.
  */
 public class BadParam extends SimpleWebException {
     public BadParam(String msg) {
-        super(400, msg);
+        super(HttpStatus.BAD_REQUEST_400, msg);
     }
 }

Modified: hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/BusyException.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/BusyException.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/BusyException.java (original)
+++ hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/BusyException.java Tue Jul  9 09:07:35 2013
@@ -18,11 +18,13 @@
  */
 package org.apache.hcatalog.templeton;
 
+import org.eclipse.jetty.http.HttpStatus;
+
 /**
  * Simple "we are busy, try again" exception.
  */
 public class BusyException extends SimpleWebException {
     public BusyException() {
-        super(503, "Busy, please retry");
+        super(HttpStatus.SERVICE_UNAVAILABLE_503, "Busy, please retry");
     }
 }

Modified: hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/CallbackFailedException.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/CallbackFailedException.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/CallbackFailedException.java (original)
+++ hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/CallbackFailedException.java Tue Jul  9 09:07:35 2013
@@ -18,11 +18,13 @@
  */
 package org.apache.hcatalog.templeton;
 
+import org.eclipse.jetty.http.HttpStatus;
+
 /**
  * The callback failed when it tried to reach the callback URL.
  */
 public class CallbackFailedException extends SimpleWebException {
     public CallbackFailedException(String msg) {
-        super(400, msg);
+        super(HttpStatus.BAD_REQUEST_400, msg);
     }
 }

Modified: hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/CatchallExceptionMapper.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/CatchallExceptionMapper.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/CatchallExceptionMapper.java (original)
+++ hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/CatchallExceptionMapper.java Tue Jul  9 09:07:35 2013
@@ -24,6 +24,7 @@ import javax.ws.rs.ext.Provider;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.eclipse.jetty.http.HttpStatus;
 
 /**
  * Map all exceptions to the Jersey response.  This lets us have nice
@@ -36,6 +37,6 @@ public class CatchallExceptionMapper
 
     public Response toResponse(Exception e) {
         LOG.error(e.getMessage(), e);
-        return SimpleWebException.buildMessage(500, null, e.getMessage());
+        return SimpleWebException.buildMessage(HttpStatus.INTERNAL_SERVER_ERROR_500, null, e.getMessage());
     }
 }

Modified: hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatDelegator.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatDelegator.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatDelegator.java (original)
+++ hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatDelegator.java Tue Jul  9 09:07:35 2013
@@ -33,7 +33,9 @@ import org.apache.commons.logging.LogFac
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.ql.ErrorMsg;
 import org.apache.hcatalog.templeton.tool.TempletonUtils;
+import org.eclipse.jetty.http.HttpStatus;
 
 
 /**
@@ -95,7 +97,15 @@ public class HcatDelegator extends Launc
             args.add("-D");
             args.add("hive.format=json");
         }
-
+        LOG.info("Main.getAppConfigInstance().get(AppConfig.UNIT_TEST_MODE)=" +
+                Main.getAppConfigInstance().get(AppConfig.UNIT_TEST_MODE));
+        if(System.getProperty("hive.metastore.warehouse.dir") != null) {
+            /*when running in unit test mode, pass this property to HCat,
+            which will in turn pass it to Hive to make sure that Hive
+            tries to write to a directory that exists.*/
+            args.add("-D");
+            args.add("hive.metastore.warehouse.dir=" + System.getProperty("hive.metastore.warehouse.dir"));
+        }
         return args;
     }
 
@@ -113,12 +123,6 @@ public class HcatDelegator extends Launc
             String res = jsonRun(user, exec);
             return JsonBuilder.create(res).build();
         } catch (HcatException e) {
-            if (e.execBean.stderr.contains("SemanticException")) {
-                return JsonBuilder.create().
-                    put("error", "Database " + db + " does not exist")
-                    .put("errorCode", "404")
-                    .put("database", db).build();
-            }
             throw new HcatException("unable to describe database: " + db,
                 e.execBean, exec);
         }
@@ -256,14 +260,6 @@ public class HcatDelegator extends Launc
                 .put("table", table)
                 .build();
         } catch (HcatException e) {
-            if (e.execBean.stderr.contains("SemanticException") &&
-                e.execBean.stderr.contains("Table not found")) {
-                return JsonBuilder.create().
-                    put("error", "Table" + db + "." + table + " does not exist" )
-                    .put("errorCode", "404")
-                    .put("table", table)
-                    .put("database", db).build();
-            }
             throw new HcatException("unable to describe database: " + db,
                 e.execBean, exec);
         }
@@ -470,8 +466,8 @@ public class HcatDelegator extends Launc
             return JsonBuilder.mapToJson(tables.get(0));
         else {
             return JsonBuilder
-                .createError(String.format("Table %s does not exist", table),
-                    JsonBuilder.MISSING).
+                .createError(ErrorMsg.INVALID_TABLE.format(table),
+                        ErrorMsg.INVALID_TABLE.getErrorCode()).
                     buildJson();
         }
     }
@@ -530,7 +526,7 @@ public class HcatDelegator extends Launc
         throws HcatException, NotAuthorizedException, BusyException,
         ExecuteException, IOException {
         Response res = descTable(user, db, table, true);
-        if (res.getStatus() != JsonBuilder.OK)
+        if (res.getStatus() != HttpStatus.OK_200)
             return res;
         Map props = tableProperties(res.getEntity());
         Map found = null;
@@ -556,7 +552,7 @@ public class HcatDelegator extends Launc
         throws HcatException, NotAuthorizedException, BusyException,
         ExecuteException, IOException {
         Response res = descTable(user, db, table, true);
-        if (res.getStatus() != JsonBuilder.OK)
+        if (res.getStatus() != HttpStatus.OK_200)
             return res;
         Map props = tableProperties(res.getEntity());
         return JsonBuilder.create()
@@ -645,7 +641,8 @@ public class HcatDelegator extends Launc
                     + table + " does not exist" + db + "." + table + " does not exist";
                 return JsonBuilder.create()
                     .put("error", emsg)
-                    .put("errorCode", "404")
+                     //this error should really be produced by Hive (DDLTask)
+                    .put("errorCode", ErrorMsg.INVALID_PARTITION.getErrorCode())
                     .put("database", db)
                     .put("table", table)
                     .put("partition", partition)
@@ -678,7 +675,8 @@ public class HcatDelegator extends Launc
             if (res.indexOf("AlreadyExistsException") > -1) {
                 return JsonBuilder.create().
                     put("error", "Partition already exists")
-                    .put("errorCode", "409")
+                     //This error code should really be produced by Hive
+                    .put("errorCode", ErrorMsg.PARTITION_EXISTS.getErrorCode())
                     .put("database", db)
                     .put("table", table)
                     .put("partition", desc.partition).build();
@@ -742,13 +740,13 @@ public class HcatDelegator extends Launc
         throws SimpleWebException, NotAuthorizedException, BusyException,
         ExecuteException, IOException {
         Response res = listColumns(user, db, table);
-        if (res.getStatus() != JsonBuilder.OK)
+        if (res.getStatus() != HttpStatus.OK_200)
             return res;
 
         Object o = res.getEntity();
         final Map fields = (o != null && (o instanceof Map)) ? (Map) o : null;
         if (fields == null)
-            throw new SimpleWebException(500, "Internal error, unable to find column "
+            throw new SimpleWebException(HttpStatus.INTERNAL_SERVER_ERROR_500, "Internal error, unable to find column "
                 + column);
 
 
@@ -763,7 +761,7 @@ public class HcatDelegator extends Launc
             }
         }
         if (found == null)
-            throw new SimpleWebException(500, "unable to find column " + column,
+            throw new SimpleWebException(HttpStatus.INTERNAL_SERVER_ERROR_500, "unable to find column " + column,
                 new HashMap<String, Object>() {
                     {
                         put("description", fields);

Modified: hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatException.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatException.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatException.java (original)
+++ hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatException.java Tue Jul  9 09:07:35 2013
@@ -18,6 +18,8 @@
  */
 package org.apache.hcatalog.templeton;
 
+import org.eclipse.jetty.http.HttpStatus;
+
 import java.util.HashMap;
 
 /**
@@ -28,7 +30,7 @@ public class HcatException extends Simpl
     public String statement;
 
     public HcatException(String msg, final ExecBean bean, final String statement) {
-        super(500, msg, new HashMap<String, Object>() {
+        super(HttpStatus.INTERNAL_SERVER_ERROR_500, msg, new HashMap<String, Object>() {
             {
                 put("exec", bean);
                 put("statement", statement);

Modified: hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/JsonBuilder.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/JsonBuilder.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/JsonBuilder.java (original)
+++ hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/JsonBuilder.java Tue Jul  9 09:07:35 2013
@@ -25,17 +25,34 @@ import java.util.Map;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
+import org.apache.hadoop.hive.ql.ErrorMsg;
 import org.apache.hcatalog.templeton.tool.TempletonUtils;
 import org.codehaus.jackson.map.ObjectMapper;
+import org.eclipse.jetty.http.HttpStatus;
 
 /**
  * Helper class to build new json objects with new top level
  * properties.  Only add non-null entries.
  */
 public class JsonBuilder {
-    static final int OK = 200;
-    static final int MISSING = 404;
-    static final int SERVER_ERROR = 500;
+    private static final Map<Object, Integer> hiveError2HttpStatusCode = new HashMap<Object, Integer>();
+
+    /**
+     * It's expected that Hive (and thus HCat CLI) will return canonical error msgs/codes.
+     * Here they are mapped to appropriate HTTP Status Code.
+     */
+    static {
+        hiveError2HttpStatusCode.put(ErrorMsg.GENERIC_ERROR.getErrorCode(), HttpStatus.INTERNAL_SERVER_ERROR_500);
+        hiveError2HttpStatusCode.put(ErrorMsg.DATABASE_NOT_EXISTS.getErrorCode(), HttpStatus.NOT_FOUND_404);
+        hiveError2HttpStatusCode.put(ErrorMsg.INVALID_TABLE.getErrorCode(), HttpStatus.NOT_FOUND_404);
+        hiveError2HttpStatusCode.put(ErrorMsg.TABLE_NOT_PARTITIONED.getErrorCode(), HttpStatus.NOT_FOUND_404);
+        hiveError2HttpStatusCode.put(ErrorMsg.INVALID_PARTITION.getErrorCode(), HttpStatus.NOT_FOUND_404);
+
+        hiveError2HttpStatusCode.put(ErrorMsg.DUPLICATE_COLUMN_NAMES.getErrorCode(), HttpStatus.CONFLICT_409);
+        hiveError2HttpStatusCode.put(ErrorMsg.DATABSAE_ALREADY_EXISTS.getErrorCode(), HttpStatus.CONFLICT_409);
+        hiveError2HttpStatusCode.put(ErrorMsg.PARTITION_EXISTS.getErrorCode(), HttpStatus.CONFLICT_409);
+        hiveError2HttpStatusCode.put(ErrorMsg.TABLE_ALREADY_EXISTS.getErrorCode(), HttpStatus.CONFLICT_409);
+    }
 
     // The map we're building.
     private Map map;
@@ -65,11 +82,11 @@ public class JsonBuilder {
     /**
      * Create a new map error object.
      */
-    public static JsonBuilder createError(String msg, int code)
+    public static JsonBuilder createError(String msg, int errorCode)
         throws IOException {
         return new JsonBuilder(null)
             .put("error", msg)
-            .put("errorCode", code);
+            .put("errorCode", errorCode);
     }
 
     /**
@@ -115,16 +132,13 @@ public class JsonBuilder {
      * Turn the map back to response object.
      */
     public Response buildResponse() {
-        int status = OK;        // Server ok.
+        int status = HttpStatus.OK_200;        // Server ok.
         if (map.containsKey("error"))
-            status = SERVER_ERROR; // Generic http server error.
+            status = HttpStatus.INTERNAL_SERVER_ERROR_500; // Generic http server error.
         Object o = map.get("errorCode");
         if (o != null) {
-            try {
-                status = Integer.parseInt(o.toString());
-            } catch (Exception e) {
-                if (o instanceof Number)
-                    status = ((Number) o).intValue();
+            if(hiveError2HttpStatusCode.containsKey(o)) {
+                status = hiveError2HttpStatusCode.get(o);
             }
         }
         return buildResponse(status);

Modified: hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/LauncherDelegator.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/LauncherDelegator.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/LauncherDelegator.java (original)
+++ hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/LauncherDelegator.java Tue Jul  9 09:07:35 2013
@@ -125,6 +125,9 @@ public class LauncherDelegator extends T
         addDef(args, TempletonControllerJob.OVERRIDE_CLASSPATH,
             makeOverrideClasspath(appConf));
 
+        // Hadoop queue information
+        addDef(args, "mapred.job.queue.name", appConf.hadoopQueueName());
+
         // Job vars
         addStorageVars(args);
         addCompletionVars(args, completedUrl);

Modified: hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/Main.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/Main.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/Main.java (original)
+++ hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/Main.java Tue Jul  9 09:07:35 2013
@@ -50,6 +50,7 @@ public class Main {
     private static final Log LOG = LogFactory.getLog(Main.class);
 
     public static final int DEFAULT_PORT = 8080;
+    private Server server;
 
     private static volatile AppConfig conf;
 
@@ -62,7 +63,7 @@ public class Main {
         return conf;
     }
 
-    public Main(String[] args) {
+    Main(String[] args) {
         init(args);
     }
 
@@ -115,6 +116,17 @@ public class Main {
             System.exit(1);
         }
     }
+    void stop() {
+        if(server != null) {
+            try {
+                server.stop();
+            }
+            catch(Exception ex) {
+                LOG.warn("Failed to stop jetty.Server", ex);
+            }
+        }
+    }
+
 
     private void checkEnv() {
         checkCurrentDirPermissions();
@@ -179,6 +191,7 @@ public class Main {
 
         // Start the server
         server.start();
+        this.server = server;
         return server;
     }
 

Modified: hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/NotAuthorizedException.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/NotAuthorizedException.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/NotAuthorizedException.java (original)
+++ hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/NotAuthorizedException.java Tue Jul  9 09:07:35 2013
@@ -18,11 +18,13 @@
  */
 package org.apache.hcatalog.templeton;
 
+import org.eclipse.jetty.http.HttpStatus;
+
 /**
  * Simple "user not found" type exception.
  */
 public class NotAuthorizedException extends SimpleWebException {
     public NotAuthorizedException(String msg) {
-        super(401, msg);
+        super(HttpStatus.UNAUTHORIZED_401, msg);
     }
 }

Modified: hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/QueueException.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/QueueException.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/QueueException.java (original)
+++ hive/branches/vectorization/hcatalog/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/QueueException.java Tue Jul  9 09:07:35 2013
@@ -18,12 +18,14 @@
  */
 package org.apache.hcatalog.templeton;
 
+import org.eclipse.jetty.http.HttpStatus;
+
 /**
  * Unable to queue the job
  */
 public class QueueException extends SimpleWebException {
     public QueueException(String msg) {
-        super(500, msg);
+        super(HttpStatus.INTERNAL_SERVER_ERROR_500, msg);
     }
 
 }

Modified: hive/branches/vectorization/ivy/libraries.properties
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/ivy/libraries.properties?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/ivy/libraries.properties (original)
+++ hive/branches/vectorization/ivy/libraries.properties Tue Jul  9 09:07:35 2013
@@ -47,7 +47,7 @@ guava.version=11.0.2
 hbase.version=0.94.6.1
 jackson.version=1.8.8
 javaewah.version=0.3.2
-jdo-api.version=2.3-ec
+jdo-api.version=3.0.1
 jdom.version=1.1
 jetty.version=6.1.26
 jline.version=0.9.94

Modified: hive/branches/vectorization/jdbc/src/java/org/apache/hadoop/hive/jdbc/HivePreparedStatement.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/jdbc/src/java/org/apache/hadoop/hive/jdbc/HivePreparedStatement.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/jdbc/src/java/org/apache/hadoop/hive/jdbc/HivePreparedStatement.java (original)
+++ hive/branches/vectorization/jdbc/src/java/org/apache/hadoop/hive/jdbc/HivePreparedStatement.java Tue Jul  9 09:07:35 2013
@@ -39,6 +39,7 @@ import java.sql.SQLWarning;
 import java.sql.SQLXML;
 import java.sql.Time;
 import java.sql.Timestamp;
+import java.text.MessageFormat;
 import java.util.Calendar;
 import java.util.HashMap;
 
@@ -648,8 +649,32 @@ public class HivePreparedStatement imple
    */
 
   public void setObject(int parameterIndex, Object x) throws SQLException {
-    // TODO Auto-generated method stub
-    throw new SQLException("Method not supported");
+    if (x instanceof String) {
+      setString(parameterIndex, (String) x);
+    } else if (x instanceof Short) {
+      setShort(parameterIndex, ((Short) x).shortValue());
+    } else if (x instanceof Integer) {
+      setInt(parameterIndex, ((Integer) x).intValue());
+    } else if (x instanceof Long) {
+      setLong(parameterIndex, ((Long) x).longValue());
+    } else if (x instanceof Float) {
+      setFloat(parameterIndex, ((Float) x).floatValue());
+    } else if (x instanceof Double) {
+      setDouble(parameterIndex, ((Double) x).doubleValue());
+    } else if (x instanceof Boolean) {
+      setBoolean(parameterIndex, ((Boolean) x).booleanValue());
+    } else if (x instanceof Byte) {
+      setByte(parameterIndex, ((Byte) x).byteValue());
+    } else if (x instanceof Character) {
+      setString(parameterIndex, ((Character) x).toString());
+    } else {
+      // Can't infer a type.
+      throw new SQLException(
+          MessageFormat
+              .format(
+                  "Can''t infer the SQL type to use for an instance of {0}. Use setObject() with an explicit Types value to specify the type to use.",
+                  x.getClass().getName()));
+    }
   }
 
   /*

Modified: hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveBaseResultSet.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveBaseResultSet.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveBaseResultSet.java (original)
+++ hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveBaseResultSet.java Tue Jul  9 09:07:35 2013
@@ -499,6 +499,9 @@ public abstract class HiveBaseResultSet 
       return getTimestampValue(tColumnValue.getStringVal());
     case DECIMAL_TYPE:
       return getBigDecimalValue(tColumnValue.getStringVal());
+    case NULL_TYPE:
+      wasNull = true;
+      return null;
     default:
       throw new SQLException("Unrecognized column type:" + columnType);
     }

Modified: hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveCallableStatement.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveCallableStatement.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveCallableStatement.java (original)
+++ hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveCallableStatement.java Tue Jul  9 09:07:35 2013
@@ -462,6 +462,16 @@ public class HiveCallableStatement imple
     throw new SQLException("Method not supported");
   }
 
+  public <T> T getObject(int parameterIndex, Class<T> type) throws SQLException {
+    // TODO JDK 1.7
+    throw new SQLException("Method not supported");
+  }
+
+  public <T> T getObject(String parameterName, Class<T> type) throws SQLException {
+    // TODO JDK 1.7
+    throw new SQLException("Method not supported");
+  }
+
   /*
    * (non-Javadoc)
    *
@@ -2030,6 +2040,16 @@ public class HiveCallableStatement imple
     throw new SQLException("Method not supported");
   }
 
+  public void closeOnCompletion() throws SQLException {
+    // JDK 1.7
+    throw new SQLException("Method not supported");
+  }
+
+  public boolean isCloseOnCompletion() throws SQLException {
+    // JDK 1.7
+    throw new SQLException("Method not supported");
+  }
+
   /*
    * (non-Javadoc)
    *

Modified: hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java (original)
+++ hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java Tue Jul  9 09:07:35 2013
@@ -33,6 +33,7 @@ import java.sql.SQLXML;
 import java.sql.Savepoint;
 import java.sql.Statement;
 import java.sql.Struct;
+import java.util.concurrent.Executor;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -160,27 +161,32 @@ public class HiveConnection implements j
     }
   }
 
-    private void openSession(String uri) throws SQLException {
-      TOpenSessionReq openReq = new TOpenSessionReq();
+  private void openSession(String uri) throws SQLException {
+    TOpenSessionReq openReq = new TOpenSessionReq();
 
-      // set the session configuration
-      // openReq.setConfiguration(null);
+    // set the session configuration
+    // openReq.setConfiguration(null);
 
-      try {
-        TOpenSessionResp openResp = client.OpenSession(openReq);
+    try {
+      TOpenSessionResp openResp = client.OpenSession(openReq);
 
-        // validate connection
-        Utils.verifySuccess(openResp.getStatus());
-        if (!supportedProtocols.contains(openResp.getServerProtocolVersion())) {
-          throw new TException("Unsupported Hive2 protocol");
-        }
-        sessHandle = openResp.getSessionHandle();
-      } catch (TException e) {
-        throw new SQLException("Could not establish connection to "
-            + uri + ": " + e.getMessage(), " 08S01", e);
+      // validate connection
+      Utils.verifySuccess(openResp.getStatus());
+      if (!supportedProtocols.contains(openResp.getServerProtocolVersion())) {
+        throw new TException("Unsupported Hive2 protocol");
       }
-      isClosed = false;
+      sessHandle = openResp.getSessionHandle();
+    } catch (TException e) {
+      throw new SQLException("Could not establish connection to "
+          + uri + ": " + e.getMessage(), " 08S01", e);
     }
+    isClosed = false;
+  }
+
+  public void abort(Executor executor) throws SQLException {
+    // JDK 1.7
+    throw new SQLException("Method not supported");
+  }
 
   /*
    * (non-Javadoc)
@@ -395,6 +401,17 @@ public class HiveConnection implements j
     return new HiveDatabaseMetaData(client, sessHandle);
   }
 
+  public int getNetworkTimeout() throws SQLException {
+    // JDK 1.7
+    throw new SQLException("Method not supported");
+  }
+
+
+  public String getSchema() throws SQLException {
+    // JDK 1.7
+    throw new SQLException("Method not supported");
+  }
+
   /*
    * (non-Javadoc)
    *
@@ -663,6 +680,11 @@ public class HiveConnection implements j
     throw new SQLException("Method not supported");
   }
 
+  public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
+    // JDK 1.7
+    throw new SQLException("Method not supported");
+  }
+
   /*
    * (non-Javadoc)
    *
@@ -696,6 +718,11 @@ public class HiveConnection implements j
     throw new SQLException("Method not supported");
   }
 
+  public void setSchema(String schema) throws SQLException {
+    // JDK 1.7
+    throw new SQLException("Method not supported");
+  }
+
   /*
    * (non-Javadoc)
    *

Modified: hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveDataSource.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveDataSource.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveDataSource.java (original)
+++ hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveDataSource.java Tue Jul  9 09:07:35 2013
@@ -21,6 +21,8 @@ package org.apache.hive.jdbc;
 import java.io.PrintWriter;
 import java.sql.Connection;
 import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.logging.Logger;
 
 import javax.sql.DataSource;
 
@@ -84,6 +86,11 @@ public class HiveDataSource implements D
     throw new SQLException("Method not supported");
   }
 
+  public Logger getParentLogger() throws SQLFeatureNotSupportedException {
+    // JDK 1.7
+    throw new SQLFeatureNotSupportedException("Method not supported");
+  }
+
   /*
    * (non-Javadoc)
    * 

Modified: hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveDatabaseMetaData.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveDatabaseMetaData.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveDatabaseMetaData.java (original)
+++ hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveDatabaseMetaData.java Tue Jul  9 09:07:35 2013
@@ -144,6 +144,17 @@ public class HiveDatabaseMetaData implem
     throw new SQLException("Method not supported");
   }
 
+  public ResultSet getPseudoColumns(String catalog, String schemaPattern,
+      String tableNamePattern, String columnNamePattern) throws SQLException {
+    // JDK 1.7
+    throw new SQLException("Method not supported");
+  }
+
+  public boolean generatedKeyAlwaysReturned() throws SQLException {
+    // JDK 1.7
+    throw new SQLException("Method not supported");
+  }
+
   /**
    * Convert a pattern containing JDBC catalog search wildcards into
    * Java regex patterns.
@@ -709,6 +720,16 @@ public class HiveDatabaseMetaData implem
       public boolean next() throws SQLException {
         return false;
       }
+
+      public <T> T getObject(String columnLabel, Class<T> type) throws SQLException {
+        // JDK 1.7
+        throw new SQLException("Method not supported");
+      }
+
+      public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
+        // JDK 1.7
+        throw new SQLException("Method not supported");
+        }
     };
   }
 

Modified: hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveDriver.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveDriver.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveDriver.java (original)
+++ hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveDriver.java Tue Jul  9 09:07:35 2013
@@ -24,9 +24,11 @@ import java.sql.Connection;
 import java.sql.Driver;
 import java.sql.DriverPropertyInfo;
 import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
 import java.util.Properties;
 import java.util.jar.Attributes;
 import java.util.jar.Manifest;
+import java.util.logging.Logger;
 import java.util.regex.Pattern;
 /**
  * HiveDriver.
@@ -171,6 +173,11 @@ public class HiveDriver implements Drive
     return HiveDriver.getMinorDriverVersion();
   }
 
+  public Logger getParentLogger() throws SQLFeatureNotSupportedException {
+    // JDK 1.7
+    throw new SQLFeatureNotSupportedException("Method not supported");
+  }
+
   public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException {
     if (info == null) {
       info = new Properties();

Modified: hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HivePreparedStatement.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HivePreparedStatement.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HivePreparedStatement.java (original)
+++ hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HivePreparedStatement.java Tue Jul  9 09:07:35 2013
@@ -858,6 +858,11 @@ public class HivePreparedStatement imple
      warningChain=null;
   }
 
+  public void closeOnCompletion() throws SQLException {
+    // JDK 1.7
+    throw new SQLException("Method not supported");
+  }
+
   /**
    *  Closes the prepared statement.
    *
@@ -1154,6 +1159,11 @@ public class HivePreparedStatement imple
     return isClosed;
   }
 
+  public boolean isCloseOnCompletion() throws SQLException {
+    //JDK 1.7
+    throw new SQLException("Method not supported");
+  }
+
   /*
    * (non-Javadoc)
    *

Modified: hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveQueryResultSet.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveQueryResultSet.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveQueryResultSet.java (original)
+++ hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveQueryResultSet.java Tue Jul  9 09:07:35 2013
@@ -274,4 +274,13 @@ public class HiveQueryResultSet extends 
     return fetchSize;
   }
 
+  public <T> T getObject(String columnLabel, Class<T> type)  throws SQLException {
+    //JDK 1.7
+    throw new SQLException("Method not supported");
+  }
+
+  public <T> T getObject(int columnIndex, Class<T> type)  throws SQLException {
+    //JDK 1.7
+    throw new SQLException("Method not supported");
+  }
 }

Modified: hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveResultSetMetaData.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveResultSetMetaData.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveResultSetMetaData.java (original)
+++ hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveResultSetMetaData.java Tue Jul  9 09:07:35 2013
@@ -82,14 +82,7 @@ public class HiveResultSetMetaData imple
   }
 
   public String getColumnTypeName(int column) throws SQLException {
-    if (columnTypes == null) {
-      throw new SQLException(
-          "Could not determine column type name for ResultSet");
-    }
-
-    if (column < 1 || column > columnTypes.size()) {
-      throw new SQLException("Invalid column value: " + column);
-    }
+    validateColumnType(column);
 
     // we need to convert the Hive type to the SQL type name
     // TODO: this would be better handled in an enum
@@ -116,6 +109,8 @@ public class HiveResultSetMetaData imple
       return serdeConstants.DECIMAL_TYPE_NAME;
     } else if ("binary".equalsIgnoreCase(type)) {
       return serdeConstants.BINARY_TYPE_NAME;
+    } else if ("void".equalsIgnoreCase(type)) {
+      return serdeConstants.VOID_TYPE_NAME;
     } else if (type.startsWith("map<")) {
       return serdeConstants.STRING_TYPE_NAME;
     } else if (type.startsWith("array<")) {
@@ -153,7 +148,17 @@ public class HiveResultSetMetaData imple
   }
 
   public boolean isCaseSensitive(int column) throws SQLException {
-    throw new SQLException("Method not supported");
+    validateColumnType(column);
+
+    // we need to convert the Hive type to the SQL type name
+    // TODO: this would be better handled in an enum
+    String type = columnTypes.get(column - 1);
+
+    if("string".equalsIgnoreCase(type)) {
+      return true;
+    } else {
+      return false;
+    }
   }
 
   public boolean isCurrency(int column) throws SQLException {
@@ -194,4 +199,14 @@ public class HiveResultSetMetaData imple
     throw new SQLException("Method not supported");
   }
 
+  protected void validateColumnType(int column) throws SQLException {
+    if (columnTypes == null) {
+      throw new SQLException(
+          "Could not determine column type name for ResultSet");
+    }
+
+    if (column < 1 || column > columnTypes.size()) {
+      throw new SQLException("Invalid column value: " + column);
+    }    
+  }
 }

Modified: hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java (original)
+++ hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java Tue Jul  9 09:07:35 2013
@@ -163,6 +163,11 @@ public class HiveStatement implements ja
     isClosed = true;
   }
 
+  public void closeOnCompletion() throws SQLException {
+    // JDK 1.7
+    throw new SQLException("Method not supported");
+  }
+
   /*
    * (non-Javadoc)
    *
@@ -450,6 +455,11 @@ public class HiveStatement implements ja
     return isClosed;
   }
 
+  public boolean isCloseOnCompletion() throws SQLException {
+    // JDK 1.7
+    throw new SQLException("Method not supported");
+  }
+
   /*
    * (non-Javadoc)
    *

Modified: hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/Utils.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/Utils.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/Utils.java (original)
+++ hive/branches/vectorization/jdbc/src/java/org/apache/hive/jdbc/Utils.java Tue Jul  9 09:07:35 2013
@@ -190,8 +190,19 @@ public class Utils {
       connParams.setEmbeddedMode(true);
       return connParams;
     }
+
     URI jdbcURI = URI.create(uri.substring(URI_JDBC_PREFIX.length()));
 
+    //Check to prevent unintentional use of embedded mode. A missing "/" can
+    // to separate the 'path' portion of URI can result in this.
+    //The missing "/" common typo while using secure mode, eg of such url -
+    // jdbc:hive2://localhost:10000;principal=hive/HiveServer2Host@YOUR-REALM.COM
+    if((jdbcURI.getAuthority() != null) && (jdbcURI.getHost()==null)){
+       throw new IllegalArgumentException("Bad URL format. Hostname not found "
+           + " in authority part of the url: " + jdbcURI.getAuthority()
+           + ". Are you missing a '/' after the hostname ?");
+    }
+
     connParams.setHost(jdbcURI.getHost());
     if (connParams.getHost() == null) {
       connParams.setEmbeddedMode(true);

Modified: hive/branches/vectorization/jdbc/src/test/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/jdbc/src/test/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/jdbc/src/test/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java (original)
+++ hive/branches/vectorization/jdbc/src/test/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java Tue Jul  9 09:07:35 2013
@@ -32,6 +32,7 @@ import java.sql.SQLException;
 import java.sql.Statement;
 import java.sql.Types;
 import java.util.Arrays;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -229,49 +230,18 @@ public class TestJdbcDriver extends Test
 
      ///////////////////////////////////////////////
     //////////////////// correct testcase
+    //////////////////// executed twice: once with the typed ps setters, once with the generic setObject
     //////////////////////////////////////////////
     try {
-      PreparedStatement ps = con.prepareStatement(sql);
-
-      ps.setBoolean(1, true);
-      ps.setBoolean(2, true);
-
-      ps.setShort(3, Short.valueOf("1"));
-      ps.setInt(4, 2);
-      ps.setFloat(5, 3f);
-      ps.setDouble(6, Double.valueOf(4));
-      ps.setString(7, "test'string\"");
-      ps.setLong(8, 5L);
-      ps.setByte(9, (byte) 1);
-      ps.setByte(10, (byte) 1);
-
-      ps.setMaxRows(2);
-
-      assertTrue(true);
-
+      PreparedStatement ps = createPreapredStatementUsingSetXXX(sql);
       ResultSet res = ps.executeQuery();
-      assertNotNull(res);
-
-      while (res.next()) {
-        assertEquals("2011-03-25", res.getString("ddate"));
-        assertEquals("10", res.getString("num"));
-        assertEquals((byte) 10, res.getByte("num"));
-        assertEquals("2011-03-25", res.getDate("ddate").toString());
-        assertEquals(Double.valueOf(10).doubleValue(), res.getDouble("num"), 0.1);
-        assertEquals(10, res.getInt("num"));
-        assertEquals(Short.valueOf("10").shortValue(), res.getShort("num"));
-        assertEquals(10L, res.getLong("num"));
-        assertEquals(true, res.getBoolean("bv"));
-        Object o = res.getObject("ddate");
-        assertNotNull(o);
-        o = res.getObject("num");
-        assertNotNull(o);
-      }
-      res.close();
-      assertTrue(true);
+      assertPreparedStatementResultAsExpected(res);
+      ps.close();
 
+      ps = createPreapredStatementUsingSetObject(sql);
+      res = ps.executeQuery();
+      assertPreparedStatementResultAsExpected(res);
       ps.close();
-      assertTrue(true);
 
     } catch (Exception e) {
       e.printStackTrace();
@@ -326,6 +296,80 @@ public class TestJdbcDriver extends Test
     assertNotNull(
         "Execute the invalid setted sql statement should throw exception",
         expectedException);
+    
+    // setObject to the yet unknown type java.util.Date
+    expectedException = null;
+    try {
+      PreparedStatement ps = con.prepareStatement(sql);
+      ps.setObject(1, new Date());
+      ps.executeQuery();
+    } catch (Exception e) {
+      expectedException = e;
+    }
+    assertNotNull(
+        "Setting to an unknown type should throw an exception",
+        expectedException);
+
+  }
+
+  private PreparedStatement createPreapredStatementUsingSetObject(String sql) throws SQLException {
+    PreparedStatement ps = con.prepareStatement(sql);
+
+    ps.setObject(1, true); //setBoolean
+    ps.setObject(2, true); //setBoolean
+
+    ps.setObject(3, Short.valueOf("1")); //setShort
+    ps.setObject(4, 2); //setInt
+    ps.setObject(5, 3f); //setFloat
+    ps.setObject(6, Double.valueOf(4)); //setDouble
+    ps.setObject(7, "test'string\""); //setString
+    ps.setObject(8, 5L); //setLong
+    ps.setObject(9, (byte) 1); //setByte
+    ps.setObject(10, (byte) 1); //setByte
+
+    ps.setMaxRows(2);
+    return ps;
+  }
+
+  private PreparedStatement createPreapredStatementUsingSetXXX(String sql) throws SQLException {
+    PreparedStatement ps = con.prepareStatement(sql);
+
+    ps.setBoolean(1, true); //setBoolean
+    ps.setBoolean(2, true); //setBoolean
+
+    ps.setShort(3, Short.valueOf("1")); //setShort
+    ps.setInt(4, 2); //setInt
+    ps.setFloat(5, 3f); //setFloat
+    ps.setDouble(6, Double.valueOf(4)); //setDouble
+    ps.setString(7, "test'string\""); //setString
+    ps.setLong(8, 5L); //setLong
+    ps.setByte(9, (byte) 1); //setByte
+    ps.setByte(10, (byte) 1); //setByte
+
+    ps.setMaxRows(2);
+    return ps;
+  }
+
+  private void assertPreparedStatementResultAsExpected(ResultSet res ) throws SQLException {
+    assertNotNull(res);
+
+    while (res.next()) {
+      assertEquals("2011-03-25", res.getString("ddate"));
+      assertEquals("10", res.getString("num"));
+      assertEquals((byte) 10, res.getByte("num"));
+      assertEquals("2011-03-25", res.getDate("ddate").toString());
+      assertEquals(Double.valueOf(10).doubleValue(), res.getDouble("num"), 0.1);
+      assertEquals(10, res.getInt("num"));
+      assertEquals(Short.valueOf("10").shortValue(), res.getShort("num"));
+      assertEquals(10L, res.getLong("num"));
+      assertEquals(true, res.getBoolean("bv"));
+      Object o = res.getObject("ddate");
+      assertNotNull(o);
+      o = res.getObject("num");
+      assertNotNull(o);
+    }
+    res.close();
+    assertTrue(true);
   }
 
   public final void testSelectAll() throws Exception {
@@ -348,6 +392,17 @@ public class TestJdbcDriver extends Test
     doTestSelectAll(tableName, 100, 20);
   }
 
+  public void testNullType() throws Exception {
+    Statement stmt = con.createStatement();
+    try {
+      ResultSet res = stmt.executeQuery("select null from " + dataTypeTableName);
+      assertTrue(res.next());
+      assertNull(res.getObject(1));
+    } finally {
+      stmt.close();
+    }
+  }
+
   public void testDataTypes() throws Exception {
     Statement stmt = con.createStatement();
 

Modified: hive/branches/vectorization/jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java (original)
+++ hive/branches/vectorization/jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java Tue Jul  9 09:07:35 2013
@@ -195,6 +195,24 @@ public class TestJdbcDriver2 extends Tes
         expectedException);
   }
 
+  public void testBadURL() throws Exception {
+    checkBadUrl("jdbc:hive2://localhost:10000;principal=test");
+    checkBadUrl("jdbc:hive2://localhost:10000;" +
+    		"principal=hive/HiveServer2Host@YOUR-REALM.COM");
+    checkBadUrl("jdbc:hive2://localhost:10000test");
+  }
+
+
+  private void checkBadUrl(String url) throws SQLException {
+    try{
+      DriverManager.getConnection(url, "", "");
+      fail("should have thrown IllegalArgumentException but did not ");
+    }catch(IllegalArgumentException i){
+      assertTrue(i.getMessage().contains("Bad URL format. Hostname not found "
+          + " in authority part of the url"));
+    }
+  }
+
   public void testDataTypes2() throws Exception {
     Statement stmt = con.createStatement();
 
@@ -383,6 +401,17 @@ public class TestJdbcDriver2 extends Tes
     doTestSelectAll(tableName, 100, 20);
   }
 
+  public void testNullType() throws Exception {
+    Statement stmt = con.createStatement();
+    try {
+      ResultSet res = stmt.executeQuery("select null from " + dataTypeTableName);
+      assertTrue(res.next());
+      assertNull(res.getObject(1));
+    } finally {
+      stmt.close();
+    }
+  }
+
   public void testDataTypes() throws Exception {
     Statement stmt = con.createStatement();
 
@@ -467,6 +496,12 @@ public class TestJdbcDriver2 extends Tes
     assertEquals(true, res.getBoolean(1));
     assertEquals(true, res.getBoolean(4));
 
+    // test case sensitivity
+    assertFalse(meta.isCaseSensitive(1));
+    assertFalse(meta.isCaseSensitive(2));
+    assertFalse(meta.isCaseSensitive(3));
+    assertTrue(meta.isCaseSensitive(4));
+
     // no more rows
     assertFalse(res.next());
   }
@@ -637,6 +672,14 @@ public class TestJdbcDriver2 extends Tes
 
     for (String checkPattern: tests.keySet()) {
       ResultSet rs = (ResultSet)con.getMetaData().getTables("default", null, checkPattern, null);
+      ResultSetMetaData resMeta = rs.getMetaData();
+      assertEquals(5, resMeta.getColumnCount());
+      assertEquals("TABLE_CAT", resMeta.getColumnName(1));
+      assertEquals("TABLE_SCHEM", resMeta.getColumnName(2));
+      assertEquals("TABLE_NAME", resMeta.getColumnName(3));
+      assertEquals("TABLE_TYPE", resMeta.getColumnName(4));
+      assertEquals("REMARKS", resMeta.getColumnName(5));
+
       int cnt = 0;
       while (rs.next()) {
         String resultTableName = rs.getString("TABLE_NAME");
@@ -678,7 +721,7 @@ public class TestJdbcDriver2 extends Tes
     ResultSet rs = (ResultSet)con.getMetaData().getSchemas();
     ResultSetMetaData resMeta = rs.getMetaData();
     assertEquals(2, resMeta.getColumnCount());
-    assertEquals("TABLE_SCHEMA", resMeta.getColumnName(1));
+    assertEquals("TABLE_SCHEM", resMeta.getColumnName(1));
     assertEquals("TABLE_CATALOG", resMeta.getColumnName(2));
 
     assertTrue(rs.next());
@@ -1275,4 +1318,6 @@ public class TestJdbcDriver2 extends Tes
     assertNull(conn);
   }
 
+
+
 }

Modified: hive/branches/vectorization/metastore/ivy.xml
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/metastore/ivy.xml?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/metastore/ivy.xml (original)
+++ hive/branches/vectorization/metastore/ivy.xml Tue Jul  9 09:07:35 2013
@@ -44,7 +44,7 @@
                 transitive="false"/>
     <dependency org="org.datanucleus" name="datanucleus-rdbms" rev="${datanucleus-rdbms.version}"
                 transitive="false"/>
-    <dependency org="javax.jdo" name="jdo2-api" rev="${jdo-api.version}"
+    <dependency org="javax.jdo" name="jdo-api" rev="${jdo-api.version}"
                 transitive="false"/>
     <dependency org="org.apache.derby" name="derby" rev="${derby.version}"/>
     <dependency org="asm" name="asm" rev="${asm.version}"/>

Modified: hive/branches/vectorization/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SkewedInfo.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SkewedInfo.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SkewedInfo.java (original)
+++ hive/branches/vectorization/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SkewedInfo.java Tue Jul  9 09:07:35 2013
@@ -125,7 +125,7 @@ public class SkewedInfo implements org.a
                 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))));
     tmpMap.put(_Fields.SKEWED_COL_VALUE_LOCATION_MAPS, new org.apache.thrift.meta_data.FieldMetaData("skewedColValueLocationMaps", org.apache.thrift.TFieldRequirementType.DEFAULT, 
         new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
-            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, SkewedValueList.class),
+            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, SkewedValueList.class), 
             new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
     metaDataMap = Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SkewedInfo.class, metaDataMap);

Modified: hive/branches/vectorization/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SkewedValueList.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SkewedValueList.java?rev=1501145&r1=1501144&r2=1501145&view=diff
==============================================================================
--- hive/branches/vectorization/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SkewedValueList.java (original)
+++ hive/branches/vectorization/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SkewedValueList.java Tue Jul  9 09:07:35 2013
@@ -106,8 +106,8 @@ public class SkewedValueList implements 
   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
   static {
     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.SKEWED_VALUE_LIST, new org.apache.thrift.meta_data.FieldMetaData("skewedValueList", org.apache.thrift.TFieldRequirementType.DEFAULT,
-        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
+    tmpMap.put(_Fields.SKEWED_VALUE_LIST, new org.apache.thrift.meta_data.FieldMetaData("skewedValueList", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
             new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
     metaDataMap = Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SkewedValueList.class, metaDataMap);
@@ -339,7 +339,7 @@ public class SkewedValueList implements 
       while (true)
       {
         schemeField = iprot.readFieldBegin();
-        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
           break;
         }
         switch (schemeField.id) {
@@ -357,7 +357,7 @@ public class SkewedValueList implements 
                 iprot.readListEnd();
               }
               struct.setSkewedValueListIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;