Re: Storing a Map (or similar) inside a Distributed Map...

194 views
Skip to first unread message

Mehmet Dogan

unread,
Dec 15, 2012, 7:53:34 AM12/15/12
to haze...@googlegroups.com
Not possible at the moment. We are planning to support (or at least to be easily implement) more complex structures on version 3.0. It is being developed and we hope there will be a beta end of January.

@mmdogan

On Nov 28, 2012, at 11:32 AM, daniel...@gmail.com wrote:

Hi there,

Is there a low level way to store a Map in side a distributed Hazelcast Map?

Ideally I'd like to be able to enable index support and use the Query Predicate API to query against it. I don't mind implementing my own Predicate (which looks very easy) or data extractor (Whats the interface?) for the Index but wasn't sure what the best way to store the Map might be.

Ideally I'd like to do something like this:

IMap<String, Map<String, String> customers = Hazelcast.getMap("customers");
customers.addIndex("firstName", true); 
customers.addIndex("lastName", true); 
customers.put("1", new HashMap<String,String>() {{ put("Joe", "Smith"); }});
customers.put("2", new HashMap<String,String>() {{ put(("Ali", "Selam"); }});
customers.put("3", new HashMap<String,String>() {{ put(("Avi", "Noyan"); }});

Set<Map<String, String>> joes = (Set<Map<String, String>>) customers.values(new MapPredicate("firstName IS 'Joe'"));

Many thanks

Dan


--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To view this discussion on the web visit https://groups.google.com/d/msg/hazelcast/-/JoyzY2KZrFYJ.
To post to this group, send email to haze...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hazelcast?hl=en.

jion...@gmail.com

unread,
Jul 9, 2014, 12:51:51 AM7/9/14
to haze...@googlegroups.com

Is this supported now in 3.2.3 or 3.3-RC1?
I have the same needs as Dan outlined above to store a HashMap element in my cache object.

Thanks!

Enes Akar

unread,
Jul 9, 2014, 6:17:50 AM7/9/14
to haze...@googlegroups.com
No still we do not have NestedMap.


To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+...@googlegroups.com.

To post to this group, send email to haze...@googlegroups.com.



--

Enes Akar
Director of Engineering
Mahir İz Cad. No:35, Altunizade, İstanbul

melih coşkun

unread,
Jan 21, 2015, 8:36:30 AM1/21/15
to haze...@googlegroups.com
Hi ,

is Nested Map supported with 3.4 ?

Thanks

9 Temmuz 2014 Çarşamba 13:17:50 UTC+3 tarihinde Enes Akar yazdı:

Enes Akar

unread,
Jan 21, 2015, 9:50:50 AM1/21/15
to haze...@googlegroups.com
No, and also not planned for 3.5.


For more options, visit https://groups.google.com/d/optout.

dsukho...@gmail.com

unread,
Jan 21, 2015, 12:41:24 PM1/21/15
to haze...@googlegroups.com
Hi,

Actuaaly, there is no need for nested Map support, you just need to provide an Api for custom indexes, that will solve the problem. Something has been done in PR #4255, do you plan to use it in some near release?

Thanks, Denis.

Enes Akar

unread,
Jan 22, 2015, 3:02:25 AM1/22/15
to haze...@googlegroups.com
we plan some improvements on query and index for 3.5. I can not promise but I will suggest this PR to be included in scope of this improvements. 

--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+...@googlegroups.com.
To post to this group, send email to haze...@googlegroups.com.
Visit this group at http://groups.google.com/group/hazelcast.

For more options, visit https://groups.google.com/d/optout.

nvp152

unread,
Jan 25, 2016, 1:54:40 AM1/25/16
to Hazelcast
I think this enhancement would be a significant differentiator - there are definitely more advantages than meets the eye. By allowing to specify a Map (whether HashMap or something hazelcast custom) as an entry (and have it be indexable and queriable) in an IMap this would relieve folks from having to manage/push their VO to the each node (under the assumption that the key value pairs in that HashMap are basic java objects). To be clear the goal here is more about providing a means to specify a VO with custom properties than it is about providing a true map. I really think the rollout of the jars to each of the node is a real pain in the ass though I also understand the concerns and complexity of a remote class loader. This would be provide a decent middle ground solution.

Hope it makes sense.

thx

Eugene Strokin

unread,
Aug 18, 2016, 11:39:08 PM8/18/16
to Hazelcast, nicolas...@gmail.com
Totally agree. Technically, each bean could be presented by Map<String, Object>, if beans are supported, I see no reason HashMap being supported as well. By allowing running queries on Map (or HashMap) we can run Hazelcast cluster out of the box, without deploying our beans on each node, no custom dependencies. That makes a tool mature, and puts it on the next level.
Looks like HZ 3.6 still missing it.
Wandering if any plans to implement this on some near feature, or no certain plans at all?

Thank you,
Eugene

Noctarius

unread,
Aug 19, 2016, 12:58:40 AM8/19/16
to Christoph Engelbert - Hazelcast, nicolas...@gmail.com
Hey Eugene,

In 3.6 you can use ValueExtractor to build your own value extraction for example, retrieving elements from maps or lists. In 3.7 you find a prebuilt set of those extractor available for convenience.

Chris

Eugene Strokin

unread,
Aug 19, 2016, 10:24:09 AM8/19/16
to Hazelcast
Thank you Chris,
I've upgraded to 3.7.
Looks like I still need to define somehow prebuilt extractor for a HashMap, because if I'm running:

HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
IMap<String, Map<String, Object>> map = client.getMap("r-da2");
HashMap<String, Object> a = new HashMap<>();
a
.put("active", true);
a
.put("age", 25);
map
.put( "a", a );
System.out.println(map.values(new SqlPredicate("age < 30")));


I'm getting:

Exception in thread "main" com.hazelcast.query.QueryException: java.lang.IllegalArgumentException: There is no suitable accessor for 'age' on class 'class java.util.HashMap'

If you can point me out to the right direction of setting the prebuilt extractor for a map up?

Greatly appreciated,

Eugene

Reply all
Reply to author
Forward
0 new messages