Hi, There is no need to implement SQL queries using map-reduce. Ignite already has it's own query engine. Please refer to *org.apache.ignite.cache.query.SqlQuery *class and *IgniteCache.query()* method.
Alternatively you can use scan queries for some cases. See *org.apache.ignite.cache.query.ScanQuery*. Vladimir. On Wed, Apr 20, 2016 at 10:41 AM, dmreshet <[email protected]> wrote: > 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<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. >
