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 2016/08/10 17:31:22 UTC
svn commit: r1755785 - in /pig/trunk: CHANGES.txt
src/docs/src/documentation/content/xdocs/func.xml
Author: daijy
Date: Wed Aug 10 17:31:22 2016
New Revision: 1755785
URL: http://svn.apache.org/viewvc?rev=1755785&view=rev
Log:
PIG-4931: Document IN operator
Modified:
pig/trunk/CHANGES.txt
pig/trunk/src/docs/src/documentation/content/xdocs/func.xml
Modified: pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1755785&r1=1755784&r2=1755785&view=diff
==============================================================================
--- pig/trunk/CHANGES.txt (original)
+++ pig/trunk/CHANGES.txt Wed Aug 10 17:31:22 2016
@@ -24,6 +24,8 @@ INCOMPATIBLE CHANGES
IMPROVEMENTS
+PIG-4931: Document IN operator (dbist13 vi daijy)
+
PIG-4852: Add accumulator implementation for MaxTupleBy1stField (szita via daijy)
PIG-4925: Support for passing the bloom filter to the Bloom UDF (rohini)
Modified: pig/trunk/src/docs/src/documentation/content/xdocs/func.xml
URL: http://svn.apache.org/viewvc/pig/trunk/src/docs/src/documentation/content/xdocs/func.xml?rev=1755785&r1=1755784&r2=1755785&view=diff
==============================================================================
--- pig/trunk/src/docs/src/documentation/content/xdocs/func.xml (original)
+++ pig/trunk/src/docs/src/documentation/content/xdocs/func.xml Wed Aug 10 17:31:22 2016
@@ -1377,7 +1377,80 @@ DUMP X;
</tr>
</table>
</section></section>
-
+
+
+<!-- ++++++++++++++++++++++++++++++++++++++++++++++ -->
+ <section id="in">
+ <title>IN</title>
+ <p>IN operator allows you to easily test if an expression matches any value in a list of values. It is used to reduce the need for multiple OR conditions.</p>
+
+ <section>
+ <title>Syntax</title>
+ <table>
+ <tr>
+ <td>
+ <p>IN (expression)</p>
+ </td>
+ </tr>
+ </table></section>
+
+ <section>
+ <title>Terms</title>
+ <table>
+ <tr>
+ <td>
+ <p>expression</p>
+ </td>
+ <td>
+ <p>An expression with data types chararray, int, long, float, double, bigdecimal, biginteger or bytearray.</p>
+ </td>
+ </tr>
+ </table></section>
+
+ <section>
+ <title>Usage</title>
+ <p>IN operator allows you to easily test if an expression matches any value in a list of values. It is used to help reduce the need for multiple OR conditions.</p>
+ </section>
+
+ <section>
+ <title>Example</title>
+ <p>In this example we filter out ID 4 and 6.</p>
+<source>
+A = load 'data' using PigStorage(',') AS (id:int, first:chararray, last:chararray, gender:chararray);
+
+DUMP A;
+(1,Christine,Romero,Female)
+(2,Sara,Hansen,Female)
+(3,Albert,Rogers,Male)
+(4,Kimberly,Morrison,Female)
+(5,Eugene,Baker,Male)
+(6,Ann,Alexander,Female)
+(7,Kathleen,Reed,Female)
+(8,Todd,Scott,Male)
+(9,Sharon,Mccoy,Female)
+(10,Evelyn,Rice,Female)
+
+X = FILTER A BY id IN (4, 6);
+DUMP X;
+(4,Kimberly,Morrison,Female)
+(6,Ann,Alexander,Female)
+</source>
+ </section>
+
+<p>In this example, we're passing a BigInteger and using NOT operator, thereby negating the passed list of fields in the IN clause</p>
+<source>
+A = load 'data' using PigStorage(',') AS (id:biginteger, first:chararray, last:chararray, gender:chararray);
+X = FILTER A BY NOT id IN (1, 3, 5, 7, 9);
+DUMP X;
+
+(2,Sara,Hansen,Female)
+(4,Kimberly,Morrison,Female)
+(6,Ann,Alexander,Female)
+(8,Todd,Scott,Male)
+(10,Evelyn,Rice,Female)
+</source>
+</section>
+
<!-- ++++++++++++++++++++++++++++++++++++++++++++++ -->
<section id="tokenize">
<title>TOKENIZE</title>