You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Lydia Ickler <ic...@googlemail.com> on 2016/02/29 11:14:19 UTC
filter dataset
Hi all,
I have a DataSet<Tuple3<Integer, Integer, Double> and I want to apply a filter to only get back all entries with e.g. first Integer in tuple == 0.
With a normal filter I do not have the possibility to pass an an additional argument but I have to set that parameter inside the filter function.
Is there a possibility to send a parameter to make the filter more flexible?
How would be the smartest way to do so?
Best regards,
Lydia
Re: filter dataset
Posted by Stefano Baghino <st...@radicalbit.io>.
Hi Lydia,
you can use a variable outside the scope of the normal filter (the one that
you define inline, if I understand correctly), like this:
*final* int *filterParameter* = 0;
dataset.filter(new FilterFunction<Integer, Integer, Double> () {
@Override
public boolean filter(Integer value) {
return value == *filterParameter*;
}
}
The only catch is that you have to make the variable *final*.
Does this answer your question? Hope I've been helpful.
Best,
Stefano
On Mon, Feb 29, 2016 at 11:14 AM, Lydia Ickler <ic...@googlemail.com>
wrote:
> Hi all,
>
> I have a DataSet<Tuple3<Integer, Integer, Double> and I want to apply a
> filter to only get back all entries with e.g. first Integer in tuple == 0.
> With a normal filter I do not have the possibility to pass an an
> additional argument but I have to set that parameter inside the filter
> function.
> Is there a possibility to send a parameter to make the filter more
> flexible?
> How would be the smartest way to do so?
>
> Best regards,
> Lydia
--
BR,
Stefano Baghino
Software Engineer @ Radicalbit