Deleting a Field Without Knowing Incoming Fields

156 views
Skip to first unread message

Wallace Mann

unread,
Apr 26, 2012, 4:19:34 PM4/26/12
to cascading-user
How do I delete one field without knowing at compile time what the
incoming fields are?

The example in the users guide presumes knowledge of the keep fields:

// incoming -> "keepField", "dropField"
pipe = new Each( pipe, new Fields( "keepField" ), new Identity(),
Fields.RESULTS );
// outgoing -> "keepField"

What I'm looking for is something like ...

pipe = new Delete( pipe, new Fields( "deleteMe" ) );

What I'm really looking for is a version of Rename that won't blow up
if the toField already exists. This is my current solution, which
works but sends junk data through the system until the next
Aggregation.

String junkFieldName = "IGNORE_FIELD_" + new
Date().getTime();
pipe = new Rename( pipe, new Fields( toFieldName ), new
Fields( junkFieldName) );
pipe = new Rename( pipe, new Fields( fromFieldName ), new
Fields( toFieldName) );


Thanks,
Wallace

Chris K Wensel

unread,
Apr 26, 2012, 4:30:54 PM4/26/12
to cascadi...@googlegroups.com
try Discard
http://docs.cascading.org/cascading/2.0/javadoc/cascading/pipe/assembly/Discard.html
> --
> You received this message because you are subscribed to the Google Groups "cascading-user" group.
> To post to this group, send email to cascadi...@googlegroups.com.
> To unsubscribe from this group, send email to cascading-use...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/cascading-user?hl=en.
>

--
Chris K Wensel
ch...@concurrentinc.com
http://concurrentinc.com

Wallace Mann

unread,
Apr 26, 2012, 5:52:24 PM4/26/12
to cascading-user
Ack! I went looking in the javadocs for Discard, Delete, Dispose,
Remove ... and now notice that although I'm using 2.0 code, I was
searching 1.1 javadocs.

Thanks again!
Wallace

On Apr 26, 1:30 pm, Chris K Wensel <ch...@wensel.net> wrote:
> try Discardhttp://docs.cascading.org/cascading/2.0/javadoc/cascading/pipe/assemb...
> > For more options, visit this group athttp://groups.google.com/group/cascading-user?hl=en.
Reply all
Reply to author
Forward
0 new messages