flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Metzger <rmetz...@apache.org>
Subject Re: how can rturn all row in dataset include mult value example
Date Wed, 20 May 2015 08:04:06 GMT
Hi,
in the for-loop you are always immediately returning. The code is only
getting i=0 (which is BUILDING).
You need to rework the for loop so that its not immediately returning.

Maybe
for(int i=0;i<valuesfromsubquery.size();i++) {
if(c.getField(index1).toString().equals(valuesfromsubquery.get(i))) {
             return true;
}
}
return false;




On Tue, May 19, 2015 at 9:53 AM, hagersaleh <loveallah1987@yahoo.com> wrote:

> want return all row include all value in valuesfromsubquery this code just
> return row include frist value BUILDING
> public static  ArrayList<String> valuesfromsubquery = new
> ArrayList<String>();
>
>        valuesfromsubquery.add("BUILDING");
>        valuesfromsubquery.add("MACHINERY");
>         valuesfromsubquery.add("AUTOMOBILE");
>           DataSet<Customer3>
> customers=env.readCsvFile("/home/hadoop/Desktop/Dataset/customer.csv")
>                     .fieldDelimiter('|')
>                     .includeFields(mask).ignoreFirstLine()
>                     .tupleType(Customer3.class);
>                     customers = customers.filter(new
> FilterFunction<Customer3>()
>                         {
>                             @Override
>                             public boolean filter(Customer3 c) {
>
>
>               for(int i=0;i<valuesfromsubquery.size();i++)
>               return
> c.getField(index1).toString().equals(valuesfromsubquery.get(i));
>              return true;
>
>
>                             }
>                 });
>
>                  customers.print();
>
> customers.writeAsCsv("/home/hadoop/Desktop/Dataset/out2.csv", "\n",
> "|",WriteMode.OVERWRITE);
>
>
>
>
> --
> View this message in context:
> http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/how-can-rturn-all-row-in-dataset-include-mult-value-example-tp1289.html
> Sent from the Apache Flink User Mailing List archive. mailing list archive
> at Nabble.com.
>

Mime
View raw message