Modified: 
hive/branches/maven/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorUtils.java
URL: 
http://svn.apache.org/viewvc/hive/branches/maven/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorUtils.java?rev=1526996&r1=1526995&r2=1526996&view=diff
==============================================================================
--- 
hive/branches/maven/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorUtils.java
 (original)
+++ 
hive/branches/maven/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorUtils.java
 Fri Sep 27 17:41:42 2013
@@ -1166,7 +1166,8 @@ public final class PrimitiveObjectInspec
    * Provide a general grouping for each primitive data type.
    */
   public static enum PrimitiveGrouping {
-    NUMERIC_GROUP, STRING_GROUP, BOOLEAN_GROUP, DATE_GROUP, BINARY_GROUP, 
UNKNOWN_GROUP
+    NUMERIC_GROUP, STRING_GROUP, BOOLEAN_GROUP, DATE_GROUP, BINARY_GROUP,
+    VOID_GROUP, UNKNOWN_GROUP
   };
 
   /**
@@ -1196,6 +1197,8 @@ public final class PrimitiveObjectInspec
         return PrimitiveGrouping.DATE_GROUP;
       case BINARY:
         return PrimitiveGrouping.BINARY_GROUP;
+      case VOID:
+        return PrimitiveGrouping.VOID_GROUP;
       default:
         return PrimitiveGrouping.UNKNOWN_GROUP;
     }

Modified: 
hive/branches/maven/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableDateObjectInspector.java
URL: 
http://svn.apache.org/viewvc/hive/branches/maven/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableDateObjectInspector.java?rev=1526996&r1=1526995&r2=1526996&view=diff
==============================================================================
--- 
hive/branches/maven/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableDateObjectInspector.java
 (original)
+++ 
hive/branches/maven/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableDateObjectInspector.java
 Fri Sep 27 17:41:42 2013
@@ -46,11 +46,17 @@ public class WritableDateObjectInspector
   }
 
   public Object set(Object o, Date d) {
+    if (d == null) {
+      return null;
+    }
     ((DateWritable) o).set(d);
     return o;
   }
 
   public Object set(Object o, DateWritable d) {
+    if (d == null) {
+      return null;
+    }
     ((DateWritable) o).set(d);
     return o;
   }

Modified: 
hive/branches/maven/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableHiveVarcharObjectInspector.java
URL: 
http://svn.apache.org/viewvc/hive/branches/maven/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableHiveVarcharObjectInspector.java?rev=1526996&r1=1526995&r2=1526996&view=diff
==============================================================================
--- 
hive/branches/maven/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableHiveVarcharObjectInspector.java
 (original)
+++ 
hive/branches/maven/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableHiveVarcharObjectInspector.java
 Fri Sep 27 17:41:42 2013
@@ -21,11 +21,9 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hive.common.type.HiveVarchar;
 import org.apache.hadoop.hive.serde2.io.HiveVarcharWritable;
-import 
org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector.PrimitiveCategory;
 import 
org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils.PrimitiveTypeEntry;
-import org.apache.hadoop.hive.serde2.typeinfo.BaseTypeParams;
-import org.apache.hadoop.hive.serde2.typeinfo.VarcharTypeParams;
 import org.apache.hadoop.hive.serde2.typeinfo.ParameterizedPrimitiveTypeUtils;
+import org.apache.hadoop.hive.serde2.typeinfo.VarcharTypeParams;
 
 public class WritableHiveVarcharObjectInspector
     extends AbstractPrimitiveWritableObjectInspector
@@ -59,6 +57,7 @@ public class WritableHiveVarcharObjectIn
     return getPrimitiveWithParams(writable);
   }
 
+  @Override
   public HiveVarcharWritable getPrimitiveWritableObject(Object o) {
     // check input object's length, if it doesn't match
     // then output new writable with correct params.
@@ -87,12 +86,7 @@ public class WritableHiveVarcharObjectIn
 
   private boolean doesWritableMatchTypeParams(HiveVarcharWritable writable) {
     return ParameterizedPrimitiveTypeUtils.doesWritableMatchTypeParams(
-        writable, (VarcharTypeParams) typeParams);
-  }
-
-  private boolean doesPrimitiveMatchTypeParams(HiveVarchar value) {
-    return ParameterizedPrimitiveTypeUtils.doesPrimitiveMatchTypeParams(
-        value, (VarcharTypeParams) typeParams);
+        writable, (VarcharTypeParams)getTypeParams());
   }
 
   @Override
@@ -130,6 +124,8 @@ public class WritableHiveVarcharObjectIn
   }
 
   public int getMaxLength() {
-    return typeParams != null ? ((VarcharTypeParams) typeParams).length : -1;
+    VarcharTypeParams typeParams = (VarcharTypeParams)getTypeParams();
+    return typeParams != null ? typeParams.length : -1;
   }
+
 }

Modified: 
hive/branches/maven/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableTimestampObjectInspector.java
URL: 
http://svn.apache.org/viewvc/hive/branches/maven/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableTimestampObjectInspector.java?rev=1526996&r1=1526995&r2=1526996&view=diff
==============================================================================
--- 
hive/branches/maven/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableTimestampObjectInspector.java
 (original)
+++ 
hive/branches/maven/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableTimestampObjectInspector.java
 Fri Sep 27 17:41:42 2013
@@ -48,11 +48,17 @@ public class WritableTimestampObjectInsp
   }
 
   public Object set(Object o, Timestamp t) {
+    if (t == null) {
+      return null;
+    }
     ((TimestampWritable) o).set(t);
     return o;
   }
 
   public Object set(Object o, TimestampWritable t) {
+    if (t == null) {
+      return null;
+    }
     ((TimestampWritable) o).set(t);
     return o;
   }

Modified: 
hive/branches/maven/serde/src/test/org/apache/hadoop/hive/serde2/lazy/TestLazySimpleSerDe.java
URL: 
http://svn.apache.org/viewvc/hive/branches/maven/serde/src/test/org/apache/hadoop/hive/serde2/lazy/TestLazySimpleSerDe.java?rev=1526996&r1=1526995&r2=1526996&view=diff
==============================================================================
--- 
hive/branches/maven/serde/src/test/org/apache/hadoop/hive/serde2/lazy/TestLazySimpleSerDe.java
 (original)
+++ 
hive/branches/maven/serde/src/test/org/apache/hadoop/hive/serde2/lazy/TestLazySimpleSerDe.java
 Fri Sep 27 17:41:42 2013
@@ -62,12 +62,12 @@ public class TestLazySimpleSerDe extends
       // Data
       Text t = new Text("123\t456\t789\t1000\t5.3\thive and 
hadoop\t1.\tNULL\t");
       t.append(new byte[]{(byte)Integer.parseInt("10111111", 2)}, 0, 1);
-      StringBuffer sb = new StringBuffer("123\t456\t789\t1000\t5.3\thive and 
hadoop\tNULL\tNULL\t");
+      StringBuffer sb = new StringBuffer("123\t456\t789\t1000\t5.3\thive and 
hadoop\t1\tNULL\t");
       String s = sb.append(new String(Base64.encodeBase64(new 
byte[]{(byte)Integer.parseInt("10111111", 2)}))).toString();
       Object[] expectedFieldsData = {new ByteWritable((byte) 123),
           new ShortWritable((short) 456), new IntWritable(789),
           new LongWritable(1000), new DoubleWritable(5.3),
-          new Text("hive and hadoop"), null, null, new BytesWritable(new 
byte[]{(byte)Integer.parseInt("10111111", 2)})};
+          new Text("hive and hadoop"), new IntWritable(1), null, new 
BytesWritable(new byte[]{(byte)Integer.parseInt("10111111", 2)})};
 
       // Test
       deserializeAndSerialize(serDe, t, s, expectedFieldsData);
@@ -128,11 +128,11 @@ public class TestLazySimpleSerDe extends
 
       // Data
       Text t = new Text("123\t456\t789\t1000\t5.3\thive and 
hadoop\t1.\ta\tb\t");
-      String s = "123\t456\t789\t1000\t5.3\thive and hadoop\tNULL\ta\tb\t";
+      String s = "123\t456\t789\t1000\t5.3\thive and hadoop\t1\ta\tb\t";
       Object[] expectedFieldsData = {new ByteWritable((byte) 123),
           new ShortWritable((short) 456), new IntWritable(789),
           new LongWritable(1000), new DoubleWritable(5.3),
-          new Text("hive and hadoop"), null, new Text("a\tb\t")};
+          new Text("hive and hadoop"), new IntWritable(1), new Text("a\tb\t")};
 
       // Test
       deserializeAndSerialize(serDe, t, s, expectedFieldsData);
@@ -156,11 +156,11 @@ public class TestLazySimpleSerDe extends
 
       // Data
       Text t = new Text("123\t456\t789\t1000\t5.3\thive and 
hadoop\t1.\ta\tb\t");
-      String s = "123\t456\t789\t1000\t5.3\thive and hadoop\tNULL\ta";
+      String s = "123\t456\t789\t1000\t5.3\thive and hadoop\t1\ta";
       Object[] expectedFieldsData = {new ByteWritable((byte) 123),
           new ShortWritable((short) 456), new IntWritable(789),
           new LongWritable(1000), new DoubleWritable(5.3),
-          new Text("hive and hadoop"), null, new Text("a")};
+          new Text("hive and hadoop"), new IntWritable(1), new Text("a")};
 
       // Test
       deserializeAndSerialize(serDe, t, s, expectedFieldsData);

Modified: 
hive/branches/maven/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/primitive/TestPrimitiveObjectInspectorUtils.java
URL: 
http://svn.apache.org/viewvc/hive/branches/maven/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/primitive/TestPrimitiveObjectInspectorUtils.java?rev=1526996&r1=1526995&r2=1526996&view=diff
==============================================================================
--- 
hive/branches/maven/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/primitive/TestPrimitiveObjectInspectorUtils.java
 (original)
+++ 
hive/branches/maven/serde/src/test/org/apache/hadoop/hive/serde2/objectinspector/primitive/TestPrimitiveObjectInspectorUtils.java
 Fri Sep 27 17:41:42 2013
@@ -39,7 +39,7 @@ public class TestPrimitiveObjectInspecto
 
     assertEquals(PrimitiveGrouping.UNKNOWN_GROUP,
         
PrimitiveObjectInspectorUtils.getPrimitiveGrouping(PrimitiveCategory.UNKNOWN));
-    assertEquals(PrimitiveGrouping.UNKNOWN_GROUP,
+    assertEquals(PrimitiveGrouping.VOID_GROUP,
         
PrimitiveObjectInspectorUtils.getPrimitiveGrouping(PrimitiveCategory.VOID));
   }
 }

Modified: 
hive/branches/maven/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java
URL: 
http://svn.apache.org/viewvc/hive/branches/maven/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java?rev=1526996&r1=1526995&r2=1526996&view=diff
==============================================================================
--- 
hive/branches/maven/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java
 (original)
+++ 
hive/branches/maven/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java
 Fri Sep 27 17:41:42 2013
@@ -42,45 +42,37 @@ import org.apache.hive.service.cli.RowSe
 import org.apache.hive.service.cli.SessionHandle;
 import org.apache.hive.service.cli.TableSchema;
 import org.apache.thrift.TException;
-import org.apache.thrift.TProcessorFactory;
-import org.apache.thrift.protocol.TBinaryProtocol;
 import org.apache.thrift.server.TServer;
-import org.apache.thrift.server.TThreadPoolServer;
-import org.apache.thrift.transport.TServerSocket;
-import org.apache.thrift.transport.TTransportFactory;
-
 
 /**
- * CLIService.
+ * ThriftCLIService.
  *
  */
-public class ThriftCLIService extends AbstractService implements 
TCLIService.Iface, Runnable {
+public abstract class ThriftCLIService extends AbstractService implements 
TCLIService.Iface, Runnable {
 
   public static final Log LOG = 
LogFactory.getLog(ThriftCLIService.class.getName());
 
-
   protected CLIService cliService;
   private static final TStatus OK_STATUS = new 
TStatus(TStatusCode.SUCCESS_STATUS);
   private static final TStatus ERROR_STATUS = new 
TStatus(TStatusCode.ERROR_STATUS);
 
-  private static HiveAuthFactory hiveAuthFactory;
-
-  private int portNum;
-  private InetSocketAddress serverAddress;
-  private TServer server;
+  protected int portNum;
+  protected InetSocketAddress serverAddress;
+  protected TServer server;
+  protected org.mortbay.jetty.Server httpServer;
 
   private boolean isStarted = false;
   protected boolean isEmbedded = false;
 
-  private HiveConf hiveConf;
-
-  private int minWorkerThreads;
-  private int maxWorkerThreads;
+  protected HiveConf hiveConf;
 
+  protected int minWorkerThreads;
+  protected int maxWorkerThreads;
 
+  protected static HiveAuthFactory hiveAuthFactory;
 
-  public ThriftCLIService(CLIService cliService) {
-    super("ThriftCLIService");
+  public ThriftCLIService(CLIService cliService, String serviceName) {
+    super(serviceName);
     this.cliService = cliService;
   }
 
@@ -102,7 +94,18 @@ public class ThriftCLIService extends Ab
   @Override
   public synchronized void stop() {
     if (isStarted && !isEmbedded) {
-      server.stop();
+      if(server != null) {
+        server.stop();
+        LOG.info("Thrift server has stopped");
+      }
+      if((httpServer != null) && httpServer.isStarted()) {
+        try {
+          httpServer.stop();
+          LOG.info("Http server has stopped");
+        } catch (Exception e) {
+          LOG.error("Error stopping Http server: ", e);
+        }
+      }
       isStarted = false;
     }
     super.stop();
@@ -155,10 +158,10 @@ public class ThriftCLIService extends Ab
         // The delegation token is not applicable in the given deployment mode
       }
       sessionHandle = cliService.openSessionWithImpersonation(userName, 
req.getPassword(),
-            req.getConfiguration(), delegationTokenStr);
+          req.getConfiguration(), delegationTokenStr);
     } else {
       sessionHandle = cliService.openSession(userName, req.getPassword(),
-            req.getConfiguration());
+          req.getConfiguration());
     }
     return sessionHandle;
   }
@@ -203,9 +206,9 @@ public class ThriftCLIService extends Ab
       Boolean runAsync = req.isRunAsync();
       OperationHandle operationHandle = runAsync ?
           cliService.executeStatementAsync(sessionHandle, statement, 
confOverlay)
-              : cliService.executeStatement(sessionHandle, statement, 
confOverlay);
-      resp.setOperationHandle(operationHandle.toTOperationHandle());
-      resp.setStatus(OK_STATUS);
+          : cliService.executeStatement(sessionHandle, statement, confOverlay);
+          resp.setOperationHandle(operationHandle.toTOperationHandle());
+          resp.setStatus(OK_STATUS);
     } catch (Exception e) {
       e.printStackTrace();
       resp.setStatus(HiveSQLException.toTStatus(e));
@@ -394,52 +397,6 @@ public class ThriftCLIService extends Ab
     return resp;
   }
 
-
   @Override
-  public void run() {
-    try {
-      hiveAuthFactory = new HiveAuthFactory();
-      TTransportFactory  transportFactory = 
hiveAuthFactory.getAuthTransFactory();
-      TProcessorFactory processorFactory = 
hiveAuthFactory.getAuthProcFactory(this);
-
-      String portString = System.getenv("HIVE_SERVER2_THRIFT_PORT");
-      if (portString != null) {
-        portNum = Integer.valueOf(portString);
-      } else {
-        portNum = hiveConf.getIntVar(ConfVars.HIVE_SERVER2_THRIFT_PORT);
-      }
-
-      String hiveHost = System.getenv("HIVE_SERVER2_THRIFT_BIND_HOST");
-      if (hiveHost == null) {
-        hiveHost = hiveConf.getVar(ConfVars.HIVE_SERVER2_THRIFT_BIND_HOST);
-      }
-
-      if (hiveHost != null && !hiveHost.isEmpty()) {
-        serverAddress = new InetSocketAddress(hiveHost, portNum);
-      } else {
-        serverAddress = new  InetSocketAddress(portNum);
-      }
-
-
-      minWorkerThreads = 
hiveConf.getIntVar(ConfVars.HIVE_SERVER2_THRIFT_MIN_WORKER_THREADS);
-      maxWorkerThreads = 
hiveConf.getIntVar(ConfVars.HIVE_SERVER2_THRIFT_MAX_WORKER_THREADS);
-
-
-      TThreadPoolServer.Args sargs = new TThreadPoolServer.Args(new 
TServerSocket(serverAddress))
-      .processorFactory(processorFactory)
-      .transportFactory(transportFactory)
-      .protocolFactory(new TBinaryProtocol.Factory())
-      .minWorkerThreads(minWorkerThreads)
-      .maxWorkerThreads(maxWorkerThreads);
-
-      server = new TThreadPoolServer(sargs);
-
-      LOG.info("ThriftCLIService listening on " + serverAddress);
-
-      server.serve();
-    } catch (Throwable t) {
-      t.printStackTrace();
-    }
-  }
-
+  public abstract void run();
 }

Modified: 
hive/branches/maven/service/src/java/org/apache/hive/service/server/HiveServer2.java
URL: 
http://svn.apache.org/viewvc/hive/branches/maven/service/src/java/org/apache/hive/service/server/HiveServer2.java?rev=1526996&r1=1526995&r2=1526996&view=diff
==============================================================================
--- 
hive/branches/maven/service/src/java/org/apache/hive/service/server/HiveServer2.java
 (original)
+++ 
hive/branches/maven/service/src/java/org/apache/hive/service/server/HiveServer2.java
 Fri Sep 27 17:41:42 2013
@@ -26,7 +26,9 @@ import org.apache.hadoop.hive.conf.HiveC
 import org.apache.hive.common.util.HiveStringUtils;
 import org.apache.hive.service.CompositeService;
 import org.apache.hive.service.cli.CLIService;
+import org.apache.hive.service.cli.thrift.ThriftBinaryCLIService;
 import org.apache.hive.service.cli.thrift.ThriftCLIService;
+import org.apache.hive.service.cli.thrift.ThriftHttpCLIService;
 
 /**
  * HiveServer2.
@@ -50,9 +52,19 @@ public class HiveServer2 extends Composi
     cliService = new CLIService();
     addService(cliService);
 
-    thriftCLIService = new ThriftCLIService(cliService);
-    addService(thriftCLIService);
+    String transportMode = System.getenv("HIVE_SERVER2_TRANSPORT_MODE");
+    if(transportMode == null) {
+      transportMode = 
hiveConf.getVar(HiveConf.ConfVars.HIVE_SERVER2_TRANSPORT_MODE);
+    }
+    if(transportMode != null && (transportMode.equalsIgnoreCase("http") ||
+        transportMode.equalsIgnoreCase("https"))) {
+      thriftCLIService = new ThriftHttpCLIService(cliService);
+    }
+    else {
+      thriftCLIService = new ThriftBinaryCLIService(cliService);
+    }
 
+    addService(thriftCLIService);
     super.init(hiveConf);
   }
 
@@ -70,7 +82,6 @@ public class HiveServer2 extends Composi
    * @param args
    */
   public static void main(String[] args) {
-
     //NOTE: It is critical to do this here so that log4j is reinitialized
     // before any of the other core hive classes are loaded
     try {
@@ -97,3 +108,4 @@ public class HiveServer2 extends Composi
   }
 
 }
+

Modified: 
hive/branches/maven/service/src/test/org/apache/hive/service/auth/TestPlainSaslHelper.java
URL: 
http://svn.apache.org/viewvc/hive/branches/maven/service/src/test/org/apache/hive/service/auth/TestPlainSaslHelper.java?rev=1526996&r1=1526995&r2=1526996&view=diff
==============================================================================
--- 
hive/branches/maven/service/src/test/org/apache/hive/service/auth/TestPlainSaslHelper.java
 (original)
+++ 
hive/branches/maven/service/src/test/org/apache/hive/service/auth/TestPlainSaslHelper.java
 Fri Sep 27 17:41:42 2013
@@ -23,6 +23,7 @@ import org.apache.hadoop.hive.conf.HiveC
 import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
 import org.apache.hive.service.cli.CLIService;
 import org.apache.hive.service.cli.thrift.ThriftCLIService;
+import org.apache.hive.service.cli.thrift.ThriftBinaryCLIService;
 import org.apache.thrift.TProcessorFactory;
 
 public class TestPlainSaslHelper extends TestCase {
@@ -40,7 +41,7 @@ public class TestPlainSaslHelper extends
 
     CLIService cliService = new CLIService();
     cliService.init(hconf);
-    ThriftCLIService tcliService = new ThriftCLIService(cliService);
+    ThriftCLIService tcliService = new ThriftBinaryCLIService(cliService);
     tcliService.init(hconf);
     TProcessorFactory procFactory = 
PlainSaslHelper.getPlainProcessorFactory(tcliService);
     assertEquals("doAs enabled processor for unsecure mode",

Modified: 
hive/branches/maven/service/src/test/org/apache/hive/service/cli/CLIServiceTest.java
URL: 
http://svn.apache.org/viewvc/hive/branches/maven/service/src/test/org/apache/hive/service/cli/CLIServiceTest.java?rev=1526996&r1=1526995&r2=1526996&view=diff
==============================================================================
--- 
hive/branches/maven/service/src/test/org/apache/hive/service/cli/CLIServiceTest.java
 (original)
+++ 
hive/branches/maven/service/src/test/org/apache/hive/service/cli/CLIServiceTest.java
 Fri Sep 27 17:41:42 2013
@@ -51,7 +51,7 @@ public abstract class CLIServiceTest {
   }
 
   @Test
-  public void createSessionTest() throws Exception {
+  public void openSessionTest() throws Exception {
     SessionHandle sessionHandle = client
         .openSession("tom", "password", Collections.<String, 
String>emptyMap());
     assertNotNull(sessionHandle);

Modified: 
hive/branches/maven/service/src/test/org/apache/hive/service/cli/session/TestSessionHooks.java
URL: 
http://svn.apache.org/viewvc/hive/branches/maven/service/src/test/org/apache/hive/service/cli/session/TestSessionHooks.java?rev=1526996&r1=1526995&r2=1526996&view=diff
==============================================================================
--- 
hive/branches/maven/service/src/test/org/apache/hive/service/cli/session/TestSessionHooks.java
 (original)
+++ 
hive/branches/maven/service/src/test/org/apache/hive/service/cli/session/TestSessionHooks.java
 Fri Sep 27 17:41:42 2013
@@ -27,7 +27,7 @@ import junit.framework.TestCase;
 import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
 import org.apache.hive.service.cli.HiveSQLException;
 import org.apache.hive.service.cli.SessionHandle;
-import org.apache.hive.service.cli.thrift.EmbeddedThriftCLIService;
+import org.apache.hive.service.cli.thrift.EmbeddedThriftBinaryCLIService;
 import org.apache.hive.service.cli.thrift.ThriftCLIServiceClient;
 import org.junit.Before;
 import org.junit.Test;
@@ -35,7 +35,7 @@ import org.junit.Test;
 public class TestSessionHooks extends TestCase {
 
   public static final String SESSION_USER_NAME = "user1";
-  private EmbeddedThriftCLIService service;
+  private EmbeddedThriftBinaryCLIService service;
   private ThriftCLIServiceClient client;
 
   public static class SessionHookTest implements HiveSessionHook {
@@ -58,7 +58,7 @@ public class TestSessionHooks extends Te
     super.setUp();
     System.setProperty(ConfVars.HIVE_SERVER2_SESSION_HOOK.varname,
         TestSessionHooks.SessionHookTest.class.getName());
-    service = new EmbeddedThriftCLIService();
+    service = new EmbeddedThriftBinaryCLIService();
     client = new ThriftCLIServiceClient(service);
   }
 

Modified: 
hive/branches/maven/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/PTest.java
URL: 
http://svn.apache.org/viewvc/hive/branches/maven/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/PTest.java?rev=1526996&r1=1526995&r2=1526996&view=diff
==============================================================================
--- 
hive/branches/maven/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/PTest.java
 (original)
+++ 
hive/branches/maven/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/PTest.java
 Fri Sep 27 17:41:42 2013
@@ -110,6 +110,7 @@ public class PTest {
     put("buildTag", buildTag).
     put("logDir", logDir.getAbsolutePath()).
     put("javaHome", configuration.getJavaHome()).
+    put("javaHomeForTests", configuration.getJavaHomeForTests()).
     put("antEnvOpts", configuration.getAntEnvOpts());
     final ImmutableMap<String, String> templateDefaults = 
templateDefaultsBuilder.build();
     TestParser testParser = new TestParser(configuration.getContext(),
@@ -221,12 +222,13 @@ public class PTest {
   }
 
   private static final String PROPERTIES = "properties";
-  private static final String REPOSITORY = "repository";
-  private static final String REPOSITORY_NAME = "repositoryName";
-  private static final String BRANCH = "branch";
+  private static final String REPOSITORY = TestConfiguration.REPOSITORY;
+  private static final String REPOSITORY_NAME = 
TestConfiguration.REPOSITORY_NAME;
+  private static final String BRANCH = TestConfiguration.BRANCH;
   private static final String PATCH = "patch";
-  private static final String JAVA_HOME = "javaHome";
-  private static final String ANT_ENV_OPTS = "antEnvOpts";
+  private static final String JAVA_HOME = TestConfiguration.JAVA_HOME;
+  private static final String JAVA_HOME_TEST = 
TestConfiguration.JAVA_HOME_TEST;
+  private static final String ANT_ENV_OPTS = TestConfiguration.ANT_ENV_OPTS;
   /**
    * All args override properties file settings except
    * for this one which is additive.
@@ -243,7 +245,8 @@ public class PTest {
     options.addOption(null, BRANCH, true, "Overrides git branch in properties 
file");
     options.addOption(null, PATCH, true, "URI to patch, either file:/// or 
http(s)://");
     options.addOption(ANT_ARG, null, true, "Supplemntal ant arguments");
-    options.addOption(null, JAVA_HOME, true, "Java Home for compiling and 
running tests");
+    options.addOption(null, JAVA_HOME, true, "Java Home for compiling and 
running tests (unless " + JAVA_HOME_TEST + " is specified)");
+    options.addOption(null, JAVA_HOME_TEST, true, "Java Home for running tests 
(optional)");
     options.addOption(null, ANT_ENV_OPTS, true, "ANT_OPTS environemnt variable 
setting");
     CommandLine commandLine = parser.parse(options, args);
     if(!commandLine.hasOption(PROPERTIES)) {
@@ -282,6 +285,10 @@ public class PTest {
         if(!javaHome.isEmpty()) {
           conf.setJavaHome(javaHome);
         }
+        String javaHomeForTests = 
Strings.nullToEmpty(commandLine.getOptionValue(JAVA_HOME_TEST)).trim();
+        if(!javaHomeForTests.isEmpty()) {
+          conf.setJavaHomeForTests(javaHomeForTests);
+        }
         String antEnvOpts = 
Strings.nullToEmpty(commandLine.getOptionValue(ANT_ENV_OPTS)).trim();
         if(!antEnvOpts.isEmpty()) {
           conf.setAntEnvOpts(antEnvOpts);

Modified: 
hive/branches/maven/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/TestConfiguration.java
URL: 
http://svn.apache.org/viewvc/hive/branches/maven/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/TestConfiguration.java?rev=1526996&r1=1526995&r2=1526996&view=diff
==============================================================================
--- 
hive/branches/maven/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/TestConfiguration.java
 (original)
+++ 
hive/branches/maven/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/TestConfiguration.java
 Fri Sep 27 17:41:42 2013
@@ -32,19 +32,21 @@ import com.google.common.base.Strings;
 import com.google.common.collect.Maps;
 
 public class TestConfiguration {
+  public static final String REPOSITORY = "repository";
+  public static final String REPOSITORY_NAME = "repositoryName";
+  public static final String BRANCH = "branch";
+  public static final String JAVA_HOME = "javaHome";
+  public static final String JAVA_HOME_TEST = "javaHomeForTests";
+  public static final String ANT_ENV_OPTS = "antEnvOpts";
+  
   private static final String REPOSITORY_TYPE = "repositoryType";
   private static final String GIT = "git";
   private static final String SVN = "svn";
-  private static final String REPOSITORY = "repository";
-  private static final String REPOSITORY_NAME = "repositoryName";
-  private static final String BRANCH = "branch";
   private static final String ANT_ARGS = "antArgs";
-  private static final String ANT_ENV_OPTS = "antEnvOpts";
-  private static final String JAVA_HOME = "javaHome";
   private static final String JIRA_URL = "jiraUrl";
   private static final String JIRA_USER = "jiraUser";
   private static final String JIRA_PASSWORD = "jiraPassword";
-  public static final String JENKINS_URL = "jenkinsURL";
+  private static final String JENKINS_URL = "jenkinsURL";
 
   private final Context context;
   private String antArgs;
@@ -54,6 +56,7 @@ public class TestConfiguration {
   private String repositoryName;
   private String patch;
   private String javaHome;
+  private String javaHomeForTests;
   private String branch;
   private final String jenkinsURL;
   private final String jiraUrl;
@@ -79,6 +82,7 @@ public class TestConfiguration {
     antArgs =  Preconditions.checkNotNull(context.getString(ANT_ARGS), 
ANT_ARGS).trim();
     antEnvOpts =  context.getString(ANT_ENV_OPTS, "").trim();
     javaHome =  context.getString(JAVA_HOME, "").trim();
+    javaHomeForTests = context.getString(JAVA_HOME_TEST, "").trim();
     patch = Strings.nullToEmpty(null);
     jiraName = Strings.nullToEmpty(null);
     jiraUrl = context.getString(JIRA_URL, "").trim();
@@ -132,6 +136,9 @@ public class TestConfiguration {
   public String getJavaHome() {
     return javaHome;
   }
+  public String getJavaHomeForTests() {
+    return javaHomeForTests;
+  }
   public String getPatch() {
     return patch;
   }
@@ -150,6 +157,9 @@ public class TestConfiguration {
   public void setJavaHome(String javaHome) {
     this.javaHome = Strings.nullToEmpty(javaHome);
   }
+  public void setJavaHomeForTests(String javaHomeForTests) {
+      this.javaHomeForTests = javaHomeForTests;
+  }
   public void setAntArgs(String antArgs) {
     this.antArgs = Strings.nullToEmpty(antArgs);
   }
@@ -161,10 +171,14 @@ public class TestConfiguration {
   }
   @Override
   public String toString() {
-    return "Configuration [context=" + context + ", antArgs=" + antArgs
-        + ", antEnvOpts=" + antEnvOpts + ", repository=" + repository
-        + ", repositoryName=" + repositoryName + ", patch=" + patch
-        + ", javaHome=" + javaHome + ", branch=" + branch + "]";
+    return "TestConfiguration [antArgs=" + antArgs + ", antEnvOpts="
+        + antEnvOpts + ", repositoryType=" + repositoryType + ", repository="
+        + repository + ", repositoryName=" + repositoryName + ", patch="
+        + patch + ", javaHome=" + javaHome + ", javaHomeForTests="
+        + javaHomeForTests + ", branch=" + branch + ", jenkinsURL="
+        + jenkinsURL + ", jiraUrl=" + jiraUrl + ", jiraUser=" + jiraUser
+        + ", jiraName=" + jiraName + ", clearLibraryCache=" + clearLibraryCache
+        + "]";
   }
   public static TestConfiguration fromInputStream(InputStream inputStream, 
Logger logger)
       throws IOException {

Modified: 
hive/branches/maven/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/context/CloudExecutionContextProvider.java
URL: 
http://svn.apache.org/viewvc/hive/branches/maven/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/context/CloudExecutionContextProvider.java?rev=1526996&r1=1526995&r2=1526996&view=diff
==============================================================================
--- 
hive/branches/maven/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/context/CloudExecutionContextProvider.java
 (original)
+++ 
hive/branches/maven/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/context/CloudExecutionContextProvider.java
 Fri Sep 27 17:41:42 2013
@@ -106,7 +106,7 @@ public class CloudExecutionContextProvid
             return size() > 100;
           }
         });
-    mTerminationExecutor = Executors.newCachedThreadPool();
+    mTerminationExecutor = Executors.newSingleThreadExecutor();
     mHostLog = new RandomAccessFile(new File(dataDir, "hosts"), "rw");
     initialize();
   }

Modified: hive/branches/maven/testutils/ptest2/src/main/resources/batch-exec.vm
URL: 
http://svn.apache.org/viewvc/hive/branches/maven/testutils/ptest2/src/main/resources/batch-exec.vm?rev=1526996&r1=1526995&r2=1526996&view=diff
==============================================================================
--- hive/branches/maven/testutils/ptest2/src/main/resources/batch-exec.vm 
(original)
+++ hive/branches/maven/testutils/ptest2/src/main/resources/batch-exec.vm Fri 
Sep 27 17:41:42 2013
@@ -23,7 +23,11 @@ chmod -R u+w $logDir
 rm -rf $logDir
 # makes $logDir and $logDir/tmp
 mkdir -p $logDir/tmp
-if [[ -n "${javaHome}" ]]
+if [[ -n "${javaHomeForTests}" ]]
+then
+  export JAVA_HOME=$javaHomeForTests
+  export PATH=$JAVA_HOME/bin/:$PATH
+elif [[ -n "${javaHome}" ]]
 then
   export JAVA_HOME=$javaHome
   export PATH=$JAVA_HOME/bin/:$PATH

Modified: 
hive/branches/maven/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.java
URL: 
http://svn.apache.org/viewvc/hive/branches/maven/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.java?rev=1526996&r1=1526995&r2=1526996&view=diff
==============================================================================
--- 
hive/branches/maven/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.java
 (original)
+++ 
hive/branches/maven/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.java
 Fri Sep 27 17:41:42 2013
@@ -78,6 +78,30 @@ public class TestScripts  {
     Approvals.verify(actual);
   }
   @Test
+  public void testAlternativeTestJVM() throws Throwable {
+    Map<String, String> templateVariables = Maps.newHashMap();
+    templateVariables.put("repository", "git:///repo1");
+    templateVariables.put("repositoryName", "apache");
+    templateVariables.put("branch", "branch-1");
+    templateVariables.put("localDir", "/some/local/dir");
+    templateVariables.put("workingDir", "/some/working/dir");
+    templateVariables.put("antArgs", "-Dant=arg1");
+    templateVariables.put("buildTag", "build-1");
+    templateVariables.put("logDir", "/some/log/dir");
+    templateVariables.put("instanceName", "instance-1");
+    templateVariables.put("batchName","batch-1");
+    templateVariables.put("numOfFailedTests", "20");
+    templateVariables.put("maxSourceDirs", String.valueOf(5));
+    templateVariables.put("testArguments", "-Dtest=arg1");
+    templateVariables.put("clearLibraryCache", "true");
+    templateVariables.put("javaHome", "/usr/java/jdk1.7");
+    templateVariables.put("javaHomeForTests", "/usr/java/jdk1.7-other");
+    templateVariables.put("antEnvOpts", "-Dhttp.proxyHost=somehost 
-Dhttp.proxyPort=3128");
+    String template = readResource("batch-exec.vm");
+    String actual = getTemplateResult(template, templateVariables);
+    Approvals.verify(actual);
+  }
+  @Test
   public void testPrepNone() throws Throwable {
     Map<String, String> templateVariables = Maps.newHashMap();
     templateVariables.put("repository", "git:///repo1");

Modified: 
hive/branches/maven/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testBatch.approved.txt
URL: 
http://svn.apache.org/viewvc/hive/branches/maven/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testBatch.approved.txt?rev=1526996&r1=1526995&r2=1526996&view=diff
==============================================================================
--- 
hive/branches/maven/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testBatch.approved.txt
 (original)
+++ 
hive/branches/maven/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testBatch.approved.txt
 Fri Sep 27 17:41:42 2013
@@ -22,7 +22,11 @@ chmod -R u+w /some/log/dir
 rm -rf /some/log/dir
 # makes /some/log/dir and /some/log/dir/tmp
 mkdir -p /some/log/dir/tmp
-if [[ -n "/usr/java/jdk1.7" ]]
+if [[ -n "${javaHomeForTests}" ]]
+then
+  export JAVA_HOME=$javaHomeForTests
+  export PATH=$JAVA_HOME/bin/:$PATH
+elif [[ -n "/usr/java/jdk1.7" ]]
 then
   export JAVA_HOME=/usr/java/jdk1.7
   export PATH=$JAVA_HOME/bin/:$PATH


Reply via email to