Expression Filter is not working.

62 views
Skip to first unread message

jaydee...@gwynniebee.com

unread,
Nov 15, 2017, 1:12:51 AM11/15/17
to cascading-user
      ExpressionFilter filter = new ExpressionFilter( "id != 2" , Integer.TYPE);
       pipe = new Each(pipe , new Fields("id") , filter);
it says to remove arguments to match ExpressionFIlter().

type of "id" is int.
would anyone help to resolve this ?

Chris K Wensel

unread,
Nov 15, 2017, 1:20:33 AM11/15/17
to cascadi...@googlegroups.com
sorry you are having issues. 

a stack trace would be very helpful. a reproducible test case more so..

ckw


--
You received this message because you are subscribed to the Google Groups "cascading-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cascading-use...@googlegroups.com.
To post to this group, send email to cascadi...@googlegroups.com.
Visit this group at https://groups.google.com/group/cascading-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/cascading-user/d354ea8b-3742-4bf7-ac69-0b38c4598bd2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


jaydee...@gwynniebee.com

unread,
Nov 15, 2017, 1:49:11 AM11/15/17
to cascading-user
I hope it will help to understand scenario :
        final Plunger plunger1 = new Plunger();
        final Data data =
                new DataBuilder(new Fields("id" , "comments" , "last_updated_time"))
                                .addTuple("1", "first" , "2017-09-04 23:59:00.0")
                                .build();   
        Pipe pipe = plunger1.newNamedPipe("pipe", data);
//expression1  
        pipe = new Each(pipe , new Fields("id") , new ExpressionFilter( "id != 2" , Integer.TYPE));
//in above line error says cast argument3 to 'function'
//expression2 after casting
        pipe = new Each(pipe , new Fields("id") , (Function) new ExpressionFilter( "id != 2" , Integer.TYPE));
//error says remove arguments to match ExpressionFilter()
//Expression3 after removing arguments 
        pipe = new Each(pipe , new Fields("id") , (Function) new ExpressionFilter());

        
finally how to use the above ?

Patrick Duin

unread,
Nov 15, 2017, 5:03:25 AM11/15/17
to cascadi...@googlegroups.com
Hi Jaydeep,

I see you are using the plunger testing framework.

You're example is working for me:
     final Plunger plunger1 = new Plunger();

    final Data data = new DataBuilder(new Fields("id", "comments", "last_updated_time"))
        .addTuple("1", "first", "2017-09-04 23:59:00.0")
        .build();
    Pipe pipe = plunger1.newNamedPipe("pipe", data);
    pipe = new Each(pipe, new Fields("id"), new ExpressionFilter("id != 2", Integer.TYPE));
    plunger1.newBucket(Fields.ALL, pipe).result().prettyPrinter().print();

The row "1" is filtered, so nothing is printed. Given that you get compile errors perhaps something is wrong with your imports,

Cheers,
Patrick




--
You received this message because you are subscribed to the Google Groups "cascading-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cascading-user+unsubscribe@googlegroups.com.
To post to this group, send email to cascading-user@googlegroups.com.

jaydee...@gwynniebee.com

unread,
Nov 15, 2017, 7:17:26 AM11/15/17
to cascading-user
Hi Patrick,
yeah may be , so would u plz tell me which class or interface did u import for ExpressionFilter() ?
To unsubscribe from this group and stop receiving emails from it, send an email to cascading-use...@googlegroups.com.
To post to this group, send email to cascadi...@googlegroups.com.

Patrick Duin

unread,
Nov 15, 2017, 10:05:46 AM11/15/17
to cascadi...@googlegroups.com

This is what I imported (Cascading version 3.0.2):

import cascading.operation.expression.ExpressionFilter;
import cascading.pipe.Each;
import cascading.pipe.Pipe;



To unsubscribe from this group and stop receiving emails from it, send an email to cascading-user+unsubscribe@googlegroups.com.
To post to this group, send email to cascading-user@googlegroups.com.

jaydee...@gwynniebee.com

unread,
Nov 15, 2017, 1:26:57 PM11/15/17
to cascading-user
I'm not able to import cascading.operation.expression.ExpressionFilter. it shows error like import cannot be resolved, so i imported org.apache.log4j.filter.ExpressionFilter that doesn't work. i'm using the same cascading version.
 
Is there anything other than this that i need to import or install to use expression Filter ?

Chris K Wensel

unread,
Nov 15, 2017, 5:36:04 PM11/15/17
to cascadi...@googlegroups.com

Note that Cascading breaks all the expression functions out into their own dependency:


• cascading-expression-x.y.z.jar - all Cascading Janino expression operations class files

you may need to add it explicitly

for 3.1.2


ckw



For more options, visit https://groups.google.com/d/optout.

jaydee...@gwynniebee.com

unread,
Nov 16, 2017, 2:37:36 AM11/16/17
to cascading-user
Thanks man,
I just added cascading-expression dependency and now its working for me too. :)
Reply all
Reply to author
Forward
0 new messages