You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by pi...@apache.org on 2008/07/22 14:04:35 UTC

svn commit: r678726 - in /incubator/pig/branches/types: src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt test/org/apache/pig/test/TestTypeChecking.java test/org/apache/pig/test/TypeGraphPrinter.java

Author: pisong
Date: Tue Jul 22 05:04:34 2008
New Revision: 678726

URL: http://svn.apache.org/viewvc?rev=678726&view=rev
Log:
PIG-321 Long literal problem in parser

Modified:
    incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt
    incubator/pig/branches/types/test/org/apache/pig/test/TestTypeChecking.java
    incubator/pig/branches/types/test/org/apache/pig/test/TypeGraphPrinter.java

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=678726&r1=678725&r2=678726&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 Tue Jul 22 05:04:34 2008
@@ -2598,7 +2598,7 @@
 	t = <INTEGER> {obj = new Integer(Integer.parseInt(t.image));}
 |	t = <LONGINTEGER> 
     {
-        String num = t.image.substring(0, t.image.length() - 2);
+        String num = t.image.substring(0, t.image.length() - 1);
         obj = new Long(Long.parseLong(num));
     }
 |	t = <FLOATNUMBER> {obj = new Float(Float.parseFloat(t.image));}

Modified: incubator/pig/branches/types/test/org/apache/pig/test/TestTypeChecking.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/test/org/apache/pig/test/TestTypeChecking.java?rev=678726&r1=678725&r2=678726&view=diff
==============================================================================
--- incubator/pig/branches/types/test/org/apache/pig/test/TestTypeChecking.java (original)
+++ incubator/pig/branches/types/test/org/apache/pig/test/TestTypeChecking.java Tue Jul 22 05:04:34 2008
@@ -258,5 +258,13 @@
     }
 
 
+    public void testGenerate1() throws Throwable {
+        TypeCheckingTestUtil.printCurrentMethodName() ;
+        planTester.buildPlan("a = load '/user/pig/tests/data/singlefile/studenttab10k' as (name:chararray, age:int, gpa:double);") ;
+        LogicalPlan plan1 = planTester.buildPlan("b = foreach a generate 1 + 0.2f + 253645L, gpa+1; ") ;
+        planTester.typeCheckPlan(plan1);
+    }
+
+
 
 }

Modified: incubator/pig/branches/types/test/org/apache/pig/test/TypeGraphPrinter.java
URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/test/org/apache/pig/test/TypeGraphPrinter.java?rev=678726&r1=678725&r2=678726&view=diff
==============================================================================
--- incubator/pig/branches/types/test/org/apache/pig/test/TypeGraphPrinter.java (original)
+++ incubator/pig/branches/types/test/org/apache/pig/test/TypeGraphPrinter.java Tue Jul 22 05:04:34 2008
@@ -62,6 +62,76 @@
     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(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) ;