Modified: hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableMergeJoin.java URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableMergeJoin.java?rev=925988&r1=925987&r2=925988&view=diff ============================================================================== --- hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableMergeJoin.java (original) +++ hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableMergeJoin.java Mon Mar 22 07:54:51 2010 @@ -40,6 +40,7 @@ import org.apache.hadoop.zebra.types.Typ import org.apache.pig.ExecType; import org.apache.pig.PigServer; import org.apache.pig.backend.executionengine.ExecException; +import org.apache.pig.backend.hadoop.datastorage.ConfigurationUtil; import org.apache.pig.data.Tuple; import org.apache.pig.test.MiniCluster; import org.junit.After; @@ -47,6 +48,8 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.apache.hadoop.zebra.BaseTestCase; + /** * Note: @@ -55,32 +58,17 @@ import org.junit.Test; * app/debug configuration, when run this from inside the Eclipse. * */ -public class TestTableMergeJoin { - protected static ExecType execType = ExecType.MAPREDUCE; - private static MiniCluster cluster; - protected static PigServer pigServer; +public class TestTableMergeJoin extends BaseTestCase { private static Path pathTable; + @BeforeClass public static void setUp() throws Exception { - if (System.getProperty("hadoop.log.dir") == null) { - String base = new File(".").getPath(); // getAbsolutePath(); - System - .setProperty("hadoop.log.dir", new Path(base).toString() + "./logs"); - } - - if (execType == ExecType.MAPREDUCE) { - cluster = MiniCluster.buildCluster(); - pigServer = new PigServer(ExecType.MAPREDUCE, cluster.getProperties()); - } else { - pigServer = new PigServer(ExecType.LOCAL); - } - - Configuration conf = new Configuration(); - FileSystem fs = cluster.getFileSystem(); - Path pathWorking = fs.getWorkingDirectory(); - pathTable = new Path(pathWorking, "TestTableStorer"); - System.out.println("pathTable =" + pathTable); + + init(); + pathTable = getTableFullPath("TestTableMergeJoin"); + removeDir(pathTable); + BasicTable.Writer writer = new BasicTable.Writer(pathTable, "SF_a:string,SF_b:string,SF_c,SF_d,SF_e,SF_f,SF_g", "[SF_a, SF_b, SF_c]; [SF_e, SF_f, SF_g]", conf);
Modified: hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableMergeJoinAfterFilter.java URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableMergeJoinAfterFilter.java?rev=925988&r1=925987&r2=925988&view=diff ============================================================================== --- hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableMergeJoinAfterFilter.java (original) +++ hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableMergeJoinAfterFilter.java Mon Mar 22 07:54:51 2010 @@ -40,6 +40,7 @@ import org.apache.hadoop.zebra.types.Typ import org.apache.pig.ExecType; import org.apache.pig.PigServer; import org.apache.pig.backend.executionengine.ExecException; +import org.apache.pig.backend.hadoop.datastorage.ConfigurationUtil; import org.apache.pig.data.Tuple; import org.apache.pig.test.MiniCluster; import org.junit.After; @@ -47,6 +48,8 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.apache.hadoop.zebra.BaseTestCase; + /** * Note: @@ -55,32 +58,17 @@ import org.junit.Test; * app/debug configuration, when run this from inside the Eclipse. * */ -public class TestTableMergeJoinAfterFilter { - protected static ExecType execType = ExecType.MAPREDUCE; - private static MiniCluster cluster; - protected static PigServer pigServer; +public class TestTableMergeJoinAfterFilter extends BaseTestCase { private static Path pathTable; @BeforeClass public static void setUp() throws Exception { - if (System.getProperty("hadoop.log.dir") == null) { - String base = new File(".").getPath(); // getAbsolutePath(); - System - .setProperty("hadoop.log.dir", new Path(base).toString() + "./logs"); - } - - if (execType == ExecType.MAPREDUCE) { - cluster = MiniCluster.buildCluster(); - pigServer = new PigServer(ExecType.MAPREDUCE, cluster.getProperties()); - } else { - pigServer = new PigServer(ExecType.LOCAL); - } - - Configuration conf = new Configuration(); - FileSystem fs = cluster.getFileSystem(); - Path pathWorking = fs.getWorkingDirectory(); - pathTable = new Path(pathWorking, "TestTableStorer"); - System.out.println("pathTable =" + pathTable); + + init(); + pathTable = getTableFullPath("TestTableMergeJoinAfterFilter"); + removeDir(pathTable); + + BasicTable.Writer writer = new BasicTable.Writer(pathTable, "SF_a:string,SF_b:string,SF_c,SF_d,SF_e,SF_f,SF_g", "[SF_a, SF_b, SF_c]; [SF_e, SF_f, SF_g]", conf); Modified: hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableMergeJoinFloat.java URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableMergeJoinFloat.java?rev=925988&r1=925987&r2=925988&view=diff ============================================================================== --- hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableMergeJoinFloat.java (original) +++ hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableMergeJoinFloat.java Mon Mar 22 07:54:51 2010 @@ -40,6 +40,7 @@ import org.apache.hadoop.zebra.types.Typ import org.apache.pig.ExecType; import org.apache.pig.PigServer; import org.apache.pig.backend.executionengine.ExecException; +import org.apache.pig.backend.hadoop.datastorage.ConfigurationUtil; import org.apache.pig.data.Tuple; import org.apache.pig.test.MiniCluster; import org.junit.After; @@ -47,6 +48,8 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.apache.hadoop.zebra.BaseTestCase; + /** * Note: @@ -55,32 +58,16 @@ import org.junit.Test; * app/debug configuration, when run this from inside the Eclipse. * */ -public class TestTableMergeJoinFloat { - protected static ExecType execType = ExecType.MAPREDUCE; - private static MiniCluster cluster; - protected static PigServer pigServer; +public class TestTableMergeJoinFloat extends BaseTestCase { private static Path pathTable; @BeforeClass public static void setUp() throws Exception { - if (System.getProperty("hadoop.log.dir") == null) { - String base = new File(".").getPath(); // getAbsolutePath(); - System - .setProperty("hadoop.log.dir", new Path(base).toString() + "./logs"); - } - if (execType == ExecType.MAPREDUCE) { - cluster = MiniCluster.buildCluster(); - pigServer = new PigServer(ExecType.MAPREDUCE, cluster.getProperties()); - } else { - pigServer = new PigServer(ExecType.LOCAL); - } + init(); + pathTable = getTableFullPath("TestTableMergeJoinFloat"); + removeDir(pathTable); - Configuration conf = new Configuration(); - FileSystem fs = cluster.getFileSystem(); - Path pathWorking = fs.getWorkingDirectory(); - pathTable = new Path(pathWorking, "TestTableStorer"); - System.out.println("pathTable =" + pathTable); BasicTable.Writer writer = new BasicTable.Writer(pathTable, "SF_a:float,SF_b:string,SF_c,SF_d,SF_e,SF_f,SF_g", "[SF_a, SF_b, SF_c]; [SF_e, SF_f, SF_g]", conf); Modified: hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableMergeJoinInteger.java URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableMergeJoinInteger.java?rev=925988&r1=925987&r2=925988&view=diff ============================================================================== --- hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableMergeJoinInteger.java (original) +++ hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableMergeJoinInteger.java Mon Mar 22 07:54:51 2010 @@ -40,6 +40,7 @@ import org.apache.hadoop.zebra.types.Typ import org.apache.pig.ExecType; import org.apache.pig.PigServer; import org.apache.pig.backend.executionengine.ExecException; +import org.apache.pig.backend.hadoop.datastorage.ConfigurationUtil; import org.apache.pig.data.Tuple; import org.apache.pig.test.MiniCluster; import org.junit.After; @@ -47,6 +48,8 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.apache.hadoop.zebra.BaseTestCase; + /** * Note: @@ -55,32 +58,17 @@ import org.junit.Test; * app/debug configuration, when run this from inside the Eclipse. * */ -public class TestTableMergeJoinInteger { - protected static ExecType execType = ExecType.MAPREDUCE; - private static MiniCluster cluster; - protected static PigServer pigServer; +public class TestTableMergeJoinInteger extends BaseTestCase { private static Path pathTable; @BeforeClass public static void setUp() throws Exception { - if (System.getProperty("hadoop.log.dir") == null) { - String base = new File(".").getPath(); // getAbsolutePath(); - System - .setProperty("hadoop.log.dir", new Path(base).toString() + "./logs"); - } - if (execType == ExecType.MAPREDUCE) { - cluster = MiniCluster.buildCluster(); - pigServer = new PigServer(ExecType.MAPREDUCE, cluster.getProperties()); - } else { - pigServer = new PigServer(ExecType.LOCAL); - } + init(); + pathTable = getTableFullPath("TestTableMergeJoinInteger"); + removeDir(pathTable); + - Configuration conf = new Configuration(); - FileSystem fs = cluster.getFileSystem(); - Path pathWorking = fs.getWorkingDirectory(); - pathTable = new Path(pathWorking, "TestTableStorer"); - System.out.println("pathTable =" + pathTable); BasicTable.Writer writer = new BasicTable.Writer(pathTable, "SF_a:int,SF_b:string,SF_c,SF_d,SF_e,SF_f,SF_g", "[SF_a, SF_b, SF_c]; [SF_e, SF_f, SF_g]", conf); Modified: hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableMergeJoinMultipleColsSort.java URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableMergeJoinMultipleColsSort.java?rev=925988&r1=925987&r2=925988&view=diff ============================================================================== --- hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableMergeJoinMultipleColsSort.java (original) +++ hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableMergeJoinMultipleColsSort.java Mon Mar 22 07:54:51 2010 @@ -40,6 +40,7 @@ import org.apache.hadoop.zebra.types.Typ import org.apache.pig.ExecType; import org.apache.pig.PigServer; import org.apache.pig.backend.executionengine.ExecException; +import org.apache.pig.backend.hadoop.datastorage.ConfigurationUtil; import org.apache.pig.data.Tuple; import org.apache.pig.test.MiniCluster; import org.junit.After; @@ -47,6 +48,8 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.apache.hadoop.zebra.BaseTestCase; + /** * Note: @@ -55,32 +58,18 @@ import org.junit.Test; * app/debug configuration, when run this from inside the Eclipse. * */ -public class TestTableMergeJoinMultipleColsSort { - protected static ExecType execType = ExecType.MAPREDUCE; - private static MiniCluster cluster; - protected static PigServer pigServer; +public class TestTableMergeJoinMultipleColsSort extends BaseTestCase { private static Path pathTable; @BeforeClass public static void setUp() throws Exception { - if (System.getProperty("hadoop.log.dir") == null) { - String base = new File(".").getPath(); // getAbsolutePath(); - System - .setProperty("hadoop.log.dir", new Path(base).toString() + "./logs"); - } - if (execType == ExecType.MAPREDUCE) { - cluster = MiniCluster.buildCluster(); - pigServer = new PigServer(ExecType.MAPREDUCE, cluster.getProperties()); - } else { - pigServer = new PigServer(ExecType.LOCAL); - } - Configuration conf = new Configuration(); - FileSystem fs = cluster.getFileSystem(); - Path pathWorking = fs.getWorkingDirectory(); - pathTable = new Path(pathWorking, "TestTableStorer"); - System.out.println("pathTable =" + pathTable); + init(); + pathTable = getTableFullPath("TestTableMergeJoinMultipleColsSort"); + removeDir(pathTable); + + BasicTable.Writer writer = new BasicTable.Writer(pathTable, "SF_a:int,SF_b:int,SF_c,SF_d,SF_e,SF_f,SF_g", "[SF_a, SF_b, SF_c]; [SF_e, SF_f, SF_g]", conf); Modified: hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableSortStorer.java URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableSortStorer.java?rev=925988&r1=925987&r2=925988&view=diff ============================================================================== --- hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableSortStorer.java (original) +++ hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableSortStorer.java Mon Mar 22 07:54:51 2010 @@ -40,6 +40,7 @@ import org.apache.hadoop.zebra.types.Typ import org.apache.pig.ExecType; import org.apache.pig.PigServer; import org.apache.pig.backend.executionengine.ExecException; +import org.apache.pig.backend.hadoop.datastorage.ConfigurationUtil; import org.apache.pig.data.Tuple; import org.apache.pig.test.MiniCluster; import org.junit.After; @@ -47,6 +48,8 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.apache.hadoop.zebra.BaseTestCase; + /** * Note: @@ -55,32 +58,16 @@ import org.junit.Test; * app/debug configuration, when run this from inside the Eclipse. * */ -public class TestTableSortStorer { - protected static ExecType execType = ExecType.MAPREDUCE; - private static MiniCluster cluster; - protected static PigServer pigServer; +public class TestTableSortStorer extends BaseTestCase { private static Path pathTable; @BeforeClass public static void setUp() throws Exception { - if (System.getProperty("hadoop.log.dir") == null) { - String base = new File(".").getPath(); // getAbsolutePath(); - System - .setProperty("hadoop.log.dir", new Path(base).toString() + "./logs"); - } - if (execType == ExecType.MAPREDUCE) { - cluster = MiniCluster.buildCluster(); - pigServer = new PigServer(ExecType.MAPREDUCE, cluster.getProperties()); - } else { - pigServer = new PigServer(ExecType.LOCAL); - } + init(); + pathTable = getTableFullPath("TestTableSortStorer"); + removeDir(pathTable); - Configuration conf = new Configuration(); - FileSystem fs = cluster.getFileSystem(); - Path pathWorking = fs.getWorkingDirectory(); - pathTable = new Path(pathWorking, "TestTableStorer"); - System.out.println("pathTable =" + pathTable); BasicTable.Writer writer = new BasicTable.Writer(pathTable, "SF_a:string,SF_b,SF_c,SF_d,SF_e,SF_f,SF_g", "[SF_a, SF_b, SF_c]; [SF_e, SF_f, SF_g]", conf); Modified: hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableSortStorerDesc.java URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableSortStorerDesc.java?rev=925988&r1=925987&r2=925988&view=diff ============================================================================== --- hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableSortStorerDesc.java (original) +++ hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableSortStorerDesc.java Mon Mar 22 07:54:51 2010 @@ -40,6 +40,7 @@ import org.apache.hadoop.zebra.types.Typ import org.apache.pig.ExecType; import org.apache.pig.PigServer; import org.apache.pig.backend.executionengine.ExecException; +import org.apache.pig.backend.hadoop.datastorage.ConfigurationUtil; import org.apache.pig.data.Tuple; import org.apache.pig.test.MiniCluster; import org.junit.After; @@ -47,6 +48,8 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.apache.hadoop.zebra.BaseTestCase; + /** * Note: @@ -55,32 +58,16 @@ import org.junit.Test; * app/debug configuration, when run this from inside the Eclipse. * */ -public class TestTableSortStorerDesc { - protected static ExecType execType = ExecType.MAPREDUCE; - private static MiniCluster cluster; - protected static PigServer pigServer; +public class TestTableSortStorerDesc extends BaseTestCase { private static Path pathTable; - + @BeforeClass public static void setUp() throws Exception { - if (System.getProperty("hadoop.log.dir") == null) { - String base = new File(".").getPath(); // getAbsolutePath(); - System - .setProperty("hadoop.log.dir", new Path(base).toString() + "./logs"); - } - - if (execType == ExecType.MAPREDUCE) { - cluster = MiniCluster.buildCluster(); - pigServer = new PigServer(ExecType.MAPREDUCE, cluster.getProperties()); - } else { - pigServer = new PigServer(ExecType.LOCAL); - } - Configuration conf = new Configuration(); - FileSystem fs = cluster.getFileSystem(); - Path pathWorking = fs.getWorkingDirectory(); - pathTable = new Path(pathWorking, "TestTableSortStorerDesc"); - System.out.println("pathTable =" + pathTable); + init(); + pathTable = getTableFullPath("TestTableSortStorerDesc"); + removeDir(pathTable); + BasicTable.Writer writer = new BasicTable.Writer(pathTable, "SF_a:string,SF_b,SF_c,SF_d,SF_e,SF_f,SF_g", "[SF_a, SF_b, SF_c]; [SF_e, SF_f, SF_g]", conf); Modified: hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableStorer.java URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableStorer.java?rev=925988&r1=925987&r2=925988&view=diff ============================================================================== --- hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableStorer.java (original) +++ hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestTableStorer.java Mon Mar 22 07:54:51 2010 @@ -38,6 +38,7 @@ import org.apache.pig.ExecType; import org.apache.pig.PigServer; import org.apache.pig.backend.executionengine.ExecException; import org.apache.pig.backend.executionengine.ExecJob; +import org.apache.pig.backend.hadoop.datastorage.ConfigurationUtil; import org.apache.pig.data.Tuple; import org.apache.pig.test.MiniCluster; import org.junit.After; @@ -45,6 +46,7 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.apache.hadoop.zebra.BaseTestCase; /** * Note: @@ -53,32 +55,17 @@ import org.junit.Test; * app/debug configuration, when run this from inside the Eclipse. * */ -public class TestTableStorer { - protected static ExecType execType = ExecType.MAPREDUCE; - private static MiniCluster cluster; - protected static PigServer pigServer; +public class TestTableStorer extends BaseTestCase { private static Path pathTable; @BeforeClass public static void setUp() throws Exception { - if (System.getProperty("hadoop.log.dir") == null) { - String base = new File(".").getPath(); // getAbsolutePath(); - System - .setProperty("hadoop.log.dir", new Path(base).toString() + "./logs"); - } - if (execType == ExecType.MAPREDUCE) { - cluster = MiniCluster.buildCluster(); - pigServer = new PigServer(ExecType.MAPREDUCE, cluster.getProperties()); - } else { - pigServer = new PigServer(ExecType.LOCAL); - } + init(); + pathTable = getTableFullPath("TestTableStorer"); + removeDir(pathTable); + - Configuration conf = new Configuration(); - FileSystem fs = cluster.getFileSystem(); - Path pathWorking = fs.getWorkingDirectory(); - pathTable = new Path(pathWorking, "TestTableStorer"); - System.out.println("pathTable =" + pathTable); BasicTable.Writer writer = new BasicTable.Writer(pathTable, "SF_a,SF_b,SF_c,SF_d,SF_e,SF_f,SF_g", "[SF_a, SF_b, SF_c]; [SF_e, SF_f, SF_g]", conf); @@ -145,4 +132,4 @@ public class TestTableStorer { Assert.assertNull(pigJob.getException()); } -} \ No newline at end of file +} Modified: hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestUnionMixedTypes.java URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestUnionMixedTypes.java?rev=925988&r1=925987&r2=925988&view=diff ============================================================================== --- hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestUnionMixedTypes.java (original) +++ hadoop/pig/trunk/contrib/zebra/src/test/org/apache/hadoop/zebra/pig/TestUnionMixedTypes.java Mon Mar 22 07:54:51 2010 @@ -42,6 +42,7 @@ import org.apache.hadoop.zebra.types.Typ import org.apache.pig.ExecType; import org.apache.pig.PigServer; import org.apache.pig.backend.executionengine.ExecException; +import org.apache.pig.backend.hadoop.datastorage.ConfigurationUtil; import org.apache.pig.data.DataBag; import org.apache.pig.data.DataByteArray; import org.apache.pig.data.Tuple; @@ -51,6 +52,8 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.apache.hadoop.zebra.BaseTestCase; + /** * Note: @@ -59,12 +62,8 @@ import org.junit.Test; * app/debug configuration, when run this from inside the Eclipse. * */ -public class TestUnionMixedTypes { - protected static ExecType execType = ExecType.MAPREDUCE; - private static MiniCluster cluster; - protected static PigServer pigServer; +public class TestUnionMixedTypes extends BaseTestCase { private static Path pathWorking, pathTable1, pathTable2; - private static Configuration conf; final static String STR_SCHEMA1 = "a:collection(record(a:string, b:string)),b:map(string),c:record(f1:string, f2:string),d"; final static String STR_STORAGE1 = "[a,d];[b#{k1|k2}];[c]"; final static String STR_SCHEMA2 = "a:collection(record(a:string, b:string)),b:map(string),c:record(f1:string, f2:string),e"; @@ -72,28 +71,17 @@ public class TestUnionMixedTypes { @BeforeClass public static void setUpOnce() throws Exception { - if (System.getProperty("hadoop.log.dir") == null) { - String base = new File(".").getPath(); // getAbsolutePath(); - System - .setProperty("hadoop.log.dir", new Path(base).toString() + "./logs"); - } - if (execType == ExecType.MAPREDUCE) { - cluster = MiniCluster.buildCluster(); - pigServer = new PigServer(ExecType.MAPREDUCE, cluster.getProperties()); - } else { - pigServer = new PigServer(ExecType.LOCAL); - } + init(); + pathTable1 = getTableFullPath("TestUnionMixedTypes1"); + pathTable2 = getTableFullPath("TestUnionMixedTypes2"); + removeDir(pathTable1); + removeDir(pathTable2); - conf = new Configuration(); - FileSystem fs = cluster.getFileSystem(); - pathWorking = fs.getWorkingDirectory(); /* * create 1st basic table; */ - pathTable1 = new Path(pathWorking, "1"); - System.out.println("pathTable1 =" + pathTable1); BasicTable.Writer writer = new BasicTable.Writer(pathTable1, STR_SCHEMA1, STR_STORAGE1, conf); @@ -180,8 +168,6 @@ public class TestUnionMixedTypes { /* * create 2nd basic table; */ - pathTable2 = new Path(pathWorking, "2"); - System.out.println("pathTable2 =" + pathTable2); BasicTable.Writer writer2 = new BasicTable.Writer(pathTable2, STR_SCHEMA2, STR_STORAGE2, conf); @@ -268,14 +254,10 @@ public class TestUnionMixedTypes { @Test // all fields public void testReader1() throws ExecException, IOException { - /* - * remove hdfs prefix part like "hdfs://localhost.localdomain:42540" pig - * will fill that in. - */ - String str1 = pathTable1.toString().substring( - pathTable1.toString().indexOf("/", 7), pathTable1.toString().length()); - String str2 = pathTable2.toString().substring( - pathTable2.toString().indexOf("/", 7), pathTable2.toString().length()); + String str1 = pathTable1.toString(); + String str2 = pathTable2.toString(); + + String query = "records = LOAD '" + str1 + "," @@ -359,15 +341,7 @@ public class TestUnionMixedTypes { @Test // one common field only public void testReader2() throws ExecException, IOException { - /* - * remove hdfs prefix part like "hdfs://localhost.localdomain:42540" pig - * will fill that in. - */ - String str1 = pathTable1.toString().substring( - pathTable1.toString().indexOf("/", 7), pathTable1.toString().length()); - String str2 = pathTable2.toString().substring( - pathTable2.toString().indexOf("/", 7), pathTable2.toString().length()); - String query = "records = LOAD '" + str1 + "," + str2 + String query = "records = LOAD '" + pathTable1.toString() + "," + pathTable2.toString() + "' USING org.apache.hadoop.zebra.pig.TableLoader('b#{k1}');"; System.out.println(query); @@ -435,12 +409,7 @@ public class TestUnionMixedTypes { @Test // one field which exists in one table only public void testReader3() throws ExecException, IOException { - - String str1 = pathTable1.toString().substring( - pathTable1.toString().indexOf("/", 7), pathTable1.toString().length()); - String str2 = pathTable2.toString().substring( - pathTable2.toString().indexOf("/", 7), pathTable2.toString().length()); - String query = "records = LOAD '" + str1 + "," + str2 + String query = "records = LOAD '" + pathTable1.toString() + "," + pathTable2.toString() + "' USING org.apache.hadoop.zebra.pig.TableLoader('d');"; System.out.println(query); @@ -503,4 +472,4 @@ public class TestUnionMixedTypes { Assert.assertEquals(4, i); } -} \ No newline at end of file +}