[ https://issues.apache.org/jira/browse/FLINK-1910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14501433#comment-14501433 ]
Chesnay Schepler commented on FLINK-1910: ----------------------------------------- This is what i meant by saving the LinkedList inside your filter function: {code:java} public static class MyFilter implements FilterFunction<Customer>{ private List list = new LinkedList(values); @Override public boolean filter(Customer c) { return c.getField(4).equals(list.get(0).toString()) && c.getField(2).equals(list.get(1).toString()) ; } }); customers = customers.filter(new MyFilter()) {code} BroadcastVariables are used to provide a set of values at an operator at runtime. For more information on broadcast variables, refer to the documentation: http://ci.apache.org/projects/flink/flink-docs-master/programming_guide.html#broadcast-variables > why this code flink not reurn value when use variable in filter > --------------------------------------------------------------- > > Key: FLINK-1910 > URL: https://issues.apache.org/jira/browse/FLINK-1910 > Project: Flink > Issue Type: Bug > Reporter: hagersaleh > > {code:java} > public static LinkedList values=new LinkedList<String>(); > public static void main(String[] args) throws Exception > { > values.add("AUTOMOBILE"); > values.add("XSTf4&&NCwDVaWNe6tEgvwfmRchLXak"); > ExecutionEnvironment env = > ExecutionEnvironment.getExecutionEnvironment(); > DataSet<Customer> customers = getCustomerDataSet(env); > customers = customers.filter( > new FilterFunction<Customer>() { > @Override > public boolean filter(Customer c) { > return c.getField(4).equals(values.get(0).toString()) && > c.getField(2).equals(values.get(1).toString()) ; > } > }); > System.out.println(customers.print()); > customers.writeAsCsv("/home/hadoop/Desktop/Dataset/output.csv", "\n", > "|"); > env.execute(); > } > public static class Customer extends Tuple5<Long,String,String,String,String> > { > } > private static DataSet<Customer> getCustomerDataSet(ExecutionEnvironment env) > { > return env.readCsvFile("/home/hadoop/Desktop/Dataset/customer.csv") > .fieldDelimiter('|') > .includeFields("11100110").ignoreFirstLine() > .tupleType(Customer.class); > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)