Modified: hive/branches/cbo/ql/src/test/results/compiler/plan/udf6.q.xml URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/test/results/compiler/plan/udf6.q.xml?rev=1627125&r1=1627124&r2=1627125&view=diff ============================================================================== --- hive/branches/cbo/ql/src/test/results/compiler/plan/udf6.q.xml (original) +++ hive/branches/cbo/ql/src/test/results/compiler/plan/udf6.q.xml Tue Sep 23 19:30:11 2014 @@ -291,86 +291,24 @@ <object class="java.util.HashMap"> <void method="put"> <string>_col1</string> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc"> - <void property="children"> - <object class="java.util.ArrayList"> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object class="org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo"> - <void property="typeName"> - <string>boolean</string> - </void> - </object> - </void> - <void property="value"> - <boolean>true</boolean> - </void> - </object> - </void> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo1"/> - </void> - <void property="value"> - <int>1</int> - </void> - </object> - </void> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo1"/> - </void> - <void property="value"> - <int>2</int> - </void> - </object> - </void> - </object> - </void> - <void property="genericUDF"> - <object class="org.apache.hadoop.hive.ql.udf.generic.GenericUDFIf"/> - </void> + <object id="ExprNodeConstantDesc0" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> <void property="typeInfo"> <object idref="PrimitiveTypeInfo1"/> </void> + <void property="value"> + <int>1</int> + </void> </object> </void> <void method="put"> <string>_col0</string> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc"> - <void property="children"> - <object class="java.util.ArrayList"> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <string>a</string> - </void> - </object> - </void> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <string>b</string> - </void> - </object> - </void> - </object> - </void> - <void property="genericUDF"> - <object class="org.apache.hadoop.hive.ql.udf.generic.GenericUDFConcat"/> - </void> + <object id="ExprNodeConstantDesc1" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> <void property="typeInfo"> <object idref="PrimitiveTypeInfo0"/> </void> + <void property="value"> + <string>ab</string> + </void> </object> </void> </object> @@ -380,24 +318,10 @@ <void property="colList"> <object class="java.util.ArrayList"> <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <string>ab</string> - </void> - </object> + <object idref="ExprNodeConstantDesc1"/> </void> <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo1"/> - </void> - <void property="value"> - <int>1</int> - </void> - </object> + <object idref="ExprNodeConstantDesc0"/> </void> </object> </void>
Modified: hive/branches/cbo/ql/src/test/results/compiler/plan/udf_case.q.xml URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/test/results/compiler/plan/udf_case.q.xml?rev=1627125&r1=1627124&r2=1627125&view=diff ============================================================================== --- hive/branches/cbo/ql/src/test/results/compiler/plan/udf_case.q.xml (original) +++ hive/branches/cbo/ql/src/test/results/compiler/plan/udf_case.q.xml Tue Sep 23 19:30:11 2014 @@ -346,142 +346,17 @@ <object class="java.util.HashMap"> <void method="put"> <string>_col1</string> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc"> - <void property="children"> - <object class="java.util.ArrayList"> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>11</int> - </void> - </object> - </void> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>12</int> - </void> - </object> - </void> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>13</int> - </void> - </object> - </void> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>14</int> - </void> - </object> - </void> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>15</int> - </void> - </object> - </void> - </object> - </void> - <void property="genericUDF"> - <object class="org.apache.hadoop.hive.ql.udf.generic.GenericUDFCase"/> - </void> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - </object> + <object id="ExprNodeNullDesc0" class="org.apache.hadoop.hive.ql.plan.ExprNodeNullDesc"/> </void> <void method="put"> <string>_col0</string> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc"> - <void property="children"> - <object class="java.util.ArrayList"> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>1</int> - </void> - </object> - </void> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>1</int> - </void> - </object> - </void> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>2</int> - </void> - </object> - </void> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>3</int> - </void> - </object> - </void> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>4</int> - </void> - </object> - </void> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>5</int> - </void> - </object> - </void> - </object> - </void> - <void property="genericUDF"> - <object class="org.apache.hadoop.hive.ql.udf.generic.GenericUDFCase"/> - </void> + <object id="ExprNodeConstantDesc0" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> <void property="typeInfo"> <object idref="PrimitiveTypeInfo0"/> </void> + <void property="value"> + <int>2</int> + </void> </object> </void> </object> @@ -491,17 +366,10 @@ <void property="colList"> <object class="java.util.ArrayList"> <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>2</int> - </void> - </object> + <object idref="ExprNodeConstantDesc0"/> </void> <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeNullDesc"/> + <object idref="ExprNodeNullDesc0"/> </void> </object> </void> Modified: hive/branches/cbo/ql/src/test/results/compiler/plan/udf_when.q.xml URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/test/results/compiler/plan/udf_when.q.xml?rev=1627125&r1=1627124&r2=1627125&view=diff ============================================================================== --- hive/branches/cbo/ql/src/test/results/compiler/plan/udf_when.q.xml (original) +++ hive/branches/cbo/ql/src/test/results/compiler/plan/udf_when.q.xml Tue Sep 23 19:30:11 2014 @@ -346,222 +346,17 @@ <object class="java.util.HashMap"> <void method="put"> <string>_col1</string> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc"> - <void property="children"> - <object class="java.util.ArrayList"> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc"> - <void property="children"> - <object class="java.util.ArrayList"> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>12</int> - </void> - </object> - </void> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>11</int> - </void> - </object> - </void> - </object> - </void> - <void property="genericUDF"> - <object class="org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqual"/> - </void> - <void property="typeInfo"> - <object id="PrimitiveTypeInfo1" class="org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo"> - <void property="typeName"> - <string>boolean</string> - </void> - </object> - </void> - </object> - </void> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>13</int> - </void> - </object> - </void> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc"> - <void property="children"> - <object class="java.util.ArrayList"> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>14</int> - </void> - </object> - </void> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>10</int> - </void> - </object> - </void> - </object> - </void> - <void property="genericUDF"> - <object class="org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqual"/> - </void> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo1"/> - </void> - </object> - </void> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>15</int> - </void> - </object> - </void> - </object> - </void> - <void property="genericUDF"> - <object class="org.apache.hadoop.hive.ql.udf.generic.GenericUDFWhen"/> - </void> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - </object> + <object id="ExprNodeNullDesc0" class="org.apache.hadoop.hive.ql.plan.ExprNodeNullDesc"/> </void> <void method="put"> <string>_col0</string> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc"> - <void property="children"> - <object class="java.util.ArrayList"> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc"> - <void property="children"> - <object class="java.util.ArrayList"> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>1</int> - </void> - </object> - </void> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>1</int> - </void> - </object> - </void> - </object> - </void> - <void property="genericUDF"> - <object class="org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqual"/> - </void> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo1"/> - </void> - </object> - </void> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>2</int> - </void> - </object> - </void> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc"> - <void property="children"> - <object class="java.util.ArrayList"> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>3</int> - </void> - </object> - </void> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>5</int> - </void> - </object> - </void> - </object> - </void> - <void property="genericUDF"> - <object class="org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqual"/> - </void> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo1"/> - </void> - </object> - </void> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>4</int> - </void> - </object> - </void> - <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>5</int> - </void> - </object> - </void> - </object> - </void> - <void property="genericUDF"> - <object class="org.apache.hadoop.hive.ql.udf.generic.GenericUDFWhen"/> - </void> + <object id="ExprNodeConstantDesc0" class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> <void property="typeInfo"> <object idref="PrimitiveTypeInfo0"/> </void> + <void property="value"> + <int>2</int> + </void> </object> </void> </object> @@ -571,17 +366,10 @@ <void property="colList"> <object class="java.util.ArrayList"> <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc"> - <void property="typeInfo"> - <object idref="PrimitiveTypeInfo0"/> - </void> - <void property="value"> - <int>2</int> - </void> - </object> + <object idref="ExprNodeConstantDesc0"/> </void> <void method="add"> - <object class="org.apache.hadoop.hive.ql.plan.ExprNodeNullDesc"/> + <object idref="ExprNodeNullDesc0"/> </void> </object> </void> @@ -649,7 +437,7 @@ <string>src</string> </void> <void property="type"> - <object id="PrimitiveTypeInfo2" class="org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo"> + <object id="PrimitiveTypeInfo1" class="org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo"> <void property="typeName"> <string>string</string> </void> @@ -669,7 +457,7 @@ <string>src</string> </void> <void property="type"> - <object idref="PrimitiveTypeInfo2"/> + <object idref="PrimitiveTypeInfo1"/> </void> <void property="typeName"> <string>string</string> @@ -688,7 +476,7 @@ <string>src</string> </void> <void property="type"> - <object id="PrimitiveTypeInfo3" class="org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo"> + <object id="PrimitiveTypeInfo2" class="org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo"> <void property="typeName"> <string>bigint</string> </void> @@ -711,7 +499,7 @@ <string>src</string> </void> <void property="type"> - <object idref="PrimitiveTypeInfo2"/> + <object idref="PrimitiveTypeInfo1"/> </void> <void property="typeName"> <string>string</string> @@ -747,13 +535,13 @@ <void property="allStructFieldTypeInfos"> <object class="java.util.ArrayList"> <void method="add"> - <object idref="PrimitiveTypeInfo3"/> + <object idref="PrimitiveTypeInfo2"/> </void> <void method="add"> <object idref="PrimitiveTypeInfo0"/> </void> <void method="add"> - <object idref="PrimitiveTypeInfo3"/> + <object idref="PrimitiveTypeInfo2"/> </void> </object> </void> Modified: hive/branches/cbo/ql/src/test/results/compiler/plan/union.q.xml URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/test/results/compiler/plan/union.q.xml?rev=1627125&r1=1627124&r2=1627125&view=diff ============================================================================== --- hive/branches/cbo/ql/src/test/results/compiler/plan/union.q.xml (original) +++ hive/branches/cbo/ql/src/test/results/compiler/plan/union.q.xml Tue Sep 23 19:30:11 2014 @@ -235,7 +235,7 @@ </object> </void> <void property="tableDesc"> - <object class="org.apache.hadoop.hive.ql.plan.TableDesc"> + <object id="TableDesc0" class="org.apache.hadoop.hive.ql.plan.TableDesc"> <void property="inputFileFormatClass"> <class>org.apache.hadoop.mapred.TextInputFormat</class> </void> @@ -449,7 +449,7 @@ </object> </void> <void property="tableDesc"> - <object id="TableDesc0" class="org.apache.hadoop.hive.ql.plan.TableDesc"> + <object id="TableDesc1" class="org.apache.hadoop.hive.ql.plan.TableDesc"> <void property="inputFileFormatClass"> <class>org.apache.hadoop.mapred.TextInputFormat</class> </void> @@ -593,7 +593,7 @@ </object> </void> <void property="tableDesc"> - <object idref="TableDesc0"/> + <object idref="TableDesc1"/> </void> </object> </void> @@ -640,34 +640,7 @@ <boolean>true</boolean> </void> <void property="tableInfo"> - <object class="org.apache.hadoop.hive.ql.plan.TableDesc"> - <void property="inputFileFormatClass"> - <class>org.apache.hadoop.mapred.TextInputFormat</class> - </void> - <void property="outputFileFormatClass"> - <class>org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat</class> - </void> - <void property="properties"> - <object class="java.util.Properties"> - <void method="put"> - <string>columns</string> - <string>_col0,_col1</string> - </void> - <void method="put"> - <string>serialization.lib</string> - <string>org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe</string> - </void> - <void method="put"> - <string>serialization.format</string> - <string>1</string> - </void> - <void method="put"> - <string>columns.types</string> - <string>string:string</string> - </void> - </object> - </void> - </object> + <object idref="TableDesc0"/> </void> <void property="totalFiles"> <int>1</int> @@ -1634,7 +1607,7 @@ </object> </void> <void property="tableDesc"> - <object idref="TableDesc0"/> + <object idref="TableDesc1"/> </void> </object> </void> Modified: hive/branches/cbo/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java URL: http://svn.apache.org/viewvc/hive/branches/cbo/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java?rev=1627125&r1=1627124&r2=1627125&view=diff ============================================================================== --- hive/branches/cbo/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java (original) +++ hive/branches/cbo/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java Tue Sep 23 19:30:11 2014 @@ -166,15 +166,20 @@ public class HiveSessionImpl implements IHiveFileProcessor processor = new GlobalHivercFileProcessor(); try { - if (hiveConf.getVar(ConfVars.HIVE_SERVER2_GLOBAL_INIT_FILE_LOCATION) != null) { - String hiverc = hiveConf.getVar(ConfVars.HIVE_SERVER2_GLOBAL_INIT_FILE_LOCATION) - + File.separator + SessionManager.HIVERCFILE; - if (new File(hiverc).exists()) { - LOG.info("Running global init file: " + hiverc); - int rc = processor.processFile(hiverc); + String hiverc = hiveConf.getVar(ConfVars.HIVE_SERVER2_GLOBAL_INIT_FILE_LOCATION); + if (hiverc != null) { + File hivercFile = new File(hiverc); + if (hivercFile.isDirectory()) { + hivercFile = new File(hivercFile, SessionManager.HIVERCFILE); + } + if (hivercFile.isFile()) { + LOG.info("Running global init file: " + hivercFile); + int rc = processor.processFile(hivercFile.getAbsolutePath()); if (rc != 0) { - LOG.warn("Failed on initializing global .hiverc file"); + LOG.error("Failed on initializing global .hiverc file"); } + } else { + LOG.debug("Global init file " + hivercFile + " does not exist"); } } } catch (IOException e) { Modified: hive/branches/cbo/service/src/test/org/apache/hive/service/cli/session/TestSessionGlobalInitFile.java URL: http://svn.apache.org/viewvc/hive/branches/cbo/service/src/test/org/apache/hive/service/cli/session/TestSessionGlobalInitFile.java?rev=1627125&r1=1627124&r2=1627125&view=diff ============================================================================== --- hive/branches/cbo/service/src/test/org/apache/hive/service/cli/session/TestSessionGlobalInitFile.java (original) +++ hive/branches/cbo/service/src/test/org/apache/hive/service/cli/session/TestSessionGlobalInitFile.java Tue Sep 23 19:30:11 2014 @@ -44,6 +44,7 @@ public class TestSessionGlobalInitFile e private ThriftCLIServiceClient client; private File initFile; private String tmpDir; + private HiveConf hiveConf; /** * This class is almost the same as EmbeddedThriftBinaryCLIService, @@ -86,7 +87,7 @@ public class TestSessionGlobalInitFile e FileUtils.writeLines(initFile, Arrays.asList(fileContent)); // set up service and client - HiveConf hiveConf = new HiveConf(); + hiveConf = new HiveConf(); hiveConf.setVar(HiveConf.ConfVars.HIVE_SERVER2_GLOBAL_INIT_FILE_LOCATION, initFile.getParentFile().getAbsolutePath()); service = new FakeEmbeddedThriftBinaryCLIService(hiveConf); @@ -102,11 +103,26 @@ public class TestSessionGlobalInitFile e @Test public void testSessionGlobalInitFile() throws Exception { - /** - * create session, and fetch the property set in global init file. Test if - * the global init file .hiverc is loaded correctly by checking the expected - * setting property. - */ + File tmpInitFile = new File(initFile.getParent(), "hiverc"); + Assert.assertTrue("Failed to rename " + initFile + " to " + tmpInitFile, + initFile.renameTo(tmpInitFile)); + initFile = tmpInitFile; + hiveConf.setVar(HiveConf.ConfVars.HIVE_SERVER2_GLOBAL_INIT_FILE_LOCATION, + initFile.getAbsolutePath()); + doTestSessionGlobalInitFile(); + } + + @Test + public void testSessionGlobalInitDir() throws Exception { + doTestSessionGlobalInitFile(); + } + + /** + * create session, and fetch the property set in global init file. Test if + * the global init file .hiverc is loaded correctly by checking the expected + * setting property. + */ + private void doTestSessionGlobalInitFile() throws Exception { SessionHandle sessionHandle = client.openSession(null, null, null); verifyInitProperty("a", "1", sessionHandle);
