in theory, you can't select field names from Fields.UNKNOWN, since
there aren't any names, and this is somewhat true for positional
selectors.
so strictly speaking, the bug was not returning a valid exception that
give you more information. but since in this case we know how big the
tuple is during runtime, we can use the positional selectors.
so I updated the code to pass the actual tuple size down the stack
where appropriate. so you can now pick the last element from a tuple
of varying width. but note this position data isn't cached, so it must
be calculated on every operation call. not a big deal, but in the
large, it adds up. so do try to declare all fields whenever possible.
> As far as my other issues (and I have a lot, I know *grin*), maybe
> it's due to a misunderstanding on my part. Just to revisit, I'm using
> a RegexSplitter to split apart my data:
>
> pipe = new Each(pipe, new Fields("line"), new RegexSplitter("\t"));
>
> Since I'm not explicitly specifying the names (and number) of the
> Fields returned by the RegexSplitter, I'm assuming it will treated as
> Fields.UNKNOWN. I pass that into a filter I wrote that is ~supposed~
> to filter out tuples that don't have enough fields. Does the following
> snippet look it's on the right track?
>
> public boolean isRemove(FlowProcess flowProcess, FilterCall<Text>
> filterCall)
> {
> // get the arguments TupleEntry
> TupleEntry arguments = filterCall.getArguments();
>
> if (arguments.size() != this.expectedFieldCount)
> return false;
>
> return true;
> }
>
> More to the point, does/should TupleEntry.size() work as expected and
> return the number of actual fields stored in the Tuple, if the Fields
> associated with the TupleEntry is set to Fields.UNKNOWN?
yes, it should work fine. I'll write a test to confirm its working in
this particular case.
all my fixes on in the git repo in the 'working' branch. i'll move
them to master and svn sometime today.