Hello Soniya, It's like the ternary or the conditional operator available in java and works just like that. Here is the example provided in the reference manual :
*Suppose we have relation A.* A = LOAD 'data' AS (f1:int, f2:int, B:bag{T:tuple(t1:int,t2:int)}); DUMP A; (10,1,{(2,3),(4,6)}) (10,3,{(2,3),(4,6)}) (10,6,{(2,3),(4,6),(5,7)}) *In this example the modulo operator is used with fields f1 and f2.* X = FOREACH A GENERATE f1, f2, f1%f2; DUMP X; (10,1,0) (10,3,1) (10,6,4) *In this example the bincond operator is used with fields f2 and B. The condition is "f2 equals 1"; if the condition is true, return 1; if the condition is false, return the count of the number of tuples in B.* X = FOREACH A GENERATE f2, (f2==1?1:COUNT(B)); DUMP X; (1,1L) (3,2L) (6,3L) It clearly shows that when "f2==1", which is the first case the exp evaluates to true, hence "1" is returned and count(B) is returned in rest of the 2 cases as exp evaluates to false. What were you trying to do and what exactly is the problem which you are facing? Warm Regards, Tariq https://mtariq.jux.com/ cloudfront.blogspot.com On Sat, Apr 27, 2013 at 8:23 PM, soniya B <soniya.bigd...@gmail.com> wrote: > Hi, > > Anyone can explain me about use of BinCond function with an example? I am > trying a lot but didn't work it. > > Regards > Soniya >