flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hagersaleh <loveallah1...@yahoo.com>
Subject Re: when return value from linkedlist or map and use in filter function display error
Date Tue, 09 Jun 2015 07:16:56 GMT
error dispaly
 non-static variable map cannot be referenced from a static context
map.put("C_MKTSEGMENT", 2);

code
public Map<String, Integer> map = new HashMap<String, Integer>();
  
   
    public static  void main(String[] args) throws Exception {    
  
        map.put("C_MKTSEGMENT", 2);
        ExecutionEnvironment env =
ExecutionEnvironment.getExecutionEnvironment();
          DataSet<Customer3>
customers=env.readCsvFile("/home/hadoop/Desktop/Dataset/customer.csv")
					.fieldDelimiter('|')
					.includeFields("11000010").ignoreFirstLine()
					.tupleType(Customer3.class);
           customers = customers.filter(new FilterFunction<Customer3>() 
                        {
                            @Override                    
                            public boolean filter(Customer3 c) {
                   
                            Integer index1=map.get("C_MKTSEGMENT");
                            return c.getField(index1).equals("AUTOMOBILE");
                        }
                });
            
         customers.print();
         customers.writeAsCsv("/home/hadoop/Desktop/Dataset/out1.csv", "\n",
"|",WriteMode.OVERWRITE);               
        env.execute("TPCH Query 3 Example");	
        
    }


when remove static from main method display error not found main method




--
View this message in context: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/when-return-value-from-linkedlist-or-map-and-use-in-filter-function-display-error-tp1528p1555.html
Sent from the Apache Flink User Mailing List archive. mailing list archive at Nabble.com.

Mime
View raw message