Hello!
I want to implement SQL query in terms of MapReduce with
ComputeTaskSplitAdapter.

/select * from Person where salary > ?/

And I want to know what is the best practise to do this?

At this moment I am using cache.localEntries() to get all cache values at
Map stage and it look's like it is not coorect, because there is no
garanties that each task will be executed on different nodes of Ignite Data
Grid.

Here is an example of split method of  my ComputeTaskSplitAdapter  class


/    @Override
    protected Collection<? extends ComputeJob> split(int gridSize, Integer
salary) throws IgniteException {
        List<ComputeJob> jobs = new ArrayList<>(gridSize);

        for (int i = 0; i < gridSize; i++) {
            jobs.add(new ComputeJobAdapter() {
                @Override
                public Object execute() {
                    IgniteCache<Long, Person> cache =
Ignition.ignite().cache(Executor.PERSON_CACHE);
                    List<Person> list = new ArrayList<>();
                    Iterable<Cache.Entry&lt;Long, Person>> entries =
cache.localEntries();
                    entries.forEach((entry -> {
                        if (entry.getValue().getSalary() > salary) {
                            list.add(entry.getValue());
                        }
                    }));

                    return list;
                }
            });
        }

        return jobs;
    }
/





--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Map-reduce-proceesing-tp4357.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Reply via email to