Author: gates
Date: Fri Jul 18 14:07:09 2008
New Revision: 678038

URL: http://svn.apache.org/viewvc?rev=678038&view=rev
Log:
PIG-323 Checking in Santhosh's patch to back out define changes.


Modified:
    incubator/pig/branches/types/src/org/apache/pig/PigServer.java
    
incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LogicalPlanBuilder.java
    
incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt
    
incubator/pig/branches/types/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj
    incubator/pig/branches/types/test/org/apache/pig/test/TestBuiltin.java
    incubator/pig/branches/types/test/org/apache/pig/test/TestGrunt.java
    
incubator/pig/branches/types/test/org/apache/pig/test/TestLogToPhyCompiler.java
    
incubator/pig/branches/types/test/org/apache/pig/test/TestLogicalPlanBuilder.java
    incubator/pig/branches/types/test/org/apache/pig/test/TestMapReduce.java
    
incubator/pig/branches/types/test/org/apache/pig/test/TestPigScriptParser.java
    
incubator/pig/branches/types/test/org/apache/pig/test/utils/LogicalPlanTester.java

Modified: incubator/pig/branches/types/src/org/apache/pig/PigServer.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/PigServer.java?rev=678038&r1=678037&r2=678038&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/PigServer.java (original)
+++ incubator/pig/branches/types/src/org/apache/pig/PigServer.java Fri Jul 18 
14:07:09 2008
@@ -91,7 +91,6 @@
     Map<LogicalOperator, LogicalPlan> aliases = new HashMap<LogicalOperator, 
LogicalPlan>();
     Map<OperatorKey, LogicalOperator> opTable = new HashMap<OperatorKey, 
LogicalOperator>();
     Map<String, LogicalOperator> aliasOp = new HashMap<String, 
LogicalOperator>();
-    Map<String, ExpressionOperator> defineAliases = new HashMap<String, 
ExpressionOperator>();
     PigContext pigContext;
     
     private String scope = constructScope();
@@ -239,7 +238,7 @@
         LogicalPlan lp = null;
         try {
             lp = (new LogicalPlanBuilder(pigContext).parse(scope, query,
-                    aliases, opTable, aliasOp, defineAliases));
+                    aliases, opTable, aliasOp));
         } catch (ParseException e) {
             throw (IOException) new IOException(e.getMessage()).initCause(e);
         }

Modified: 
incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LogicalPlanBuilder.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LogicalPlanBuilder.java?rev=678038&r1=678037&r2=678038&view=diff
==============================================================================
--- 
incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LogicalPlanBuilder.java
 (original)
+++ 
incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/LogicalPlanBuilder.java
 Fri Jul 18 14:07:09 2008
@@ -43,12 +43,11 @@
                              String query, 
                              Map<LogicalOperator, LogicalPlan> aliases,
                              Map<OperatorKey, LogicalOperator> opTable,
-                             Map<String, LogicalOperator> aliasOp,
-                             Map<String, ExpressionOperator> defineAliases)
+                             Map<String, LogicalOperator> aliasOp)
         throws IOException, ParseException {
         ByteArrayInputStream in = new ByteArrayInputStream(query.getBytes());  
      
         //QueryParser parser = new QueryParser(in, pigContext, scope, aliases, 
opTable);
-        QueryParser parser = new QueryParser(in, pigContext, scope, aliases, 
opTable, aliasOp, defineAliases);
+        QueryParser parser = new QueryParser(in, pigContext, scope, aliases, 
opTable, aliasOp);
         return parser.Parse();        
     }
 

Modified: 
incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt?rev=678038&r1=678037&r2=678038&view=diff
==============================================================================
--- 
incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt
 (original)
+++ 
incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt
 Fri Jul 18 14:07:09 2008
@@ -63,7 +63,6 @@
        private NodeIdGenerator nodeIdGen;
        //a map of alias to logical operator for a quick lookup
        private Map<String, LogicalOperator> mapAliasOp;
-       private Map<String, ExpressionOperator> defineAliases;
        private static Log log = LogFactory.getLog(QueryParser.class);
        
        private long getNextId() {
@@ -75,8 +74,7 @@
                                           String scope, 
                                           Map<LogicalOperator, LogicalPlan> 
aliases,
                                           Map<OperatorKey, LogicalOperator> 
opTable,
-                                          Map<String, LogicalOperator> aliasOp,
-                                          Map<String, ExpressionOperator> 
defineAliases) {
+                                          Map<String, LogicalOperator> 
aliasOp) {
                this(in);
                this.pigContext = pigContext;
                this.aliases = aliases;
@@ -84,7 +82,6 @@
                this.scope = scope;
                this.nodeIdGen = NodeIdGenerator.getGenerator();
                this.mapAliasOp = aliasOp;
-               this.defineAliases = defineAliases;
        }
 
        public class CogroupInput {
@@ -306,9 +303,6 @@
                return mapAliasOp.get(alias);
         }
 
-        ExpressionOperator getDefineOp(String alias) {
-               return defineAliases.get(alias);
-        }
         
         //BEGIN
         //I am maintaining state about the operators that should
@@ -529,7 +523,6 @@
 TOKEN : { <BAG : "bag"> }
 TOKEN : { <TUPLE : "tuple"> }
 TOKEN : { <MAP : "map"> }
-TOKEN : { <DEFINE : "define"> }
 TOKEN : { <IS : "is"> }
 TOKEN : { <NULL : "null"> }
 
@@ -583,7 +576,6 @@
        (t1 = <IDENTIFIER> "=" root = Expr(lp) ";" {root.setAlias(t1.image); 
addAlias(t1.image, root);})
 |      (root = Expr(lp) ";")
 |      (<SPLIT> root = SplitClause(lp) ";")
-|      (<DEFINE> DefineClause(lp) ";")
        )
        { 
                if(null != root) {
@@ -654,20 +646,6 @@
        {log.trace("Exiting SplitClause"); return splitOp;}
 } 
 
-void DefineClause(LogicalPlan lp) :
-{
-       Token t;
-       ExpressionOperator exOp;
-       log.trace("Entering DefineClause");
-}
-{
-       (t = <IDENTIFIER> "=" exOp = FuncDeclareSpec(lp))
-       {
-               defineAliases.put(t.image, exOp);
-               log.trace("Exiting DefineClause");
-       }
-}
-
 
 LogicalOperator Expr(LogicalPlan lp) : 
 {
@@ -2068,8 +2046,7 @@
 }
 {
        (
-    LOOKAHEAD({ null != getDefineOp(getToken(1).image) }) 
funcName=QualifiedFunction()
-|   (
+    (
     LOOKAHEAD({ null != pigContext.getFuncSpecFromAlias(getToken(1).image) }) 
funcNameAlias=QualifiedFunction()
     {
         
@@ -2087,12 +2064,6 @@
     )
     "(" args=EvalArgs(over,specs,lp,input) ")" 
        {
-               //check if the function name is an alias
-               //if the user has defined an alias then 
-               //verify if the number of of arguments match
-               //and create a new LOUserFunc with the information
-               //from the lookup table
-
                if(null != evalFunc) {
             funcName = evalFunc.getClass().getName();
             if(null != funcNameAlias) {
@@ -2105,23 +2076,9 @@
             log.debug("Return type of UDF: " + DataType.findTypeName(type));
             log.debug("FuncEvalSpec: funcSpec: " + funcSpec);
                        userFunc = new LOUserFunc(lp, new OperatorKey(scope, 
getNextId()), funcSpec, args, type);
-               } else {
-                       //we have an alias
-                   userAliasFunc = (LOUserFunc)getDefineOp(funcName);
-            if(null != userAliasFunc) {
-                int expectedNumArgs = userAliasFunc.getArguments().size();
-                int numArgs = args.size();
-                if(expectedNumArgs != numArgs) {
-                    throw new ParseException("Expected " + expectedNumArgs + " 
argument(s) found " + numArgs + " argument(s)");
-                }
-                funcSpec = userAliasFunc.getFuncSpec();
-                log.debug("FuncEvalSpec: funcSpec: " + funcSpec);
-                userFunc = new LOUserFunc(lp, new OperatorKey(scope, 
getNextId()), funcSpec, args, userAliasFunc.getType());
-            } else {
-                throw new ParseException("Could not locate function 
declaration for " + funcName);
-            }
-
-               }
+        } else {
+            throw new ParseException("Could not instantiate function: " + 
funcNameAlias);
+        }
                lp.add(userFunc);
                log.debug("FuncEvalSpec: Added operator " + 
userFunc.getClass().getName() + " " + userFunc + " to logical plan " + lp);
                for(ExpressionOperator exprOp: args) {
@@ -2176,72 +2133,6 @@
        {log.trace("Exiting EvalArgsItem");return item;}
 }
 
-ExpressionOperator FuncDeclareSpec(LogicalPlan lp) : 
-{
-       FuncSpec funcSpec; 
-       List<ExpressionOperator> args;
-       byte userSpecifiedType = DataType.BYTEARRAY;
-    boolean userSpecified = false;
-    EvalFunc evalFunc = null;
-       log.trace("Entering FuncDeclareSpec");
-}
-{
-       [userSpecifiedType = Type() {userSpecified = true;}] 
evalFunc=EvalFunction() "(" args=FuncDeclareArgs(lp) ")" 
-       {
-        funcSpec = new FuncSpec(evalFunc.getClass().getName());
-        Type javaType = evalFunc.getReturnType();
-        byte type = DataType.findType(javaType);
-        log.debug("Return type of UDF: " + DataType.findTypeName(type));
-        if(userSpecified && (userSpecifiedType != type)) {
-            throw new ParseException("User specified return type " + 
DataType.findTypeName(userSpecifiedType) + " and deduced return type " + 
DataType.findTypeName(type) + " are not the same");
-        }
-               ExpressionOperator userFunc = new LOUserFunc(lp, new 
OperatorKey(scope, getNextId()), funcSpec, args, type);
-               log.trace("Exiting FuncDeclareSpec");
-               return userFunc;
-       }
-}
-
-List<ExpressionOperator> FuncDeclareArgs(LogicalPlan lp) : 
-{
-       ArrayList<ExpressionOperator> specList = new 
ArrayList<ExpressionOperator>(); 
-       ExpressionOperator item;
-       log.trace("Entering FuncDeclareEvalArgs");
-}
-{
-       (
-       (item=FuncDeclareArgsItem(lp)   {specList.add(item);}
-       ("," item=FuncDeclareArgsItem(lp) {specList.add(item);})*)
-       
-       | {}
-       )
-       {
-               log.trace("Exiting EvalArgs");
-               return specList;
-       }
-}
-
-ExpressionOperator FuncDeclareArgsItem(LogicalPlan lp):
-{
-       ExpressionOperator item;
-       byte type = DataType.BYTEARRAY;
-       Token t = null;
-       log.trace("Entering FuncDeclareArgsItem");
-}
-{
-       (
-       type = Type() [t = <IDENTIFIER>]
-       {
-               LOProject project = new LOProject(lp, new OperatorKey(scope, 
getNextId()), null, -1); 
-               project.setType(type);
-               if(null != t) {
-                       project.setAlias(t.image); 
-               }
-               item = project;
-       }
-       )
-       {log.trace("Exiting FuncDeclareArgsItem");return item;}
-}
-
 byte Type() : 
 { 
        log.trace("Entering Type");

Modified: 
incubator/pig/branches/types/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj?rev=678038&r1=678037&r2=678038&view=diff
==============================================================================
--- 
incubator/pig/branches/types/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj
 (original)
+++ 
incubator/pig/branches/types/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj
 Fri Jul 18 14:07:09 2008
@@ -112,6 +112,7 @@
 TOKEN: {<COPY: "cp">}
 TOKEN: {<COPYFROMLOCAL: "copyFromLocal">}
 TOKEN: {<COPYTOLOCAL: "copyToLocal">}
+TOKEN: {<DEFINE: "define">}
 TOKEN: {<DUMP: "dump">}
 TOKEN: {<DESCRIBE: "describe">}
 TOKEN: {<EXPLAIN: "explain">}
@@ -301,6 +302,13 @@
        t2 = GetPath()
        {processCopyToLocal(t1.image, t2.image);}       
        |
+       <DEFINE>
+       t1 = <IDENTIFIER>
+       (
+       val = QualifiedFunction()
+       )
+       {processRegisterFunc(t1.image, val);}
+       |
        <DUMP>
        t1 = <IDENTIFIER>
        {processDump(t1.image);}
@@ -453,6 +461,8 @@
        |
        t = <COPYTOLOCAL>
        |
+       t = <DEFINE>
+       |
        t = <DUMP>
        |
        t = <DESCRIBE>

Modified: incubator/pig/branches/types/test/org/apache/pig/test/TestBuiltin.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/test/org/apache/pig/test/TestBuiltin.java?rev=678038&r1=678037&r2=678038&view=diff
==============================================================================
--- incubator/pig/branches/types/test/org/apache/pig/test/TestBuiltin.java 
(original)
+++ incubator/pig/branches/types/test/org/apache/pig/test/TestBuiltin.java Fri 
Jul 18 14:07:09 2008
@@ -28,6 +28,7 @@
 import org.junit.Test;
 
 import org.apache.pig.FilterFunc;
+import org.apache.pig.FuncSpec;
 import org.apache.pig.LoadFunc;
 import org.apache.pig.PigServer;
 import org.apache.pig.ExecType;
@@ -884,7 +885,7 @@
         writer.println("boo");
         writer.close();
         
-        pig.registerFunction("myTr",ShellBagEvalFunc.class.getName() + "('tr o 
0')");
+        pig.registerFunction("myTr", new 
FuncSpec(ShellBagEvalFunc.class.getName() + "('tr o 0')"));
         pig.registerQuery("a = load 'file:" + tempFile + "';");
         pig.registerQuery("b = foreach a generate myTr(*);");
         Iterator<Tuple> iter = pig.openIterator("b");
@@ -914,8 +915,10 @@
         }
         writer.close();
         
-        pig.registerFunction("tr1",ShellBagEvalFunc.class.getName() + "('tr o 
A')");
-        pig.registerFunction("tr2",ShellBagEvalFunc.class.getName() + "('tr o 
B')");
+        pig.registerFunction("tr1",
+            new FuncSpec(ShellBagEvalFunc.class.getName() + "('tr o A')"));
+        pig.registerFunction("tr2",
+            new FuncSpec(ShellBagEvalFunc.class.getName() + "('tr o B')"));
         pig.registerQuery("a = load 'file:" + tempFile + "';");
         pig.registerQuery("b = foreach a generate tr1(*),tr2(*);");
         Iterator<Tuple> iter = pig.openIterator("b");

Modified: incubator/pig/branches/types/test/org/apache/pig/test/TestGrunt.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/test/org/apache/pig/test/TestGrunt.java?rev=678038&r1=678037&r2=678038&view=diff
==============================================================================
--- incubator/pig/branches/types/test/org/apache/pig/test/TestGrunt.java 
(original)
+++ incubator/pig/branches/types/test/org/apache/pig/test/TestGrunt.java Fri 
Jul 18 14:07:09 2008
@@ -52,11 +52,11 @@
     }
 
     @Test 
-    public void testDefineFail() throws Throwable {
+    public void testDefine() throws Throwable {
         PigServer server = new PigServer("MAPREDUCE");
         PigContext context = server.getPigContext();
         
-        String strCmd = "define myudf org.apache.pig.myudf();";
+        String strCmd = "define myudf org.apache.pig.builtin.AVG();";
         
         ByteArrayInputStream cmd = new ByteArrayInputStream(strCmd.getBytes());
         InputStreamReader reader = new InputStreamReader(cmd);
@@ -68,5 +68,6 @@
         } catch (Exception e) {
             assertTrue(e.getMessage().contains("Encountered \"define\""));
         }
+        assertTrue(null != context.getFuncSpecFromAlias("myudf"));
     }
 }

Modified: 
incubator/pig/branches/types/test/org/apache/pig/test/TestLogToPhyCompiler.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/test/org/apache/pig/test/TestLogToPhyCompiler.java?rev=678038&r1=678037&r2=678038&view=diff
==============================================================================
--- 
incubator/pig/branches/types/test/org/apache/pig/test/TestLogToPhyCompiler.java 
(original)
+++ 
incubator/pig/branches/types/test/org/apache/pig/test/TestLogToPhyCompiler.java 
Fri Jul 18 14:07:09 2008
@@ -524,8 +524,7 @@
                                            query,
                                            aliases,
                                            logicalOpTable,
-                                           aliasOp,
-                                           defineAliases);
+                                           aliasOp);
             List<LogicalOperator> roots = lp.getRoots();
             
             
@@ -575,5 +574,4 @@
     Map<LogicalOperator, LogicalPlan> aliases = new HashMap<LogicalOperator, 
LogicalPlan>();
     Map<OperatorKey, LogicalOperator> logicalOpTable = new 
HashMap<OperatorKey, LogicalOperator>();
     Map<String, LogicalOperator> aliasOp = new HashMap<String, 
LogicalOperator>();
-    Map<String, ExpressionOperator> defineAliases = new HashMap<String, 
ExpressionOperator>();
 }

Modified: 
incubator/pig/branches/types/test/org/apache/pig/test/TestLogicalPlanBuilder.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/test/org/apache/pig/test/TestLogicalPlanBuilder.java?rev=678038&r1=678037&r2=678038&view=diff
==============================================================================
--- 
incubator/pig/branches/types/test/org/apache/pig/test/TestLogicalPlanBuilder.java
 (original)
+++ 
incubator/pig/branches/types/test/org/apache/pig/test/TestLogicalPlanBuilder.java
 Fri Jul 18 14:07:09 2008
@@ -33,8 +33,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.pig.LoadFunc;
-//TODO
-//Not able to include PigServer.java
+import org.apache.pig.FuncSpec;
 import org.apache.pig.PigServer;
 import org.apache.pig.builtin.PigStorage;
 import org.apache.pig.data.DataBag;
@@ -552,7 +551,8 @@
         } catch (IOException e) {
             assertTrue(false);  // pig server failed for some reason
         }
-        pig.registerFunction("myTr",GFAny.class.getName() + "('tr o 0')");
+        pig.registerFunction("myTr",
+            new FuncSpec(GFAny.class.getName() + "('tr o 0')"));
         try{
             pig.registerQuery("b = foreach (load 'a') generate 
myTr(myTr(*));");
         }catch(Exception e){
@@ -778,24 +778,6 @@
        }
 
     @Test
-    public void testQuery66() {
-        buildPlan("define myFunc = " + TestApplyFunc.class.getName() + "(int 
i, chararray c);");
-        buildPlan("a = load 'input1' as (name, age, gpa);");
-        buildPlan("b = foreach a generate myFunc($0, $1);");
-       }
-
-    @Test
-    public void testQueryFail66() {
-        buildPlan("define myFunc = " + TestApplyFunc.class.getName() + "(int 
i, chararray c);");
-        buildPlan("a = load 'input1' as (name, age, gpa);");
-        try {
-               buildPlan("b = foreach a generate myFunc($0, $1, $2);");
-        } catch (AssertionFailedError e) {
-            assertTrue(e.getMessage().contains("Exception"));
-        }
-       }
-
-    @Test
     public void testQuery67() {
         buildPlan(" a = load 'input1' as (name, age, gpa);");
         buildPlan(" b = foreach a generate age, age * 10L, gpa/0.2f, {(16, 
4.0e-2, 'hello')};");
@@ -1029,8 +1011,7 @@
                                            query,
                                            aliases,
                                            logicalOpTable,
-                                           aliasOp,
-                                           defineAliases);
+                                           aliasOp);
             List<LogicalOperator> roots = lp.getRoots();
             
             if(roots.size() > 0) {
@@ -1080,5 +1061,4 @@
     Map<LogicalOperator, LogicalPlan> aliases = new HashMap<LogicalOperator, 
LogicalPlan>();
     Map<OperatorKey, LogicalOperator> logicalOpTable = new 
HashMap<OperatorKey, LogicalOperator>();
     Map<String, LogicalOperator> aliasOp = new HashMap<String, 
LogicalOperator>();
-    Map<String, ExpressionOperator> defineAliases = new HashMap<String, 
ExpressionOperator>();
 }

Modified: 
incubator/pig/branches/types/test/org/apache/pig/test/TestMapReduce.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/test/org/apache/pig/test/TestMapReduce.java?rev=678038&r1=678037&r2=678038&view=diff
==============================================================================
--- incubator/pig/branches/types/test/org/apache/pig/test/TestMapReduce.java 
(original)
+++ incubator/pig/branches/types/test/org/apache/pig/test/TestMapReduce.java 
Fri Jul 18 14:07:09 2008
@@ -35,6 +35,7 @@
 import org.junit.Test;
 
 import org.apache.pig.EvalFunc;
+import org.apache.pig.FuncSpec;
 import org.apache.pig.LoadFunc;
 import org.apache.pig.PigServer;
 import org.apache.pig.StoreFunc;
@@ -251,7 +252,8 @@
             ps.println(i);
         }
         ps.close();
-        pig.registerFunction("foo", MyApply.class.getName()+"('foo')");
+        pig.registerFunction("foo",
+            new FuncSpec(MyApply.class.getName()+"('foo')"));
         String query = "foreach (group (load 'file:"+tmpFile+"' using " + 
MyStorage.class.getName() + "()) by " + MyGroup.class.getName() + "('all')) 
generate flatten(foo($1)) ;";
         System.out.println(query);
         pig.registerQuery("asdf_id = " + query);

Modified: 
incubator/pig/branches/types/test/org/apache/pig/test/TestPigScriptParser.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/test/org/apache/pig/test/TestPigScriptParser.java?rev=678038&r1=678037&r2=678038&view=diff
==============================================================================
--- 
incubator/pig/branches/types/test/org/apache/pig/test/TestPigScriptParser.java 
(original)
+++ 
incubator/pig/branches/types/test/org/apache/pig/test/TestPigScriptParser.java 
Fri Jul 18 14:07:09 2008
@@ -28,7 +28,6 @@
         Map<LogicalOperator, LogicalPlan> aliases = new 
HashMap<LogicalOperator, LogicalPlan>();
         Map<OperatorKey, LogicalOperator> opTable = new HashMap<OperatorKey, 
LogicalOperator>() ;
         Map<String, LogicalOperator> aliasOp = new HashMap<String, 
LogicalOperator>() ;
-        Map<String, ExpressionOperator> defineAliases = new HashMap<String, 
ExpressionOperator>();
         PigContext pigContext = new PigContext(ExecType.LOCAL) ;
         
         String tempFile = this.prepareTempFile() ;
@@ -38,35 +37,35 @@
                // Initial statement
                String query = String.format("A = LOAD '%s' ;", tempFile) ;
                ByteArrayInputStream in = new 
ByteArrayInputStream(query.getBytes()); 
-               QueryParser parser = new QueryParser(in, pigContext, "scope", 
aliases, opTable, aliasOp, defineAliases) ;
+               QueryParser parser = new QueryParser(in, pigContext, "scope", 
aliases, opTable, aliasOp) ;
                LogicalPlan lp = parser.Parse() ; 
         }
         
         {
                // Normal condition
                String query = "B1 = filter A by $0 eq 'This is a test string' 
;" ;
-               checkParsedConstContent(aliases, opTable, pigContext, aliasOp, 
defineAliases,
+               checkParsedConstContent(aliases, opTable, pigContext, aliasOp, 
                                        query, "This is a test string") ;       
         }
         
         {
                // single-quote condition
                String query = "B2 = filter A by $0 eq 'This is a test 
\\'string' ;" ;
-               checkParsedConstContent(aliases, opTable, pigContext, aliasOp, 
defineAliases,
+               checkParsedConstContent(aliases, opTable, pigContext, aliasOp, 
                                        query, "This is a test 'string") ;      
         }
         
         {
                // newline condition
                String query = "B3 = filter A by $0 eq 'This is a test 
\\nstring' ;" ;
-               checkParsedConstContent(aliases, opTable, pigContext, aliasOp, 
defineAliases,
+               checkParsedConstContent(aliases, opTable, pigContext, aliasOp, 
                                        query, "This is a test \nstring") ;     
         }
         
         {
                // Unicode
                String query = "B4 = filter A by $0 eq 'This is a test 
\\uD30C\\uC774string' ;" ;
-               checkParsedConstContent(aliases, opTable, pigContext, aliasOp, 
defineAliases,
+               checkParsedConstContent(aliases, opTable, pigContext, aliasOp, 
                                        query, "This is a test 
\uD30C\uC774string") ;   
         }
     }
@@ -75,13 +74,12 @@
                                          Map<OperatorKey, LogicalOperator> 
opTable,
                                          PigContext pigContext,
                                          Map<String, LogicalOperator> aliasOp,
-                                         Map<String, ExpressionOperator> 
defineAliases,
                                          String query,
                                          String expectedContent)
                                         throws Exception {
         // Run the parser
         ByteArrayInputStream in = new ByteArrayInputStream(query.getBytes()); 
-        QueryParser parser = new QueryParser(in, pigContext, "scope", aliases, 
opTable, aliasOp, defineAliases) ;
+        QueryParser parser = new QueryParser(in, pigContext, "scope", aliases, 
opTable, aliasOp) ;
         LogicalPlan lp = parser.Parse() ; 
         
         // Digging down the tree

Modified: 
incubator/pig/branches/types/test/org/apache/pig/test/utils/LogicalPlanTester.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/test/org/apache/pig/test/utils/LogicalPlanTester.java?rev=678038&r1=678037&r2=678038&view=diff
==============================================================================
--- 
incubator/pig/branches/types/test/org/apache/pig/test/utils/LogicalPlanTester.java
 (original)
+++ 
incubator/pig/branches/types/test/org/apache/pig/test/utils/LogicalPlanTester.java
 Fri Jul 18 14:07:09 2008
@@ -52,7 +52,6 @@
     private Map<LogicalOperator, LogicalPlan> aliases  = null ;
     private Map<OperatorKey, LogicalOperator> logicalOpTable = null ;
     private Map<String, LogicalOperator> aliasOp = null ;
-    private Map<String, ExpressionOperator> defineAliases = null;
 
     public LogicalPlanTester() {
         reset() ;
@@ -65,7 +64,6 @@
         aliases = new HashMap<LogicalOperator, LogicalPlan>();
         logicalOpTable = new HashMap<OperatorKey, LogicalOperator>();
         aliasOp = new HashMap<String, LogicalOperator>();
-        defineAliases = new HashMap<String, ExpressionOperator>();
         NodeIdGenerator.reset(SCOPE);
     }
 
@@ -191,8 +189,7 @@
                                            query,
                                            aliases,
                                            logicalOpTable,
-                                           aliasOp,
-                                           defineAliases);
+                                           aliasOp);
 
             List<LogicalOperator> roots = lp.getRoots();
 


Reply via email to