You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Aljoscha Krettek (JIRA)" <ji...@apache.org> on 2015/04/19 07:15:59 UTC
[jira] [Resolved] (FLINK-1910) why this code flink not reurn value
when use variable in filter
[ https://issues.apache.org/jira/browse/FLINK-1910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Aljoscha Krettek resolved FLINK-1910.
-------------------------------------
Resolution: Not A Problem
Could you please post questions about using Flink to the user mailing list: http://flink.apache.org/community.html#mailing-lists.
This issue tracking system is meant for keeping track of bugs or improvements to Flink code.
> 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)