You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by da...@apache.org on 2012/06/08 20:41:48 UTC
svn commit: r1348185 - in /pig/trunk: ./ src/org/apache/pig/parser/
test/e2e/pig/tests/
Author: daijy
Date: Fri Jun 8 18:41:47 2012
New Revision: 1348185
URL: http://svn.apache.org/viewvc?rev=1348185&view=rev
Log:
PIG-2593: Filter by a boolean value does not work
Modified:
pig/trunk/CHANGES.txt
pig/trunk/src/org/apache/pig/parser/AliasMasker.g
pig/trunk/src/org/apache/pig/parser/AstPrinter.g
pig/trunk/src/org/apache/pig/parser/AstValidator.g
pig/trunk/src/org/apache/pig/parser/LogicalPlanGenerator.g
pig/trunk/src/org/apache/pig/parser/QueryParser.g
pig/trunk/test/e2e/pig/tests/nightly.conf
Modified: pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1348185&r1=1348184&r2=1348185&view=diff
==============================================================================
--- pig/trunk/CHANGES.txt (original)
+++ pig/trunk/CHANGES.txt Fri Jun 8 18:41:47 2012
@@ -166,6 +166,8 @@ OPTIMIZATIONS
BUG FIXES
+PIG-2593: Filter by a boolean value does not work (jay23jack via daijy)
+
PIG-2665: Bundled Jython jar in Pig 0.10.0-RC breaks module import in Python scripts with embedded Pig Latin (daijy)
PIG-2736: Support implicit cast from bytearray to boolean (jay23jack via daijy)
Modified: pig/trunk/src/org/apache/pig/parser/AliasMasker.g
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/parser/AliasMasker.g?rev=1348185&r1=1348184&r2=1348185&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/parser/AliasMasker.g (original)
+++ pig/trunk/src/org/apache/pig/parser/AliasMasker.g Fri Jun 8 18:41:47 2012
@@ -297,6 +297,7 @@ cond
| ^( NULL expr NOT? )
| ^( rel_op expr expr )
| func_eval
+ | ^( BOOL_COND expr )
;
func_eval
Modified: pig/trunk/src/org/apache/pig/parser/AstPrinter.g
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/parser/AstPrinter.g?rev=1348185&r1=1348184&r2=1348185&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/parser/AstPrinter.g (original)
+++ pig/trunk/src/org/apache/pig/parser/AstPrinter.g Fri Jun 8 18:41:47 2012
@@ -267,6 +267,7 @@ cond
| ^( NULL expr { sb.append(" IS "); } (NOT { sb.append($NOT.text).append(" "); } )? { sb.append($NULL.text); } )
| ^( rel_op expr { sb.append(" ").append($rel_op.result).append(" "); } expr )
| func_eval
+ | ^( BOOL_COND expr )
;
func_eval
Modified: pig/trunk/src/org/apache/pig/parser/AstValidator.g
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/parser/AstValidator.g?rev=1348185&r1=1348184&r2=1348185&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/parser/AstValidator.g (original)
+++ pig/trunk/src/org/apache/pig/parser/AstValidator.g Fri Jun 8 18:41:47 2012
@@ -320,6 +320,7 @@ cond : ^( OR cond cond )
| ^( NULL expr NOT? )
| ^( rel_op expr expr )
| func_eval
+ | ^( BOOL_COND expr )
;
func_eval: ^( FUNC_EVAL func_name real_arg* )
Modified: pig/trunk/src/org/apache/pig/parser/LogicalPlanGenerator.g
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/parser/LogicalPlanGenerator.g?rev=1348185&r1=1348184&r2=1348185&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/parser/LogicalPlanGenerator.g (original)
+++ pig/trunk/src/org/apache/pig/parser/LogicalPlanGenerator.g Fri Jun 8 18:41:47 2012
@@ -730,8 +730,14 @@ cond[LogicalExpressionPlan exprPlan] ret
{
$expr = $func_eval.expr;
}
+ | ^( BOOL_COND e1 = expr[$exprPlan] )
+ {
+ $expr = $e1.expr;
+ $expr.setLocation( new SourceLocation( (PigParserNode)$BOOL_COND ) );
+ }
;
+
func_eval[LogicalExpressionPlan plan] returns[LogicalExpression expr]
@init {
List<LogicalExpression> args = new ArrayList<LogicalExpression>();
Modified: pig/trunk/src/org/apache/pig/parser/QueryParser.g
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/parser/QueryParser.g?rev=1348185&r1=1348184&r2=1348185&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/parser/QueryParser.g (original)
+++ pig/trunk/src/org/apache/pig/parser/QueryParser.g Fri Jun 8 18:41:47 2012
@@ -391,13 +391,16 @@ or_cond : and_cond ( OR^ and_cond )*
and_cond : unary_cond ( AND^ unary_cond )*
;
-unary_cond : LEFT_PAREN! cond RIGHT_PAREN!
- | not_cond
- | expr rel_op^ expr
+unary_cond : expr rel_op^ expr
+ | LEFT_PAREN! cond RIGHT_PAREN!
+ | not_cond
| func_eval
| null_check_cond
+ | bool_cond
;
+bool_cond: expr -> ^(BOOL_COND expr);
+
not_cond : NOT^ unary_cond
;
@@ -784,6 +787,7 @@ eid : rel_str_op
| TRUE
| FALSE
| REALIAS
+ | BOOL_COND
;
// relational operator
Modified: pig/trunk/test/e2e/pig/tests/nightly.conf
URL: http://svn.apache.org/viewvc/pig/trunk/test/e2e/pig/tests/nightly.conf?rev=1348185&r1=1348184&r2=1348185&view=diff
==============================================================================
--- pig/trunk/test/e2e/pig/tests/nightly.conf (original)
+++ pig/trunk/test/e2e/pig/tests/nightly.conf Fri Jun 8 18:41:47 2012
@@ -244,7 +244,7 @@ store b into ':OUTPATH:' using PigStorag
},
{
'num' => 18,
- 'ignore' => 1, # PIG-2593
+ 'ignore' => 1, # PIG-2593 this case is not supported as instate need to be declared as boolean
'pig' => q\a = load ':INPATH:/singlefile/allscalar10k' as (name, age, gpa, instate);
b = filter a by instate;
store b into ':OUTPATH:' using PigStorage;\,
@@ -254,7 +254,7 @@ store b into ':OUTPATH:' using PigStorag
},
{
'num' => 19,
- 'ignore' => 1, # PIG-2593
+ 'ignore' => 1, # PIG-2593 this case is not supported as instate need to be declared as boolean
'pig' => q\a = load ':INPATH:/singlefile/allscalar10k' as (name, age, gpa, instate);
b = filter a by not instate;
store b into ':OUTPATH:' using PigStorage;\,
@@ -288,7 +288,6 @@ store b into ':OUTPATH:' using PigStorag
},
{
'num' => 23,
- 'ignore' => 1, # PIG-2593
'pig' => q\a = load ':INPATH:/singlefile/allscalar10k' as (name:chararray, age:int, gpa:double, instate:boolean);
b = filter a by instate;
store b into ':OUTPATH:' using PigStorage;\,
@@ -298,7 +297,6 @@ store b into ':OUTPATH:' using PigStorag
},
{
'num' => 24,
- 'ignore' => 1, # PIG-2593
'pig' => q\a = load ':INPATH:/singlefile/allscalar10k' as (name:chararray, age:int, gpa:double, instate:boolean);
b = filter a by not instate;
store b into ':OUTPATH:' using PigStorage;\,