You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by xu...@apache.org on 2011/05/07 02:15:44 UTC
svn commit: r1100420 [18/19] - in /pig/branches/branch-0.9: ./ src/
src/org/apache/pig/
src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/
src/org/apache/pig/impl/logicalLayer/
src/org/apache/pig/impl/logicalLayer/optimizer/ src/org/apach...
Modified: pig/branches/branch-0.9/test/org/apache/pig/test/TestPOCast.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/test/org/apache/pig/test/TestPOCast.java?rev=1100420&r1=1100419&r2=1100420&view=diff
==============================================================================
--- pig/branches/branch-0.9/test/org/apache/pig/test/TestPOCast.java (original)
+++ pig/branches/branch-0.9/test/org/apache/pig/test/TestPOCast.java Sat May 7 00:15:40 2011
@@ -46,7 +46,6 @@ import org.apache.pig.data.TupleFactory;
import org.apache.pig.impl.io.BufferedPositionedInputStream;
import org.apache.pig.impl.plan.OperatorKey;
import org.apache.pig.impl.logicalLayer.FrontendException;
-import org.apache.pig.impl.logicalLayer.parser.ParseException;
import org.apache.pig.impl.logicalLayer.schema.Schema;
import org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit;
import org.apache.pig.backend.hadoop.executionengine.physicalLayer.POStatus;
@@ -56,6 +55,7 @@ import org.apache.pig.backend.hadoop.exe
import org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POProject;
import org.apache.pig.impl.plan.PlanException;
import org.apache.pig.impl.util.Utils;
+import org.apache.pig.parser.ParserException;
import org.apache.pig.test.utils.GenRandomData;
import org.apache.pig.builtin.PigStorage;
import org.apache.pig.builtin.BinStorage;
@@ -1343,7 +1343,7 @@ public class TestPOCast extends TestCase
}
@Test
- public void testTupleToOther() throws IOException, ParseException {
+ public void testTupleToOther() throws IOException, ParserException {
POCast op = new POCast(new OperatorKey("", r.nextLong()), -1);
op.setFuncSpec(new FuncSpec(PigStorage.class.getName()));
POProject prj = new POProject(new OperatorKey("", r.nextLong()), -1, 0);
@@ -1486,7 +1486,7 @@ public class TestPOCast extends TestCase
}
@Test
- public void testBagToOther() throws IOException, ParseException {
+ public void testBagToOther() throws IOException, ParserException {
POCast op = new POCast(new OperatorKey("", r.nextLong()), -1);
op.setFuncSpec(new FuncSpec(PigStorage.class.getName()));
POProject prj = new POProject(new OperatorKey("", r.nextLong()), -1, 0);
Modified: pig/branches/branch-0.9/test/org/apache/pig/test/TestPigScriptParser.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/test/org/apache/pig/test/TestPigScriptParser.java?rev=1100420&r1=1100419&r2=1100420&view=diff
==============================================================================
--- pig/branches/branch-0.9/test/org/apache/pig/test/TestPigScriptParser.java (original)
+++ pig/branches/branch-0.9/test/org/apache/pig/test/TestPigScriptParser.java Sat May 7 00:15:40 2011
@@ -17,15 +17,12 @@
*/
package org.apache.pig.test;
-import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
import java.util.Properties;
import org.junit.Test;
@@ -35,11 +32,8 @@ import org.apache.pig.PigServer;
import org.apache.pig.ExecType;
import org.apache.pig.data.Tuple;
import org.apache.pig.impl.PigContext;
-import org.apache.pig.impl.plan.OperatorKey;
-import org.apache.pig.impl.logicalLayer.parser.* ;
import org.apache.pig.newplan.Operator;
import org.apache.pig.newplan.logical.expression.ConstantExpression;
-import org.apache.pig.newplan.logical.expression.LogicalExpression;
import org.apache.pig.newplan.logical.expression.LogicalExpressionPlan;
import org.apache.pig.newplan.logical.relational.LOFilter;
import org.apache.pig.newplan.logical.relational.LogicalPlan;
Modified: pig/branches/branch-0.9/test/org/apache/pig/test/TestProjectRange.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/test/org/apache/pig/test/TestProjectRange.java?rev=1100420&r1=1100419&r2=1100420&view=diff
==============================================================================
--- pig/branches/branch-0.9/test/org/apache/pig/test/TestProjectRange.java (original)
+++ pig/branches/branch-0.9/test/org/apache/pig/test/TestProjectRange.java Sat May 7 00:15:40 2011
@@ -37,7 +37,6 @@ import org.apache.pig.PigServer;
import org.apache.pig.backend.executionengine.ExecException;
import org.apache.pig.data.Tuple;
import org.apache.pig.impl.logicalLayer.FrontendException;
-import org.apache.pig.impl.logicalLayer.parser.ParseException;
import org.apache.pig.impl.logicalLayer.schema.Schema;
import org.apache.pig.impl.logicalLayer.schema.Schema.FieldSchema;
import org.apache.pig.impl.plan.CompilationMessageCollector;
@@ -52,6 +51,7 @@ import org.apache.pig.newplan.logical.vi
import org.apache.pig.newplan.logical.visitor.SchemaAliasVisitor;
import org.apache.pig.newplan.logical.visitor.TypeCheckingRelVisitor;
import org.apache.pig.newplan.logical.visitor.UnionOnSchemaSetter;
+import org.apache.pig.parser.ParserException;
import org.apache.pig.parser.ParserTestingUtils;
import org.apache.pig.test.utils.NewLogicalPlanUtil;
import org.junit.After;
@@ -116,11 +116,11 @@ public class TestProjectRange {
/**
* Test project-range in foreach with limits on both sides
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testFullRangeForeachWSchema() throws IOException, ParseException {
+ public void testFullRangeForeachWSchema() throws IOException, ParserException {
String query;
@@ -187,7 +187,7 @@ public class TestProjectRange {
private void compileAndCompareSchema(String expectedSchStr, String query, String alias)
- throws IOException, ParseException {
+ throws IOException, ParserException {
Schema expectedSch = null;
@@ -209,10 +209,10 @@ public class TestProjectRange {
/**
* Test project-range in foreach with starting limit
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testEndRangeForeachWSchema() throws IOException, ParseException {
+ public void testEndRangeForeachWSchema() throws IOException, ParserException {
//specifying the new aliases
String query;
@@ -265,10 +265,10 @@ public class TestProjectRange {
/**
* Test project-range in foreach with start limit
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testStartRangeForeachWSchema() throws IOException, ParseException {
+ public void testStartRangeForeachWSchema() throws IOException, ParserException {
//specifying the new aliases
String query =
@@ -323,10 +323,10 @@ public class TestProjectRange {
/**
* Test multiple different types of range-project with foreach
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testMixRangeForeachWSchema() throws IOException, ParseException {
+ public void testMixRangeForeachWSchema() throws IOException, ParserException {
//specifying the new aliases
String query;
@@ -358,10 +358,10 @@ public class TestProjectRange {
/**
* -ve test cases
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testNegativeForeachWSchema() throws IOException, ParseException {
+ public void testNegativeForeachWSchema() throws IOException, ParserException {
String query;
query =
" l1 = load '" + INP_FILE_5FIELDS + "' as (a : int, b : float, c : int, d : int, e : int);"
@@ -382,10 +382,10 @@ public class TestProjectRange {
/**
* -ve test cases
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testNegativeForeachNOSchema() throws IOException, ParseException {
+ public void testNegativeForeachNOSchema() throws IOException, ParserException {
String query;
query =
" l1 = load '" + INP_FILE_5FIELDS + "';"
@@ -405,10 +405,10 @@ public class TestProjectRange {
/**
* Test foreach without schema
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testStartRangeForeachNOSchema() throws IOException, ParseException {
+ public void testStartRangeForeachNOSchema() throws IOException, ParserException {
String query;
@@ -441,10 +441,10 @@ public class TestProjectRange {
/**
* Test foreach without schema
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testMixRangeForeachNOSchema() throws IOException, ParseException {
+ public void testMixRangeForeachNOSchema() throws IOException, ParserException {
String query;
@@ -476,10 +476,10 @@ public class TestProjectRange {
/**
* Test foreach without schema - with some operations after the foreach
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
//@Test
- public void testRangeForeachWFilterNOSchema() throws IOException, ParseException {
+ public void testRangeForeachWFilterNOSchema() throws IOException, ParserException {
//TODO: fix depends on PIG-1910
//fails with - In alias fil, incompatible types in GreaterThan
// Operator left hand side:Unknown right hand side:Unknown
@@ -506,7 +506,7 @@ public class TestProjectRange {
}
@Test
- public void testRangeOrderByWSchema() throws IOException, ParseException{
+ public void testRangeOrderByWSchema() throws IOException, ParserException{
String query;
{
@@ -601,10 +601,10 @@ public class TestProjectRange {
/**
* Test nested order-by with schema
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testRangeOrderByNestedWSchema() throws IOException, ParseException{
+ public void testRangeOrderByNestedWSchema() throws IOException, ParserException{
String query;
{
@@ -693,10 +693,10 @@ public class TestProjectRange {
/**
* Test nested order-by without schema
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testRangeOrderByNestedNOSchema() throws IOException, ParseException{
+ public void testRangeOrderByNestedNOSchema() throws IOException, ParserException{
String query;
{
@@ -816,7 +816,7 @@ public class TestProjectRange {
}
@Test
- public void testRangeOrderByMixWSchema() throws IOException, ParseException{
+ public void testRangeOrderByMixWSchema() throws IOException, ParserException{
String query;
query =
@@ -847,7 +847,7 @@ public class TestProjectRange {
@Test
- public void testRangeOrderByMixNOSchema() throws IOException, ParseException{
+ public void testRangeOrderByMixNOSchema() throws IOException, ParserException{
String query;
query =
@@ -877,7 +877,7 @@ public class TestProjectRange {
}
@Test
- public void testRangeOrderByStartNOSchema() throws IOException, ParseException{
+ public void testRangeOrderByStartNOSchema() throws IOException, ParserException{
String query;
query =
@@ -907,7 +907,7 @@ public class TestProjectRange {
}
@Test
- public void testRangeOrderByStartNegNOSchema() throws IOException, ParseException{
+ public void testRangeOrderByStartNegNOSchema() throws IOException, ParserException{
String query;
query =
@@ -919,7 +919,7 @@ public class TestProjectRange {
}
@Test
- public void testRangeGroupWSchema() throws IOException, ParseException{
+ public void testRangeGroupWSchema() throws IOException, ParserException{
String query;
{
@@ -996,10 +996,10 @@ public class TestProjectRange {
* group as a column name in schema, and to add tuple within bag schema
* @param expectedSchStr
* @return
- * @throws ParseException
+ * @throws ParserException
* @throws FrontendException
*/
- private Schema getCleanedGroupSchema(String expectedSchStr) throws ParseException, FrontendException {
+ private Schema getCleanedGroupSchema(String expectedSchStr) throws ParserException, FrontendException {
Schema expectedSch = Utils.getSchemaFromString(expectedSchStr);
expectedSch.getField(0).alias = "group";
if(expectedSch.size() > 1)
@@ -1023,7 +1023,7 @@ public class TestProjectRange {
}
@Test
- public void testRangeCoGroupMixWSchema() throws IOException, ParseException{
+ public void testRangeCoGroupMixWSchema() throws IOException, ParserException{
String query;
query =
@@ -1059,7 +1059,7 @@ public class TestProjectRange {
}
@Test
- public void testRangeGroupMixWSchema() throws IOException, ParseException{
+ public void testRangeGroupMixWSchema() throws IOException, ParserException{
String query;
{
@@ -1111,7 +1111,7 @@ public class TestProjectRange {
@Test
- public void testRangeGroupMixNOSchema() throws IOException, ParseException{
+ public void testRangeGroupMixNOSchema() throws IOException, ParserException{
String query;
{
@@ -1178,7 +1178,7 @@ public class TestProjectRange {
}
@Test
- public void testRangeJoinMixWSchema() throws IOException, ParseException{
+ public void testRangeJoinMixWSchema() throws IOException, ParserException{
String query;
query =
@@ -1211,7 +1211,7 @@ public class TestProjectRange {
}
@Test
- public void testRangeJoinMixNOSchema() throws IOException, ParseException{
+ public void testRangeJoinMixNOSchema() throws IOException, ParserException{
String query;
query =
@@ -1239,7 +1239,7 @@ public class TestProjectRange {
}
@Test
- public void testRangeCoGroupNegNoSchema() throws IOException, ParseException{
+ public void testRangeCoGroupNegNoSchema() throws IOException, ParserException{
String query;
//cogroup
query =
Modified: pig/branches/branch-0.9/test/org/apache/pig/test/TestProjectStarExpander.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/test/org/apache/pig/test/TestProjectStarExpander.java?rev=1100420&r1=1100419&r2=1100420&view=diff
==============================================================================
--- pig/branches/branch-0.9/test/org/apache/pig/test/TestProjectStarExpander.java (original)
+++ pig/branches/branch-0.9/test/org/apache/pig/test/TestProjectStarExpander.java Sat May 7 00:15:40 2011
@@ -30,18 +30,15 @@ import org.apache.pig.ExecType;
import org.apache.pig.PigServer;
import org.apache.pig.data.Tuple;
import org.apache.pig.impl.io.FileLocalizer;
-import org.apache.pig.impl.logicalLayer.parser.ParseException;
import org.apache.pig.impl.logicalLayer.schema.Schema;
import org.apache.pig.impl.util.Utils;
+import org.apache.pig.parser.ParserException;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-
-
-
/**
* Test project of multiple fields
*/
@@ -78,7 +75,7 @@ public class TestProjectStarExpander {
@Test
- public void testProjectStarForeach() throws IOException, ParseException {
+ public void testProjectStarForeach() throws IOException, ParserException {
PigServer pig = new PigServer(ExecType.LOCAL);
//specifying the new aliases only for initial set of fields
@@ -121,7 +118,7 @@ public class TestProjectStarExpander {
* @throws ParseException
*/
@Test
- public void testProjectStarMulti() throws IOException, ParseException {
+ public void testProjectStarMulti() throws IOException, ParserException {
PigServer pig = new PigServer(ExecType.LOCAL);
String query =
" l1 = load '" + INP_FILE_5FIELDS + "' as (a : int, b : int, c : int);"
Modified: pig/branches/branch-0.9/test/org/apache/pig/test/TestRelationToExprProject.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/test/org/apache/pig/test/TestRelationToExprProject.java?rev=1100420&r1=1100419&r2=1100420&view=diff
==============================================================================
--- pig/branches/branch-0.9/test/org/apache/pig/test/TestRelationToExprProject.java (original)
+++ pig/branches/branch-0.9/test/org/apache/pig/test/TestRelationToExprProject.java Sat May 7 00:15:40 2011
@@ -26,12 +26,10 @@ import java.util.Map;
import org.apache.pig.PigServer;
import org.apache.pig.data.BagFactory;
-import org.apache.pig.data.DataByteArray;
import org.apache.pig.data.DefaultTuple;
import org.apache.pig.data.Tuple;
import org.apache.pig.data.TupleFactory;
-import org.apache.pig.impl.logicalLayer.parser.ParseException;
-import org.apache.pig.impl.util.LogUtils;
+import org.apache.pig.parser.ParserException;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@@ -91,7 +89,7 @@ public class TestRelationToExprProject e
// for a group, an empty bag is still provided to udfs whose
// input is the filter
@Test
- public void testFilterCount1() throws IOException, ParseException {
+ public void testFilterCount1() throws IOException, ParserException {
String[] inputData = new String[] {"1\t1\t3","1\t2\t3", "2\t1\t3", "2\t1\t3"};
Util.createInputFile(cluster, "test.txt", inputData);
@@ -132,7 +130,7 @@ public class TestRelationToExprProject e
// for a group, an empty bag is still provided to udfs whose
// input is the filter
@Test
- public void testFilterCount2() throws IOException, ParseException {
+ public void testFilterCount2() throws IOException, ParserException {
Util.createInputFile(cluster, "filterbug.data", new String[] {
"a\thello" ,
"a\tgoodbye" ,
@@ -176,7 +174,7 @@ public class TestRelationToExprProject e
// for a group, an empty bag is still provided to udfs whose
// input is the filter
@Test
- public void testFilterCount3() throws IOException, ParseException {
+ public void testFilterCount3() throws IOException, ParserException {
Util.copyFromLocalToCluster(cluster, TEST_FILTER_COUNT3_INPUT, "testdata");
String query = "TESTDATA = load 'testdata' using PigStorage() as (timestamp:chararray, testid:chararray, userid: chararray, sessionid:chararray, value:long, flag:int);" +
"TESTDATA_FILTERED = filter TESTDATA by (timestamp gte '1230800400000' and timestamp lt '1230804000000' and value != 0);" +
@@ -205,7 +203,7 @@ public class TestRelationToExprProject e
// single inner plan of foreach - this will test that it does
// send an EOP eventually for each input of the foreach
@Test
- public void testFilter1() throws IOException, ParseException {
+ public void testFilter1() throws IOException, ParserException {
String[] inputData = new String[] {"1\t1\t3","1\t2\t3", "2\t1\t3", "2\t1\t3", "3\t4\t4"};
Util.createInputFile(cluster, "test.txt", inputData);
@@ -246,7 +244,7 @@ public class TestRelationToExprProject e
// the state that empty bags need to be sent on EOP if no non-EOP
// input has been seen on a fresh input from foreach.
@Test
- public void testFilter2() throws IOException, ParseException {
+ public void testFilter2() throws IOException, ParserException {
String[] inputData = new String[] {"1\t1\t3","1\t2\t3", "2\t1\t3", "2\t1\t3", "3\t4\t4"};
Util.createInputFile(cluster, "test.txt", inputData);
Modified: pig/branches/branch-0.9/test/org/apache/pig/test/TestStore.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/test/org/apache/pig/test/TestStore.java?rev=1100420&r1=1100419&r2=1100420&view=diff
==============================================================================
--- pig/branches/branch-0.9/test/org/apache/pig/test/TestStore.java (original)
+++ pig/branches/branch-0.9/test/org/apache/pig/test/TestStore.java Sat May 7 00:15:40 2011
@@ -57,7 +57,6 @@ import org.apache.pig.data.Tuple;
import org.apache.pig.impl.PigContext;
import org.apache.pig.impl.io.FileLocalizer;
import org.apache.pig.impl.logicalLayer.FrontendException;
-import org.apache.pig.impl.logicalLayer.parser.ParseException;
import org.apache.pig.impl.logicalLayer.schema.Schema;
import org.apache.pig.impl.plan.PlanValidationException;
import org.apache.pig.impl.util.Utils;
@@ -65,6 +64,7 @@ import org.apache.pig.newplan.Operator;
import org.apache.pig.newplan.logical.relational.LOStore;
import org.apache.pig.newplan.logical.relational.LogicalPlan;
import org.apache.pig.newplan.logical.rules.InputOutputFileValidator;
+import org.apache.pig.parser.ParserException;
import org.apache.pig.parser.QueryParserDriver;
import org.apache.pig.test.utils.GenRandomData;
import org.apache.pig.test.utils.TestHelper;
@@ -305,7 +305,7 @@ public class TestStore extends junit.fra
}
}
@Test
- public void testBinStorageGetSchema() throws IOException, ParseException {
+ public void testBinStorageGetSchema() throws IOException, ParserException {
String input[] = new String[] { "hello\t1\t10.1", "bye\t2\t20.2" };
String inputFileName = "testGetSchema-input.txt";
String outputFileName = "testGetSchema-output.txt";
Modified: pig/branches/branch-0.9/test/org/apache/pig/test/TestStoreInstances.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/test/org/apache/pig/test/TestStoreInstances.java?rev=1100420&r1=1100419&r2=1100420&view=diff
==============================================================================
--- pig/branches/branch-0.9/test/org/apache/pig/test/TestStoreInstances.java (original)
+++ pig/branches/branch-0.9/test/org/apache/pig/test/TestStoreInstances.java Sat May 7 00:15:40 2011
@@ -41,7 +41,7 @@ import org.apache.pig.backend.executione
import org.apache.pig.backend.executionengine.ExecJob.JOB_STATUS;
import org.apache.pig.data.Tuple;
import org.apache.pig.impl.io.FileLocalizer;
-import org.apache.pig.impl.logicalLayer.parser.ParseException;
+import org.apache.pig.parser.ParserException;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@@ -98,7 +98,7 @@ public class TestStoreInstances {
* @throws ParseException
*/
@Test
- public void testBackendStoreCommunication() throws IOException, ParseException {
+ public void testBackendStoreCommunication() throws IOException, ParserException {
ExecType[] execTypes = { ExecType.MAPREDUCE, ExecType.LOCAL};
PigServer pig = null;
for(ExecType execType : execTypes){
Modified: pig/branches/branch-0.9/test/org/apache/pig/test/TestTypeCheckingValidatorNewLP.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/test/org/apache/pig/test/TestTypeCheckingValidatorNewLP.java?rev=1100420&r1=1100419&r2=1100420&view=diff
==============================================================================
--- pig/branches/branch-0.9/test/org/apache/pig/test/TestTypeCheckingValidatorNewLP.java (original)
+++ pig/branches/branch-0.9/test/org/apache/pig/test/TestTypeCheckingValidatorNewLP.java Sat May 7 00:15:40 2011
@@ -55,7 +55,6 @@ import org.apache.pig.data.TupleFactory;
import org.apache.pig.impl.PigContext;
import org.apache.pig.impl.io.FileSpec;
import org.apache.pig.impl.logicalLayer.FrontendException;
-import org.apache.pig.impl.logicalLayer.parser.ParseException;
import org.apache.pig.impl.logicalLayer.schema.Schema;
import org.apache.pig.impl.logicalLayer.schema.Schema.FieldSchema;
import org.apache.pig.impl.logicalLayer.validators.TypeCheckerException;
@@ -114,6 +113,7 @@ import org.apache.pig.newplan.logical.vi
import org.apache.pig.newplan.logical.visitor.TypeCheckingExpVisitor;
import org.apache.pig.newplan.logical.visitor.TypeCheckingRelVisitor;
import org.apache.pig.newplan.logical.visitor.UnionOnSchemaSetter;
+import org.apache.pig.parser.ParserException;
import org.apache.pig.parser.ParserTestingUtils;
import org.junit.Before;
import org.junit.Test;
@@ -4069,7 +4069,7 @@ public class TestTypeCheckingValidatorNe
// See PIG-2004
@Test
- public void testDereferenceTypeSet() throws IOException, ParseException {
+ public void testDereferenceTypeSet() throws IOException, ParserException {
String query = "a = load 'a' as (i : int, j : int) ;"
+ " b = foreach a generate i, j/10.1 as jd;"
+ " c = group b by i;"
@@ -4105,7 +4105,7 @@ public class TestTypeCheckingValidatorNe
//see PIG-1990
@Test
- public void testCastEmptyInnerSchema() throws IOException, ParseException{
+ public void testCastEmptyInnerSchema() throws IOException, ParserException{
final String INP_FILE = "testCastEmptyInnerSchema.txt";
PrintWriter w = new PrintWriter(new FileWriter(INP_FILE));
w.println("(1,2)");
Modified: pig/branches/branch-0.9/test/org/apache/pig/test/TestTypedMap.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/test/org/apache/pig/test/TestTypedMap.java?rev=1100420&r1=1100419&r2=1100420&view=diff
==============================================================================
--- pig/branches/branch-0.9/test/org/apache/pig/test/TestTypedMap.java (original)
+++ pig/branches/branch-0.9/test/org/apache/pig/test/TestTypedMap.java Sat May 7 00:15:40 2011
@@ -18,36 +18,24 @@
package org.apache.pig.test;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
import java.io.File;
-import java.io.FileWriter;
import java.io.IOException;
-import java.io.PrintWriter;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import junit.framework.Assert;
+import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.mapred.lib.FieldSelectionMapReduce;
-import org.apache.pig.EvalFunc;
import org.apache.pig.ExecType;
-import org.apache.pig.PigException;
import org.apache.pig.PigServer;
-import org.apache.pig.backend.executionengine.ExecException;
import org.apache.pig.data.DataBag;
import org.apache.pig.data.DataByteArray;
-import org.apache.pig.data.DataType;
import org.apache.pig.data.Tuple;
import org.apache.pig.impl.io.FileLocalizer;
-import org.apache.pig.impl.logicalLayer.FrontendException;
-import org.apache.pig.impl.logicalLayer.parser.ParseException;
import org.apache.pig.impl.logicalLayer.schema.Schema;
-import org.apache.pig.impl.logicalLayer.schema.Schema.FieldSchema;
-import org.apache.pig.impl.util.LogUtils;
+import org.apache.pig.parser.ParserException;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@@ -56,44 +44,60 @@ import org.junit.Test;
public class TestTypedMap {
static MiniCluster cluster ;
+ private String tmpDirName = System.getProperty("java.io.tmpdir") + "/pigtest/tmp";
@Before
public void setUp() throws Exception {
FileLocalizer.setInitialized(false);
- }
+ File tmpDir = new File(tmpDirName);
+ if (tmpDir.exists()) {
+ for (File tmpFile : tmpDir.listFiles()) {
+ tmpFile.delete();
+ }
+ } else {
+ tmpDir.mkdirs();
+ }
+ }
@After
public void tearDown() throws Exception {
+ File tmpDir = new File(tmpDirName);
+ if (tmpDir.exists()) {
+ for (File tmpFile : tmpDir.listFiles()) {
+ tmpFile.delete();
+ }
+ tmpDir.delete();
+ }
}
-
+
@BeforeClass
public static void oneTimeSetup() throws IOException, Exception {
- cluster = MiniCluster.buildCluster();
+ cluster = MiniCluster.buildCluster();
}
-
+
@AfterClass
public static void oneTimeTearDown() throws Exception {
cluster.shutDown();
}
-
+
@Test
- public void testSimpleLoad() throws IOException, ParseException {
- PigServer pig = new PigServer(ExecType.MAPREDUCE, cluster.getProperties());
+ public void testSimpleLoad() throws IOException, ParserException {
+ PigServer pig = new PigServer(ExecType.LOCAL, cluster.getProperties());
String[] input = {
"[key#1,key2#2]",
"[key#2]",
};
-
- Util.createInputFile(cluster, "table_testSimpleLoad", input);
-
+
+ Util.createInputFile(FileSystem.getLocal(new Configuration()), tmpDirName + "/table_testSimpleLoad", input);
+
String query =
- " a = load 'table_testSimpleLoad' as (m:map[int]);";
+ " a = load '" + tmpDirName + "/table_testSimpleLoad' as (m:map[int]);";
Util.registerMultiLineQuery(pig, query);
Schema sch = pig.dumpSchema("a");
assertEquals("Checking expected schema",sch.toString(), "{m: map[int]}");
Iterator<Tuple> it = pig.openIterator("a");
-
+
Assert.assertTrue(it.hasNext());
Tuple t = it.next();
Assert.assertTrue(t.size()==1);
@@ -104,65 +108,65 @@ public class TestTypedMap {
Assert.assertTrue(((Map)t.get(0)).get("key").toString().equals("1"));
Assert.assertTrue(((Map)t.get(0)).get("key2") instanceof Integer);
Assert.assertTrue(((Map)t.get(0)).get("key2").toString().equals("2"));
-
+
Assert.assertTrue(it.hasNext());
t = it.next();
Assert.assertTrue(((Map)t.get(0)).containsKey("key"));
Assert.assertTrue(((Map)t.get(0)).get("key") instanceof Integer);
Assert.assertTrue(((Map)t.get(0)).get("key").toString().equals("2"));
-
+
Assert.assertFalse(it.hasNext());
}
-
+
@Test
- public void testSimpleMapKeyLookup() throws IOException, ParseException {
- PigServer pig = new PigServer(ExecType.MAPREDUCE, cluster.getProperties());
+ public void testSimpleMapKeyLookup() throws IOException, ParserException {
+ PigServer pig = new PigServer(ExecType.LOCAL, cluster.getProperties());
String[] input = {
"[key#1,key2#2]",
"[key#2]",
};
-
- Util.createInputFile(cluster, "testSimpleMapKeyLookup", input);
-
+
+ Util.createInputFile(FileSystem.getLocal(new Configuration()), tmpDirName + "/testSimpleMapKeyLookup", input);
+
String query =
- "a = load 'testSimpleMapKeyLookup' as (m:map[int]);" +
+ "a = load '" + tmpDirName + "/testSimpleMapKeyLookup' as (m:map[int]);" +
"b = foreach a generate m#'key';";
Util.registerMultiLineQuery(pig, query);
Schema sch = pig.dumpSchema("b");
assertEquals("Checking expected schema",sch.toString(), "{int}");
Iterator<Tuple> it = pig.openIterator("b");
-
+
Assert.assertTrue(it.hasNext());
Tuple t = it.next();
Assert.assertTrue(t.size()==1);
Assert.assertTrue((Integer)t.get(0)==1);
-
+
Assert.assertTrue(it.hasNext());
t = it.next();
Assert.assertTrue(t.size()==1);
Assert.assertTrue((Integer)t.get(0)==2);
-
+
Assert.assertFalse(it.hasNext());
}
-
+
@Test
- public void testSimpleMapCast() throws IOException, ParseException {
- PigServer pig = new PigServer(ExecType.MAPREDUCE, cluster.getProperties());
+ public void testSimpleMapCast() throws IOException, ParserException {
+ PigServer pig = new PigServer(ExecType.LOCAL, cluster.getProperties());
String[] input = {
"[key#1,key2#2]",
"[key#2]",
};
-
- Util.createInputFile(cluster, "testSimpleMapCast", input);
-
+
+ Util.createInputFile(FileSystem.getLocal(new Configuration()), tmpDirName + "/testSimpleMapCast", input);
+
String query =
- "a = load 'testSimpleMapCast' as (m);" +
+ "a = load '" + tmpDirName + "/testSimpleMapCast' as (m);" +
"b = foreach a generate ([int])m;";
Util.registerMultiLineQuery(pig, query);
Schema sch = pig.dumpSchema("b");
assertEquals("Checking expected schema",sch.toString(), "{m: map[int]}");
Iterator<Tuple> it = pig.openIterator("b");
-
+
Assert.assertTrue(it.hasNext());
Tuple t = it.next();
Assert.assertTrue(t.size()==1);
@@ -173,32 +177,32 @@ public class TestTypedMap {
Assert.assertTrue(((Map)t.get(0)).get("key").toString().equals("1"));
Assert.assertTrue(((Map)t.get(0)).get("key2") instanceof Integer);
Assert.assertTrue(((Map)t.get(0)).get("key2").toString().equals("2"));
-
+
Assert.assertTrue(it.hasNext());
t = it.next();
Assert.assertTrue(((Map)t.get(0)).containsKey("key"));
Assert.assertTrue(((Map)t.get(0)).get("key") instanceof Integer);
Assert.assertTrue(((Map)t.get(0)).get("key").toString().equals("2"));
-
+
Assert.assertFalse(it.hasNext());
}
-
+
@Test
- public void testComplexLoad() throws IOException, ParseException {
- PigServer pig = new PigServer(ExecType.MAPREDUCE, cluster.getProperties());
+ public void testComplexLoad() throws IOException, ParserException {
+ PigServer pig = new PigServer(ExecType.LOCAL, cluster.getProperties());
String[] input = {
"[key#{(1,2),(1,3)},134#]",
"[key2#]",
};
-
- Util.createInputFile(cluster, "testComplexLoad", input);
-
- String query = "a = load 'testComplexLoad' as (m:map[bag{(i:int,j:int)}]);";
+
+ Util.createInputFile(FileSystem.getLocal(new Configuration()), tmpDirName + "/testComplexLoad", input);
+
+ String query = "a = load '" + tmpDirName + "/testComplexLoad' as (m:map[bag{(i:int,j:int)}]);";
Util.registerMultiLineQuery(pig, query);
Schema sch = pig.dumpSchema("a");
assertEquals("Checking expected schema",sch.toString(), "{m: map[{(i: int,j: int)}]}");
Iterator<Tuple> it = pig.openIterator("a");
-
+
Assert.assertTrue(it.hasNext());
Tuple t = it.next();
Assert.assertTrue(t.size()==1);
@@ -208,32 +212,32 @@ public class TestTypedMap {
Assert.assertTrue(((Map)t.get(0)).get("key") instanceof DataBag);
Assert.assertTrue(((Map)t.get(0)).get("key").toString().equals("{(1,2),(1,3)}"));
Assert.assertTrue(((Map)t.get(0)).get("134")==null);
-
+
Assert.assertTrue(it.hasNext());
t = it.next();
Assert.assertTrue(((Map)t.get(0)).containsKey("key2"));
Assert.assertTrue(((Map)t.get(0)).get("key2")==null);
-
+
Assert.assertFalse(it.hasNext());
}
-
+
@Test
- public void testComplexCast() throws IOException, ParseException {
- PigServer pig = new PigServer(ExecType.MAPREDUCE, cluster.getProperties());
+ public void testComplexCast() throws IOException, ParserException {
+ PigServer pig = new PigServer(ExecType.LOCAL, cluster.getProperties());
String[] input = {
"[key#{(1,2),(1,3)},134#]",
"[key2#]",
};
-
- Util.createInputFile(cluster, "testComplexCast", input);
-
- String query = "a = load 'testComplexCast' as (m);" +
+
+ Util.createInputFile(FileSystem.getLocal(new Configuration()), tmpDirName + "/testComplexCast", input);
+
+ String query = "a = load '" + tmpDirName + "/testComplexCast' as (m);" +
"b = foreach a generate ([{(i:int,j:int)}])m;";
Util.registerMultiLineQuery(pig, query);
Schema sch = pig.dumpSchema("b");
assertEquals("Checking expected schema",sch.toString(), "{m: map[{(i: int,j: int)}]}");
Iterator<Tuple> it = pig.openIterator("b");
-
+
Assert.assertTrue(it.hasNext());
Tuple t = it.next();
Assert.assertTrue(t.size()==1);
@@ -243,31 +247,31 @@ public class TestTypedMap {
Assert.assertTrue(((Map)t.get(0)).get("key") instanceof DataBag);
Assert.assertTrue(((Map)t.get(0)).get("key").toString().equals("{(1,2),(1,3)}"));
Assert.assertTrue(((Map)t.get(0)).get("134")==null);
-
+
Assert.assertTrue(it.hasNext());
t = it.next();
Assert.assertTrue(((Map)t.get(0)).containsKey("key2"));
Assert.assertTrue(((Map)t.get(0)).get("key2")==null);
-
+
Assert.assertFalse(it.hasNext());
}
-
+
@Test
- public void testComplexCast2() throws IOException, ParseException {
- PigServer pig = new PigServer(ExecType.MAPREDUCE, cluster.getProperties());
+ public void testComplexCast2() throws IOException, ParserException {
+ PigServer pig = new PigServer(ExecType.LOCAL, cluster.getProperties());
String[] input = {
"[key#1,key2#2]",
};
-
- Util.createInputFile(cluster, "testComplexCast2", input);
-
- String query = "a = load 'testComplexCast2' as (m:[int]);" +
+
+ Util.createInputFile(FileSystem.getLocal(new Configuration()), tmpDirName + "/testComplexCast2", input);
+
+ String query = "a = load '" + tmpDirName + "/testComplexCast2' as (m:[int]);" +
"b = foreach a generate ([long])m;";
Util.registerMultiLineQuery(pig, query);
Schema sch = pig.dumpSchema("b");
assertEquals("Checking expected schema",sch.toString(), "{m: map[long]}");
Iterator<Tuple> it = pig.openIterator("b");
-
+
Assert.assertTrue(it.hasNext());
Tuple t = it.next();
Assert.assertTrue(t.size()==1);
@@ -278,25 +282,25 @@ public class TestTypedMap {
Assert.assertTrue(((Map)t.get(0)).get("key").toString().equals("1"));
Assert.assertTrue(((Map)t.get(0)).get("key2") instanceof Long);
Assert.assertTrue(((Map)t.get(0)).get("key2").toString().equals("2"));
-
+
Assert.assertFalse(it.hasNext());
}
-
+
@Test
- public void testUnTypedMap() throws IOException, ParseException {
- PigServer pig = new PigServer(ExecType.MAPREDUCE, cluster.getProperties());
+ public void testUnTypedMap() throws IOException, ParserException {
+ PigServer pig = new PigServer(ExecType.LOCAL, cluster.getProperties());
String[] input = {
"[key#1,key2#2]",
};
-
- Util.createInputFile(cluster, "testUnTypedMap", input);
-
- String query = "a = load 'testUnTypedMap' as (m:[]);";
+
+ Util.createInputFile(FileSystem.getLocal(new Configuration()), tmpDirName + "/testUnTypedMap", input);
+
+ String query = "a = load '" + tmpDirName + "/testUnTypedMap' as (m:[]);";
Util.registerMultiLineQuery(pig, query);
Schema sch = pig.dumpSchema("a");
assertEquals("Checking expected schema",sch.toString(), "{m: map[]}");
Iterator<Tuple> it = pig.openIterator("a");
-
+
Assert.assertTrue(it.hasNext());
Tuple t = it.next();
Assert.assertTrue(t.size()==1);
@@ -307,56 +311,56 @@ public class TestTypedMap {
Assert.assertTrue(((Map)t.get(0)).get("key").toString().equals("1"));
Assert.assertTrue(((Map)t.get(0)).get("key2") instanceof DataByteArray);
Assert.assertTrue(((Map)t.get(0)).get("key2").toString().equals("2"));
-
+
Assert.assertFalse(it.hasNext());
}
-
+
@Test
- public void testOrderBy() throws IOException, ParseException {
- PigServer pig = new PigServer(ExecType.MAPREDUCE, cluster.getProperties());
+ public void testOrderBy() throws IOException, ParserException {
+ PigServer pig = new PigServer(ExecType.LOCAL, cluster.getProperties());
String[] input = {
"[key#1,key1#2]",
"[key#2,key3#2]",
"[key#11]",
};
-
- Util.createInputFile(cluster, "testOrderBy", input);
-
- String query = "a = load 'testOrderBy' as (m:[int]);" +
+
+ Util.createInputFile(FileSystem.getLocal(new Configuration()), tmpDirName + "/testOrderBy", input);
+
+ String query = "a = load '" + tmpDirName + "/testOrderBy' as (m:[int]);" +
"b = foreach a generate m#'key' as b0;" +
"c = order b by b0;";
Util.registerMultiLineQuery(pig, query);
Iterator<Tuple> it = pig.openIterator("c");
-
+
Assert.assertTrue(it.hasNext());
Tuple t = it.next();
Assert.assertTrue(t.toString().equals("(1)"));
-
+
Assert.assertTrue(it.hasNext());
t = it.next();
Assert.assertTrue(t.toString().equals("(2)"));
-
+
Assert.assertTrue(it.hasNext());
t = it.next();
Assert.assertTrue(t.toString().equals("(11)"));
-
+
Assert.assertFalse(it.hasNext());
-
+
// Untyped map will sort by byte type, which is different
- query = "a = load 'testOrderBy' as (m:[]);" +
+ query = "a = load '" + tmpDirName + "/testOrderBy' as (m:[]);" +
"b = foreach a generate m#'key' as b0;" +
"c = order b by b0;";
Util.registerMultiLineQuery(pig, query);
it = pig.openIterator("c");
-
+
Assert.assertTrue(it.hasNext());
t = it.next();
Assert.assertTrue(t.toString().equals("(1)"));
-
+
Assert.assertTrue(it.hasNext());
t = it.next();
Assert.assertTrue(t.toString().equals("(11)"));
-
+
Assert.assertTrue(it.hasNext());
t = it.next();
Assert.assertTrue(t.toString().equals("(2)"));
Modified: pig/branches/branch-0.9/test/org/apache/pig/test/TestUnionOnSchema.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/test/org/apache/pig/test/TestUnionOnSchema.java?rev=1100420&r1=1100419&r2=1100420&view=diff
==============================================================================
--- pig/branches/branch-0.9/test/org/apache/pig/test/TestUnionOnSchema.java (original)
+++ pig/branches/branch-0.9/test/org/apache/pig/test/TestUnionOnSchema.java Sat May 7 00:15:40 2011
@@ -40,11 +40,11 @@ import org.apache.pig.data.DataType;
import org.apache.pig.data.Tuple;
import org.apache.pig.impl.io.FileLocalizer;
import org.apache.pig.impl.logicalLayer.FrontendException;
-import org.apache.pig.impl.logicalLayer.parser.ParseException;
import org.apache.pig.impl.logicalLayer.schema.Schema;
import org.apache.pig.impl.logicalLayer.schema.Schema.FieldSchema;
import org.apache.pig.impl.util.LogUtils;
import org.apache.pig.impl.util.Utils;
+import org.apache.pig.parser.ParserException;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@@ -109,10 +109,10 @@ public class TestUnionOnSchema {
/**
* Test UNION ONSCHEMA on two inputs with same schema
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testUnionOnSchemaSameSchema() throws IOException, ParseException {
+ public void testUnionOnSchemaSameSchema() throws IOException, ParserException {
PigServer pig = new PigServer(ExecType.LOCAL);
String query =
" l1 = load '" + INP_FILE_2NUMS + "' as (i : int, j : int);"
@@ -141,10 +141,10 @@ public class TestUnionOnSchema {
/**
* Test UNION ONSCHEMA with operations after the union
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testUnionOnSchemaFilter() throws IOException, ParseException {
+ public void testUnionOnSchemaFilter() throws IOException, ParserException {
PigServer pig = new PigServer(ExecType.LOCAL);
String query =
" l1 = load '" + INP_FILE_2NUMS + "' as (i : int, x : int);"
@@ -174,10 +174,10 @@ public class TestUnionOnSchema {
/**
* Test UNION ONSCHEMA with operations after the union
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testUnionOnSchemaSuccOps() throws IOException, ParseException {
+ public void testUnionOnSchemaSuccOps() throws IOException, ParserException {
PigServer pig = new PigServer(ExecType.LOCAL);
String query =
" l1 = load '" + INP_FILE_2NUMS + "' as (i : int);"
@@ -207,10 +207,10 @@ public class TestUnionOnSchema {
/**
* Test UNION ONSCHEMA with cast from bytearray to another type
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testUnionOnSchemaCastOnByteArray() throws IOException, ParseException {
+ public void testUnionOnSchemaCastOnByteArray() throws IOException, ParserException {
PigServer pig = new PigServer(ExecType.LOCAL);
String query =
" l1 = load '" + INP_FILE_2NUMS + "' as (i, j);"
@@ -236,10 +236,10 @@ public class TestUnionOnSchema {
* Test UNION ONSCHEMA where a common column has additional 'namespace' part
* in the column name in one of the inputs
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testUnionOnSchemaScopedColumnName() throws IOException, ParseException {
+ public void testUnionOnSchemaScopedColumnName() throws IOException, ParserException {
PigServer pig = new PigServer(ExecType.LOCAL);
String query_prefix =
" l1 = load '" + INP_FILE_2NUMS + "' as (i : int, j : int); "
@@ -279,10 +279,10 @@ public class TestUnionOnSchema {
* Test UNION ONSCHEMA where a common column has additional 'namespace' part
* in the column name in both the inputs
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testUnionOnSchemaScopedColumnNameBothInp1() throws IOException, ParseException {
+ public void testUnionOnSchemaScopedColumnNameBothInp1() throws IOException, ParserException {
PigServer pig = new PigServer(ExecType.LOCAL);
String query =
" l1 = load '" + INP_FILE_2NUMS + "' as (i : int, j : int); "
@@ -315,10 +315,10 @@ public class TestUnionOnSchema {
* Test UNION ONSCHEMA where a common column has additional 'namespace' part
* in the column name in both the inputs
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testUnionOnSchemaScopedColumnNameBothInp2() throws IOException, ParseException {
+ public void testUnionOnSchemaScopedColumnNameBothInp2() throws IOException, ParserException {
PigServer pig = new PigServer(ExecType.LOCAL);
String query =
" l1 = load '" + INP_FILE_2NUMS + "' as (i : int, j : int); "
@@ -353,10 +353,10 @@ public class TestUnionOnSchema {
* in the column name in one of the inputs.
* Negative test case
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testUnionOnSchemaScopedColumnNameNeg() throws IOException, ParseException {
+ public void testUnionOnSchemaScopedColumnNameNeg() throws IOException, ParserException {
String expectedErr = "Found more than one match: l1::i, l2::i";
String query_prefix =
@@ -379,10 +379,10 @@ public class TestUnionOnSchema {
* Test UNION ONSCHEMA on two inputs with same column names, but different
* numeric types - test type promotion
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testUnionOnSchemaDiffNumType() throws IOException, ParseException {
+ public void testUnionOnSchemaDiffNumType() throws IOException, ParserException {
PigServer pig = new PigServer(ExecType.LOCAL);
String query =
" l1 = load '" + INP_FILE_2NUMS + "' as (i : int, j : double);"
@@ -409,10 +409,10 @@ public class TestUnionOnSchema {
/**
* Test UNION ONSCHEMA on two inputs with no common columns
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testUnionOnSchemaNoCommonCols() throws IOException, ParseException {
+ public void testUnionOnSchemaNoCommonCols() throws IOException, ParserException {
PigServer pig = new PigServer(ExecType.LOCAL);
String query =
" l1 = load '" + INP_FILE_2NUMS + "' as (i : int, j : int);"
@@ -437,10 +437,10 @@ public class TestUnionOnSchema {
/**
* Test UNION ONSCHEMA on two inputs , one input with additional columns
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testUnionOnSchemaAdditionalColumn() throws IOException, ParseException {
+ public void testUnionOnSchemaAdditionalColumn() throws IOException, ParserException {
PigServer pig = new PigServer(ExecType.MAPREDUCE, cluster.getProperties());
//PigServer pig = new PigServer(ExecType.LOCAL);
String query =
@@ -473,10 +473,10 @@ public class TestUnionOnSchema {
/**
* Test UNION ONSCHEMA on 3 inputs
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testUnionOnSchema3Inputs() throws IOException, ParseException {
+ public void testUnionOnSchema3Inputs() throws IOException, ParserException {
PigServer pig = new PigServer(ExecType.LOCAL);
String query =
" l1 = load '" + INP_FILE_2NUMS + "' as (i : int, j : int); "
@@ -508,10 +508,10 @@ public class TestUnionOnSchema {
/**
* Test UNION ONSCHEMA with bytearray type
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testUnionOnSchemaByteArrayConversions() throws IOException, ParseException {
+ public void testUnionOnSchemaByteArrayConversions() throws IOException, ParserException {
PigServer pig = new PigServer(ExecType.LOCAL);
String query =
" l1 = load '" + INP_FILE_2NUM_1CHAR_1BAG + "' as "
@@ -547,10 +547,10 @@ public class TestUnionOnSchema {
/**
* negative test - test error on no schema
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testUnionOnSchemaNoSchema() throws IOException, ParseException {
+ public void testUnionOnSchemaNoSchema() throws IOException, ParserException {
String expectedErr = "UNION ONSCHEMA cannot be used with " +
"relations that have null schema";
String query =
@@ -572,10 +572,10 @@ public class TestUnionOnSchema {
/**
* negative test - test error on null alias in one of the FieldSchema
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testUnionOnSchemaNullAliasInFieldSchema() throws IOException, ParseException {
+ public void testUnionOnSchemaNullAliasInFieldSchema() throws IOException, ParserException {
String expectedErr = "Schema of relation f has a null fieldschema for " +
"column(s). Schema ::long,y:float";
String query =
@@ -615,10 +615,10 @@ public class TestUnionOnSchema {
/**
* negative test - test error on incompatible types in schema
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testUnionOnSchemaIncompatibleTypes() throws IOException, ParseException {
+ public void testUnionOnSchemaIncompatibleTypes() throws IOException, ParserException {
String query =
" l1 = load '" + INP_FILE_2NUMS + "' as (x : long, y : chararray);"
+ "l2 = load '" + INP_FILE_2NUMS + "' as (x : long, y : float);"
@@ -674,7 +674,7 @@ public class TestUnionOnSchema {
}
- private void checkSchemaEquals(String query, String schemaStr) throws IOException, ParseException {
+ private void checkSchemaEquals(String query, String schemaStr) throws IOException, ParserException {
Schema expectedSch = Utils.getSchemaFromString(schemaStr);
checkSchemaEquals(query, expectedSch);
}
@@ -683,10 +683,10 @@ public class TestUnionOnSchema {
/**
* Test UNION ONSCHEMA with input relation having udfs
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testUnionOnSchemaInputUdfs() throws IOException, ParseException {
+ public void testUnionOnSchemaInputUdfs() throws IOException, ParserException {
PigServer pig = new PigServer(ExecType.LOCAL);
String query =
" l1 = load '" + INP_FILE_2NUMS + "' as (i : int, j : chararray);"
@@ -720,10 +720,10 @@ public class TestUnionOnSchema {
* Test UNION ONSCHEMA with udf whose default type is different from
* final type
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testUnionOnSchemaUdfTypeEvolution() throws IOException, ParseException {
+ public void testUnionOnSchemaUdfTypeEvolution() throws IOException, ParserException {
PigServer pig = new PigServer(ExecType.MAPREDUCE, cluster.getProperties());
//PigServer pig = new PigServer(ExecType.LOCAL);
String query_prefix =
@@ -773,10 +773,10 @@ public class TestUnionOnSchema {
* Test UNION ONSCHEMA with udf whose default type is different from
* final type - where udf is not in immediate input of union
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testUnionOnSchemaUdfTypeEvolution2() throws IOException, ParseException {
+ public void testUnionOnSchemaUdfTypeEvolution2() throws IOException, ParserException {
PigServer pig = new PigServer(ExecType.LOCAL);
String query_prefix =
" l1 = load '" + INP_FILE_2NUM_1CHAR_1BAG + "' as "
@@ -844,10 +844,10 @@ public class TestUnionOnSchema {
* Test UNION ONSCHEMA with input relation having column names with multiple
* level of namespace in their names
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testUnionOnSchemaScopeMulti() throws IOException, ParseException {
+ public void testUnionOnSchemaScopeMulti() throws IOException, ParserException {
PigServer pig = new PigServer(ExecType.LOCAL);
String query_prefix =
" a = load '" + INP_FILE_2NUMS+ "' as (i:int, j:int); "
@@ -891,10 +891,10 @@ public class TestUnionOnSchema {
/**
* Test query with a union-onschema having another as input
* @throws IOException
- * @throws ParseException
+ * @throws ParserException
*/
@Test
- public void testTwoUnions() throws IOException, ParseException {
+ public void testTwoUnions() throws IOException, ParserException {
PigServer pig = new PigServer(ExecType.LOCAL);
String query =
" l1 = load '" + INP_FILE_2NUMS + "' as (i : int, j : int);"
Modified: pig/branches/branch-0.9/test/org/apache/pig/test/TypeGraphPrinter.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/test/org/apache/pig/test/TypeGraphPrinter.java?rev=1100420&r1=1100419&r2=1100420&view=diff
==============================================================================
--- pig/branches/branch-0.9/test/org/apache/pig/test/TypeGraphPrinter.java (original)
+++ pig/branches/branch-0.9/test/org/apache/pig/test/TypeGraphPrinter.java Sat May 7 00:15:40 2011
@@ -1,323 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pig.test;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.ArrayList;
-
-import org.apache.pig.data.DataType;
-import org.apache.pig.impl.logicalLayer.*;
-import org.apache.pig.impl.logicalLayer.parser.ParseException ;
-import org.apache.pig.impl.logicalLayer.schema.Schema;
-import org.apache.pig.impl.plan.* ;
-
-/**
- * This class transforms LogicalPlan to its textual representation
- *
- */
-public class TypeGraphPrinter extends LOVisitor {
-
- private StringBuilder sb = null ;
- private int currentTabCount = 0 ;
-
- public TypeGraphPrinter(LogicalPlan plan) {
- super(plan, new DependencyOrderWalker<LogicalOperator, LogicalPlan>(plan));
- sb = new StringBuilder() ;
- }
-
- private void printTabs() {
- for (int i=0; i< currentTabCount; i++) {
- sb.append("\t") ;
- }
- }
-
- protected void visit(LogicalOperator op) {
- appendOp(op) ;
- }
-
- protected void visit(ExpressionOperator op) {
- appendOp(op) ;
- }
-
- protected void visit(BinaryExpressionOperator op) {
- appendOp(op) ;
- }
-
- protected void visit(UnaryExpressionOperator op) {
- appendOp(op) ;
- }
-
-
- public void visit(LOGreaterThan op) throws VisitorException {
- appendOp(op) ;
- }
-
- public void visit(LOLesserThan op) throws VisitorException {
- appendOp(op) ;
- }
-
- public void visit(LOGreaterThanEqual op) throws VisitorException {
- appendOp(op) ;
- }
-
- public void visit(LOLesserThanEqual op) throws VisitorException {
- appendOp(op) ;
- }
-
- public void visit(LOEqual op) throws VisitorException {
- appendOp(op) ;
- }
-
- public void visit(LONotEqual op) throws VisitorException {
- appendOp(op) ;
- }
-
- public void visit(LOAdd op) throws VisitorException {
- appendOp(op) ;
- }
-
- public void visit(LOSubtract op) throws VisitorException {
- appendOp(op) ;
- }
-
- public void visit(LOMultiply op) throws VisitorException {
- appendOp(op) ;
- }
-
- public void visit(LODivide op) throws VisitorException {
- appendOp(op) ;
- }
-
- public void visit(LOMod op) throws VisitorException {
- appendOp(op) ;
- }
-
- public void visit(LONative op) throws VisitorException {
- appendOp(op);
- }
-
-
- public void visit(LONegative op) throws VisitorException {
- appendOp(op) ;
- }
-
- public void visit(LOMapLookup op) throws VisitorException {
- appendOp(op) ;
- }
-
- public void visit(LOAnd op) throws VisitorException {
- appendOp(op) ;
- }
-
- public void visit(LOOr op) throws VisitorException {
- appendOp(op) ;
- }
-
- public void visit(LONot op) throws VisitorException {
- appendOp(op) ;
- }
-
- public void visit(LOIsNull op) throws VisitorException {
- appendOp(op) ;
- }
-
- protected void visit(LOCogroup op) throws VisitorException {
- appendOp(op) ;
- List<LogicalOperator> inputs = op.getInputs() ;
- if (inputs != null) {
- for(LogicalOperator input: inputs) {
- List<LogicalPlan> plans
- = new ArrayList<LogicalPlan>(op.getGroupByPlans().get(input)) ;
- if (plans != null) {
- for(LogicalPlan plan: plans) {
- currentTabCount++ ;
- printTabs() ;
- sb.append("<COGroup Inner Plan>\n") ;
- pushWalker(mCurrentWalker.spawnChildWalker(plan)) ;
- visit();
- popWalker();
- currentTabCount-- ;
- }
- }
- }
- }
- }
-
- protected void visit(LOForEach op) throws VisitorException {
- appendOp(op) ;
- List<LogicalPlan> plans = op.getForEachPlans() ;
- if (plans != null) {
- for (LogicalPlan plan: plans) {
- currentTabCount++ ;
- printTabs() ;
- sb.append("<ForEach Inner Plan>\n") ;
- pushWalker(mCurrentWalker.spawnChildWalker(plan)) ;
- visit();
- popWalker();
- currentTabCount-- ;
- }
- }
- }
-
- protected void visit(LOSort op) {
- appendOp(op) ;
- }
-
- protected void visit(LOFilter op) throws VisitorException {
- appendOp(op) ;
- if (op.getComparisonPlan() != null) {
- currentTabCount++ ;
- printTabs() ;
- sb.append("<Filter Inner Plan>\n") ;
- pushWalker(mCurrentWalker.spawnChildWalker(op.getComparisonPlan())) ;
- visit();
- popWalker();
- currentTabCount-- ;
- }
- }
-
- protected void visit(LOSplit op) {
- appendOp(op) ;
- }
-
- /*
- protected void visit(LOForEach op) throws VisitorException {
- appendOp(op) ;
- if (op.getForEachPlan() != null) {
- currentTabCount++ ;
- printTabs() ;
- sb.append("<ForEach Inner Plan>\n") ;
- pushWalker(mCurrentWalker.spawnChildWalker(op.getForEachPlan())) ;
- visit();
- popWalker();
- currentTabCount-- ;
- }
- }
- */
-
- protected void visit(LOUserFunc op) {
- appendOp(op) ;
- }
-
- protected void visit(LOBinCond op) {
- appendOp(op) ;
- }
-
- protected void visit(LOCross op) {
- appendOp(op) ;
- }
-
- protected void visit(LOUnion op) {
- appendOp(op) ;
- }
-
- protected void visit(LOCast op) {
- appendOp(op) ;
- }
-
- protected void visit(LOLoad op) {
- appendOp(op) ;
- }
-
- protected void visit(LOStore op) {
- appendOp(op) ;
- }
-
- protected void visit(LOConst op) {
- appendOp(op) ;
- }
-
- protected void visit(LORegexp op) {
- appendOp(op) ;
- }
-
- protected void visit(LOProject op) {
- appendOp(op) ;
- }
-
- protected void visit(LODistinct op) {
- appendOp(op) ;
- }
-
-
- private void appendOp(LogicalOperator op) {
- printTabs() ;
- sb.append("(") ;
- sb.append(op.getOperatorKey().getId()) ;
- sb.append(":") ;
- sb.append(op.getClass().getSimpleName()) ;
- sb.append("=") ;
- Schema schema = null ;
-
- if (!DataType.isSchemaType(op.getType())) {
- sb.append(DataType.findTypeName(op.getType())) ;
- }
- else {
- try {
- if (op instanceof ExpressionOperator) {
- ExpressionOperator eOp = (ExpressionOperator) op ;
- Schema.FieldSchema fs = eOp.getFieldSchema() ;
- Schema.stringifySchema(sb, fs.schema, DataType.TUPLE) ;
- }
- else {
- schema = op.getSchema() ;
- Schema.stringifySchema(sb, schema, op.getType()) ;
- }
- }
- catch (FrontendException fe) {
- throw new RuntimeException("PROBLEM PRINTING SCHEMA") ;
- }
- }
-
- sb.append("==>") ;
- List<LogicalOperator> list
- = mCurrentWalker.getPlan().getSuccessors(op) ;
-
- if (list!=null) {
- boolean isFirst = true ;
- for(LogicalOperator tmp: list) {
- if (!isFirst) {
- sb.append(",") ;
- }
- else {
- isFirst = false ;
- }
- sb.append(tmp.getOperatorKey().getId()) ;
- }
- }
- else {
- sb.append("TERMINAL") ;
- }
- sb.append(")") ;
- sb.append("\n") ;
- }
-
- /***
- * This method has to be called after the visit is totally finished only
- */
- public String printToString() {
- try {
- visit() ;
- }
- catch(VisitorException vse) {
- throw new AssertionError("Error while transforming type graph to text") ;
- }
- return sb.toString() ;
- }
-}
Modified: pig/branches/branch-0.9/test/org/apache/pig/test/data/GoldenFiles/MRC18.gld
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/test/org/apache/pig/test/data/GoldenFiles/MRC18.gld?rev=1100420&r1=1100419&r2=1100420&view=diff
==============================================================================
--- pig/branches/branch-0.9/test/org/apache/pig/test/data/GoldenFiles/MRC18.gld (original)
+++ pig/branches/branch-0.9/test/org/apache/pig/test/data/GoldenFiles/MRC18.gld Sat May 7 00:15:40 2011
@@ -18,4 +18,4 @@ Reduce Plan Empty
| | |
| | Project[tuple][*] - scope-111
| |
- | |---b: Load(/tmp/input2:org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MergeJoinIndexer('org.apache.pig.builtin.PigStorage','kmonaaafhdhcaabdgkgbhggbcohfhegjgmcoebhchcgbhjemgjhdhehiibncbnjjmhgbjnadaaabejaaaehdgjhkgfhihaaaaaaaabhhaeaaaaaaabhdhcaaeogphcghcogbhagbgdgigfcohagjghcogcgbgdglgfgogecogigbgegpgphacogfhigfgdhfhegjgpgogfgoghgjgogfcohagihjhdgjgdgbgmemgbhjgfhccohagmgbgohdcofagihjhdgjgdgbgmfagmgbgoaaaaaaaaaaaaaaabacaaacfkaaangfgogeepggebgmgmejgohahfheemaaafgphagngbhaheaacdemgphcghcpgbhagbgdgigfcphagjghcpgjgnhagmcphfhegjgmcpenhfgmhegjengbhadlhihcaacfgphcghcogbhagbgdgigfcohagjghcogjgnhagmcohagmgbgocoephagfhcgbhegphcfagmgbgoeaondlnechegpmlgacaaaiemaaakgneghcgpgnefgeghgfhdhbaahoaaademaaafgnelgfhjhdheaaapemgkgbhggbcphfhegjgmcpengbhadlemaaahgnemgfgbhggfhdheaabaemgkgbhggbcphfhegjgmcpemgjhdhedlemaaaegnephahdhbaahoaaafemaaaggnfcgpgphehdhbaahoaaagemaaaognfdgpggheeghcgpgnefgeghgfhdhbaahoaaademaaamgnfdgpgghefegpefgeghgfhdhbaahoaaademaaaignfegpefgeghgfhdhbaahoaaad
hihahdhcaacbgphcghcogbhagbgdgigfcohagjghcogjgnhagmcohfhegjgmcoenhfgmhegjengbhaaaaaaaaaaaaaaaacacaaabemaaaegnengbhahbaahoaaafhihahdhcaabbgkgbhggbcohfhegjgmcoeigbhdgiengbhaafahnkmbmdbgganbadaaacegaaakgmgpgbgeeggbgdhegphcejaaajhegihcgfhdgigpgmgehihadpeaaaaaaaaaaaamhhaiaaaaaabaaaaaaaaahihdhbaahoaaakdpeaaaaaaaaaaaamhhaiaaaaaabaaaaaaaabhdhcaacegphcghcogbhagbgdgigfcohagjghcogjgnhagmcohagmgbgocoephagfhcgbhegphcelgfhjaaaaaaaaaaaaaaabacaaacekaaacgjgeemaaafhdgdgphagfheaabcemgkgbhggbcpgmgbgoghcpfdhehcgjgoghdlhihaaaaaaaaaaaaaaagiheaaafhdgdgphagfhdhcaafjgphcghcogbhagbgdgigfcohagjghcogcgbgdglgfgogecogigbgegpgphacogfhigfgdhfhegjgpgogfgoghgjgogfcohagihjhdgjgdgbgmemgbhjgfhccogfhihahcgfhdhdgjgpgoephagfhcgbhegphchdcofaepfahcgpgkgfgdheaaaaaaaaaaaaaaabacaaagfkaaaogjhdfahcgpgkgfgdhefegpefgogefkaaakgphggfhcgmgpgbgegfgefkaabfhahcgpgdgfhdhdgjgoghecgbghepggfehfhagmgfhdfkaabehcgfhdhfgmhefdgjgoghgmgffehfhagmgfecgbghejaaaihdhegbhcheedgpgmemaaahgdgpgmhfgngohdheaabfemgkgbhggbcphfhegjgmcpebhchcgbhjemgjhdhed
lhihcaagcgphcghcogbhagbgdgigfcohagjghcogcgbgdglgfgogecogigbgegpgphacogfhigfgdhfhegjgpgogfgoghgjgogfcohagihjhdgjgdgbgmemgbhjgfhccogfhihahcgfhdhdgjgpgoephagfhcgbhegphchdcoefhihahcgfhdhdgjgpgoephagfhcgbhegphcaaaaaaaaaaaaaaabacaaaahihcaaemgphcghcogbhagbgdgigfcohagjghcogcgbgdglgfgogecogigbgegpgphacogfhigfgdhfhegjgpgogfgoghgjgogfcohagihjhdgjgdgbgmemgbhjgfhccofagihjhdgjgdgbgmephagfhcgbhegphcaaaaaaaaaaaaaaabacaaalfkaaafgbgdgdhfgnfkaaangjgohahfheebhehegbgdgigfgeejaabehcgfhbhfgfhdhegfgefagbhcgbgmgmgfgmgjhdgnecaaakhcgfhdhfgmhefehjhagfemaaafgbgmgjgbhdhbaahoaaaoemaaafgjgohahfheheaablemgphcghcpgbhagbgdgigfcphagjghcpgegbhegbcpfehfhagmgfdlemaaaggjgohahfhehdhbaahoaaagemaaangmgjgogfgbghgffehcgbgdgfhcheaachemgphcghcpgbhagbgdgigfcphagjghcphagfgocphfhegjgmcpemgjgogfgbghgffehcgbgdgfhcdlemaaahgphfhehahfhehdhbaahoaaagemaaakhagbhcgfgohefagmgbgoheaafaemgphcghcpgbhagbgdgigfcphagjghcpgcgbgdglgfgogecpgigbgegpgphacpgfhigfgdhfhegjgpgogfgoghgjgogfcphagihjhdgjgdgbgmemgbhjgfhccphagmgbgohdcpfagihjhdgjgdgbgmfa
gmgbgodlemaaadhcgfhdheaaeeemgphcghcpgbhagbgdgigfcphagjghcpgcgbgdglgfgogecpgigbgegpgphacpgfhigfgdhfhegjgpgogfgoghgjgogfcphagihjhdgjgdgbgmemgbhjgfhccpfcgfhdhfgmhedlhihcaacbgphcghcogbhagbgdgigfcohagjghcogjgnhagmcohagmgbgocoephagfhcgbhegphcaaaaaaaaaaaaaaabacaaabemaaaegnelgfhjheaacgemgphcghcpgbhagbgdgigfcphagjghcpgjgnhagmcphagmgbgocpephagfhcgbhegphcelgfhjdlhihahbaahoaaapaaaappppppppdchahahahahahahdhcaaecgphcghcogbhagbgdgigfcohagjghcogcgbgdglgfgogecogigbgegpgphacogfhigfgdhfhegjgpgogfgoghgjgogfcohagihjhdgjgdgbgmemgbhjgfhccofcgfhdhfgmheaaaaaaaaaaaaaaabacaaacecaaamhcgfhehfhcgofdhegbhehfhdemaaaghcgfhdhfgmheheaabcemgkgbhggbcpgmgbgoghcpepgcgkgfgdhedlhihaachaaaaaaaaaaaaaaaaahdhbaahoaaaaaaaaaaabhhaeaaaaaaakhdhcaabbgkgbhggbcogmgbgoghcoejgohegfghgfhcbcockakephibihdiacaaabejaaafhggbgmhfgfhihcaabagkgbhggbcogmgbgoghcoeohfgngcgfhcigkmjfbnaljeoailacaaaahihaaaaaaaaahihihdhbaahoaaaaaaaaaaabhhaeaaaaaaakhbaahoaablhihdhbaahoaaakdpeaaaaaaaaaaaamhhaiaaaaaabaaaaaaaabhbaahoaablhbaahoaaaphihdhbaahoaaaaaaa
aaaaahhaeaaaaaaakhihdhbaahoaaaihdhbaahoaaakdpeaaaaaaaaaaaamhhaiaaaaaabaaaaaaaaahihdhbaahoaaaihdhbaahoaaakdpeaaaaaaaaaaaamhhaiaaaaaabaaaaaaaaahihdhbaahoaaaihdhbaahoaaakdpeaaaaaaaaaaaamhhaiaaaaaabaaaaaaaaahiaahahi','','b','scope','true')) - scope-102
\ No newline at end of file
+ | |---b: Load(/tmp/input2:org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MergeJoinIndexer('org.apache.pig.builtin.PigStorage','kmonaaafhdhcaabdgkgbhggbcohfhegjgmcoebhchcgbhjemgjhdhehiibncbnjjmhgbjnadaaabejaaaehdgjhkgfhihaaaaaaaabhhaeaaaaaaabhdhcaaeogphcghcogbhagbgdgigfcohagjghcogcgbgdglgfgogecogigbgegpgphacogfhigfgdhfhegjgpgogfgoghgjgogfcohagihjhdgjgdgbgmemgbhjgfhccohagmgbgohdcofagihjhdgjgdgbgmfagmgbgoaaaaaaaaaaaaaaabacaaacfkaaangfgogeepggebgmgmejgohahfheemaaafgphagngbhaheaacdemgphcghcpgbhagbgdgigfcphagjghcpgjgnhagmcphfhegjgmcpenhfgmhegjengbhadlhihcaacfgphcghcogbhagbgdgigfcohagjghcogjgnhagmcohagmgbgocoephagfhcgbhegphcfagmgbgoimlohdjmoaemmdgiacaaaiemaaakgneghcgpgnefgeghgfhdhbaahoaaademaaafgnelgfhjhdheaaapemgkgbhggbcphfhegjgmcpengbhadlemaaahgnemgfgbhggfhdheaabaemgkgbhggbcphfhegjgmcpemgjhdhedlemaaaegnephahdhbaahoaaafemaaaggnfcgpgphehdhbaahoaaagemaaaognfdgpggheeghcgpgnefgeghgfhdhbaahoaaademaaamgnfdgpgghefegpefgeghgfhdhbaahoaaademaaaignfegpefgeghgfhdhbaahoaaad
hihahdhcaacbgphcghcogbhagbgdgigfcohagjghcogjgnhagmcohfhegjgmcoenhfgmhegjengbhaaaaaaaaaaaaaaaacacaaabemaaaegnengbhahbaahoaaafhihahdhcaabbgkgbhggbcohfhegjgmcoeigbhdgiengbhaafahnkmbmdbgganbadaaacegaaakgmgpgbgeeggbgdhegphcejaaajhegihcgfhdgigpgmgehihadpeaaaaaaaaaaaamhhaiaaaaaabaaaaaaaaahihdhbaahoaaakdpeaaaaaaaaaaaamhhaiaaaaaabaaaaaaaabhdhcaacegphcghcogbhagbgdgigfcohagjghcogjgnhagmcohagmgbgocoephagfhcgbhegphcelgfhjaaaaaaaaaaaaaaabacaaacekaaacgjgeemaaafhdgdgphagfheaabcemgkgbhggbcpgmgbgoghcpfdhehcgjgoghdlhihaaaaaaaaaaaaaaagiheaaafhdgdgphagfhdhcaafjgphcghcogbhagbgdgigfcohagjghcogcgbgdglgfgogecogigbgegpgphacogfhigfgdhfhegjgpgogfgoghgjgogfcohagihjhdgjgdgbgmemgbhjgfhccogfhihahcgfhdhdgjgpgoephagfhcgbhegphchdcofaepfahcgpgkgfgdheaaaaaaaaaaaaaaabacaaagfkaaaogjhdfahcgpgkgfgdhefegpefgogefkaaakgphggfhcgmgpgbgegfgefkaabfhahcgpgdgfhdhdgjgoghecgbghepggfehfhagmgfhdfkaabehcgfhdhfgmhefdgjgoghgmgffehfhagmgfecgbghejaaaihdhegbhcheedgpgmemaaahgdgpgmhfgngohdheaabfemgkgbhggbcphfhegjgmcpebhchcgbhjemgjhdhed
lhihcaagcgphcghcogbhagbgdgigfcohagjghcogcgbgdglgfgogecogigbgegpgphacogfhigfgdhfhegjgpgogfgoghgjgogfcohagihjhdgjgdgbgmemgbhjgfhccogfhihahcgfhdhdgjgpgoephagfhcgbhegphchdcoefhihahcgfhdhdgjgpgoephagfhcgbhegphcaaaaaaaaaaaaaaabacaaaahihcaaemgphcghcogbhagbgdgigfcohagjghcogcgbgdglgfgogecogigbgegpgphacogfhigfgdhfhegjgpgogfgoghgjgogfcohagihjhdgjgdgbgmemgbhjgfhccofagihjhdgjgdgbgmephagfhcgbhegphcaaaaaaaaaaaaaaabacaaalfkaaafgbgdgdhfgnfkaaangjgohahfheebhehegbgdgigfgeejaabehcgfhbhfgfhdhegfgefagbhcgbgmgmgfgmgjhdgnecaaakhcgfhdhfgmhefehjhagfemaaafgbgmgjgbhdhbaahoaaaoemaaafgjgohahfheheaablemgphcghcpgbhagbgdgigfcphagjghcpgegbhegbcpfehfhagmgfdlemaaaggjgohahfhehdhbaahoaaagemaaangmgjgogfgbghgffehcgbgdgfhcheaachemgphcghcpgbhagbgdgigfcphagjghcphagfgocphfhegjgmcpemgjgogfgbghgffehcgbgdgfhcdlemaaahgphfhehahfhehdhbaahoaaagemaaakhagbhcgfgohefagmgbgoheaafaemgphcghcpgbhagbgdgigfcphagjghcpgcgbgdglgfgogecpgigbgegpgphacpgfhigfgdhfhegjgpgogfgoghgjgogfcphagihjhdgjgdgbgmemgbhjgfhccphagmgbgohdcpfagihjhdgjgdgbgmfa
gmgbgodlemaaadhcgfhdheaaeeemgphcghcpgbhagbgdgigfcphagjghcpgcgbgdglgfgogecpgigbgegpgphacpgfhigfgdhfhegjgpgogfgoghgjgogfcphagihjhdgjgdgbgmemgbhjgfhccpfcgfhdhfgmhedlhihcaacbgphcghcogbhagbgdgigfcohagjghcogjgnhagmcohagmgbgocoephagfhcgbhegphcaaaaaaaaaaaaaaabacaaabemaaaegnelgfhjheaacgemgphcghcpgbhagbgdgigfcphagjghcpgjgnhagmcphagmgbgocpephagfhcgbhegphcelgfhjdlhihahbaahoaaapaaaappppppppdchahahahahahahdhcaaecgphcghcogbhagbgdgigfcohagjghcogcgbgdglgfgogecogigbgegpgphacogfhigfgdhfhegjgpgogfgoghgjgogfcohagihjhdgjgdgbgmemgbhjgfhccofcgfhdhfgmheaaaaaaaaaaaaaaabacaaacecaaamhcgfhehfhcgofdhegbhehfhdemaaaghcgfhdhfgmheheaabcemgkgbhggbcpgmgbgoghcpepgcgkgfgdhedlhihaachaaaaaaaaaaaaaaaaahdhbaahoaaaaaaaaaaabhhaeaaaaaaakhdhcaabbgkgbhggbcogmgbgoghcoejgohegfghgfhcbcockakephibihdiacaaabejaaafhggbgmhfgfhihcaabagkgbhggbcogmgbgoghcoeohfgngcgfhcigkmjfbnaljeoailacaaaahihaaaaaaaaahihihdhbaahoaaaaaaaaaaabhhaeaaaaaaakhbaahoaablhihdhbaahoaaakdpeaaaaaaaaaaaamhhaiaaaaaabaaaaaaaabhbaahoaablhbaahoaaaphihdhbaahoaaaaaaa
aaaaahhaeaaaaaaakhihdhbaahoaaaihdhbaahoaaakdpeaaaaaaaaaaaamhhaiaaaaaabaaaaaaaaahihdhbaahoaaaihdhbaahoaaakdpeaaaaaaaaaaaamhhaiaaaaaabaaaaaaaaahihdhbaahoaaaihdhbaahoaaakdpeaaaaaaaaaaaamhhaiaaaaaabaaaaaaaaahiaahahi','','b','scope','true')) - scope-102
\ No newline at end of file
Modified: pig/branches/branch-0.9/test/org/apache/pig/test/utils/dotGraph/DotGraphVisitor.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/test/org/apache/pig/test/utils/dotGraph/DotGraphVisitor.java?rev=1100420&r1=1100419&r2=1100420&view=diff
==============================================================================
--- pig/branches/branch-0.9/test/org/apache/pig/test/utils/dotGraph/DotGraphVisitor.java (original)
+++ pig/branches/branch-0.9/test/org/apache/pig/test/utils/dotGraph/DotGraphVisitor.java Sat May 7 00:15:40 2011
@@ -1,373 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.pig.test.utils.dotGraph;
-
-import org.apache.pig.impl.logicalLayer.*;
-import org.apache.pig.impl.plan.PlanWalker;
-import org.apache.pig.impl.plan.VisitorException;
-import org.apache.pig.impl.util.MultiMap;
-import org.apache.pig.impl.plan.DependencyOrderWalker;
-
-import java.util.Iterator;
-
-/***
- * Not implemented yet
- */
-public class DotGraphVisitor extends LOVisitor {
-
- public DotGraphVisitor(LogicalPlan plan,
- PlanWalker<LogicalOperator, LogicalPlan> walker) {
- super(plan, walker);
- }
-
- /**
- * @param lOp
- * the logical operator that has to be visited
- * @throws org.apache.pig.impl.plan.VisitorException
- */
- protected void visit(LogicalOperator lOp)
- throws VisitorException {
- //
- // Do Nothing
- //
- }
-
- /**
- * @param eOp
- * the logical expression operator that has to be visited
- * @throws VisitorException
- */
- protected void visit(ExpressionOperator eOp)
- throws VisitorException {
- //
- // Do Nothing
- //
- }
-
- /**
- * @param binOp
- * the logical binary expression operator that has to be visited
- * @throws VisitorException
- */
- protected void visit(BinaryExpressionOperator binOp)
- throws VisitorException {
- //
- // Visit the left hand side operand followed by the right hand side
- // operand
- //
-
- binOp.getLhsOperand().visit(this);
- binOp.getRhsOperand().visit(this);
- }
-
- /**
- *
- * @param uniOp
- * the logical unary operator that has to be visited
- * @throws VisitorException
- */
- protected void visit(UnaryExpressionOperator uniOp) throws VisitorException {
- // Visit the operand
-
- uniOp.getOperand().visit(this);
- }
-
- /**
- *
- * @param cg
- * the logical cogroup operator that has to be visited
- * @throws VisitorException
- */
- protected void visit(LOCogroup cg) throws VisitorException {
- // Visit each of the inputs of cogroup.
- MultiMap<LogicalOperator, LogicalPlan> mapGByPlans = cg.getGroupByPlans();
- for(LogicalOperator op: cg.getInputs()) {
- for(LogicalPlan lp: mapGByPlans.get(op)) {
- if (null != lp) {
- // TODO FIX - How do we know this should be a
- // DependencyOrderWalker? We should be replicating the
- // walker the current visitor is using.
- PlanWalker w = new DependencyOrderWalker(lp);
- pushWalker(w);
- for(LogicalOperator logicalOp: lp.getRoots()) {
- logicalOp.visit(this);
- }
- popWalker();
- }
- }
- }
- }
-
- /**
- *
- * @param g
- * the logical generate operator that has to be visited
- * @throws VisitorException
- */
- protected void visit(LOForEach g) throws VisitorException {
- // Visit each of generates projection elements.
- for(LogicalPlan lp: g.getForEachPlans()) {
- PlanWalker w = new DependencyOrderWalker(lp);
- pushWalker(w);
- for(LogicalOperator logicalOp: lp.getRoots()) {
- logicalOp.visit(this);
- }
- popWalker();
- }
- }
-
- /**
- *
- * @param s
- * the logical sort operator that has to be visited
- * @throws VisitorException
- */
- protected void visit(LOSort s) throws VisitorException {
- // Visit the sort function
- for(LogicalPlan lp: s.getSortColPlans()) {
- PlanWalker w = new DependencyOrderWalker(lp);
- pushWalker(w);
- for(LogicalOperator logicalOp: lp.getRoots()) {
- logicalOp.visit(this);
- }
- popWalker();
- }
- }
-
- /**
- *
- * @param filter
- * the logical filter operator that has to be visited
- * @throws VisitorException
- */
- protected void visit(LOFilter filter) throws VisitorException {
- // Visit the condition for the filter followed by the input
- PlanWalker w = new DependencyOrderWalker(filter.getComparisonPlan());
- pushWalker(w);
- for(LogicalOperator logicalOp: filter.getComparisonPlan().getRoots()) {
- logicalOp.visit(this);
- }
- popWalker();
- }
-
- /**
- *
- * @param split
- * the logical split operator that has to be visited
- * @throws VisitorException
- */
- protected void visit(LOSplit split) throws VisitorException {
- // Visit each of split's conditions
- for(LogicalOperator logicalOp: split.getOutputs()) {
- logicalOp.visit(this);
- }
- }
-
- /**
- *
- * @param forEach
- * the logical foreach operator that has to be visited
- * @throws VisitorException
- */
- /*
- protected void visit(LOForEach forEach) throws VisitorException {
- // Visit the operators that are part of the foreach plan
- LogicalPlan plan = forEach.getForEachPlan();
- PlanWalker w = new DependencyOrderWalker(plan);
- pushWalker(w);
- for(LogicalOperator logicalOp: plan.getRoots()) {
- logicalOp.visit(this);
- }
- popWalker();
- }
- */
-
- /**
- * Iterate over each expression that is part of the function argument list
- *
- * @param func
- * the user defined function
- * @throws VisitorException
- */
- protected void visit(LOUserFunc func) throws VisitorException {
- // Visit each of the arguments
- Iterator<ExpressionOperator> i = func.getArguments().iterator();
- while (i.hasNext()) {
- i.next().visit(this);
- }
- }
-
- /**
- * @param binCond
- * the logical binCond operator that has to be visited
- * @throws VisitorException
- */
- protected void visit(LOBinCond binCond) throws VisitorException {
- /*
- * Visit the conditional expression followed by the left hand operator
- * and the right hand operator respectively
- */
-
- binCond.getCond().visit(this);
- binCond.getLhsOp().visit(this);
- binCond.getRhsOp().visit(this);
- }
-
- protected void visit(LOCast cast) throws VisitorException {
- // Visit the expression to be cast
-
- cast.getExpression().visit(this);
- }
-
- protected void visit(LORegexp regexp) throws VisitorException {
- // Visit the operand of the regexp
- regexp.getOperand().visit(this);
- }
-
- protected void visit(LOLoad load) throws VisitorException{
-
-
- }
-
- protected void visit(LONative nat) throws VisitorException{
-
-
- }
-
- protected void visit(LOStore store) throws VisitorException{
-
- }
-
- protected void visit(LOConst store) throws VisitorException{
-
- }
-
- protected void visit(LOUnion u) throws VisitorException {
-
- }
-
- protected void visit(LOSplitOutput sop) throws VisitorException {
- LogicalPlan lp = sop.getConditionPlan();
- if (null != lp) {
- PlanWalker w = new DependencyOrderWalker(lp);
- pushWalker(w);
- for(LogicalOperator logicalOp: lp.getRoots()) {
- logicalOp.visit(this);
- }
- popWalker();
- }
- }
-
- protected void visit(LODistinct dt) throws VisitorException {
-
- }
-
- protected void visit(LOCross cs) throws VisitorException {
-
- }
-
- protected void visit(LOProject project) throws VisitorException {
- // Visit the operand of the project as long as the sentinel is false
-
- if(!project.getSentinel()) {
- project.getExpression().visit(this);
- }
- }
-
- public void visit(LOGreaterThan op) throws VisitorException {
- // TODO Auto-generated method stub
- return;
- }
-
- public void visit(LOLesserThan op) throws VisitorException {
- // TODO Auto-generated method stub
- return;
- }
-
- public void visit(LOGreaterThanEqual op) throws VisitorException {
- // TODO Auto-generated method stub
- return;
- }
-
- public void visit(LOLesserThanEqual op) throws VisitorException {
- // TODO Auto-generated method stub
- return;
- }
-
- public void visit(LOEqual op) throws VisitorException {
- // TODO Auto-generated method stub
- return;
- }
-
- public void visit(LONotEqual op) throws VisitorException {
- // TODO Auto-generated method stub
- return;
- }
-
- public void visit(LOAdd op) throws VisitorException {
- // TODO Auto-generated method stub
- return;
- }
-
- public void visit(LOSubtract op) throws VisitorException {
- // TODO Auto-generated method stub
- return;
- }
-
- public void visit(LOMultiply op) throws VisitorException {
- // TODO Auto-generated method stub
- return;
- }
-
- public void visit(LODivide op) throws VisitorException {
- // TODO Auto-generated method stub
- return;
- }
-
- public void visit(LOMod op) throws VisitorException {
- // TODO Auto-generated method stub
- return;
- }
-
-
- public void visit(LONegative op) throws VisitorException {
- // TODO Auto-generated method stub
- return;
- }
-
- public void visit(LOMapLookup op) throws VisitorException {
- // TODO Auto-generated method stub
- return;
- }
-
- public void visit(LOAnd binOp) throws VisitorException {
- // TODO Auto-generated method stub
- return;
- }
-
- public void visit(LOOr binOp) throws VisitorException {
- // TODO Auto-generated method stub
- return;
- }
-
- public void visit(LONot uniOp) throws VisitorException {
- // TODO Auto-generated method stub
- return;
- }
-}