You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Chesnay Schepler (JIRA)" <ji...@apache.org> on 2015/04/18 16:22:58 UTC
[jira] [Commented] (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:comment-tabpanel&focusedCommentId=14501384#comment-14501384 ]
Chesnay Schepler commented on FLINK-1910:
-----------------------------------------
okay, if you create an issue, please do so in a way that actually allows us to help you. I've placed your code into the correct section (Description).
Now please provide a good explanation what, a) you believe should happen, and b) what actually happens.
> 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)