Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Pig >> mail # user >> Is there any Conditional Statement in Pig like If/Else


Copy link to this message
-
Re: Is there any Conditional Statement in Pig like If/Else
You can process different subsets of your data differently using the SPLIT
operator, which might help.

http://pig.apache.org/docs/r0.11.1/basic.html#SPLIT
On Tue, Jul 16, 2013 at 12:39 AM, Marco Brinkmann
<[EMAIL PROTECTED]>wrote:

> There is nothing directly in Pig, you have to embed it into another
> language. Please take a look at control structures:
>
> http://pig.apache.org/docs/r0.11.1/cont.html
>
> -- Marco
>
>
>
> 2013/7/16 Bhavesh K Shah <[EMAIL PROTECTED]>
>
> > Hello All,
> >
> > I am newbie to Apache Pig and I am exploring it for my one of the use
> case.
> > Actually I am writing PIG Script and want to execute some set of
> > statements if one of the condition is satisfied.
> > I have set one variable to some value.  I want to implement like below:
> >
> > if flag==0 then
> >   A = LOAD 'file' using PigStorage() as (f1:int, ....);
> >   B = ...;
> >   C = ....;
> > else
> >   again some Pig Latin statements
> >
> > Can I do this in PIG Script? If yes, then how can I do this?
> >
> > Also I came across conditional operator in Pig like (a == b ? c1 : c2);.
> > But How can I insert bulk of Pig Statements in between operator?
> >
> >
> > Thanks.
> > Bhavesh Shah
> >
> >
> **************************************Disclaimer******************************************
> > This e-mail message and any attachments may contain confidential
> > information and is for the sole use of the intended recipient(s) only.
> Any
> > views or opinions presented or implied are solely those of the author and
> > do not necessarily represent the views of BitWise. If you are not the
> > intended recipient(s), you are hereby notified that disclosure, printing,
> > copying, forwarding, distribution, or the taking of any action whatsoever
> > in reliance on the contents of this electronic information is strictly
> > prohibited. If you have received this e-mail message in error, please
> > immediately notify the sender and delete the electronic message and any
> > attachments.BitWise does not accept liability for any virus introduced by
> > this e-mail or any attachments.
> >
> ********************************************************************************************
> >
>

--
*Note that I'm no longer using my Yahoo! email address. Please email me at
[EMAIL PROTECTED] going forward.*
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB