ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From afedotov <alexander.fedot...@gmail.com>
Subject Re: Ability to index keys in Java Map
Date Thu, 30 Mar 2017 17:10:13 GMT
Sorry, I didn't quite get your question.

What I was talking about is:

Having such a class

public class Event implements Serializable {
    private Long timestamp;
    private String name;
    private Map<String, String> data;
}

and having some finite and not very large set of keys <key1>, <key2> ...
for the <data> map,
you could turn the Event class into something like

public class Event implements Serializable {
    private Long timestamp;
    private String name;
    private valueForKey1;
    private valueForKey2;
    ...
}

and use the fields for indexing purposes.

But probably, a better solution would be to move data into a separate table
and create a one-to-many relation
between Person and the created table. That would allow for querying using
regular SQL using joins.
So the problem domain will become something like this:

public class Event implements Serializable {
    private Long id;
    private Long timestamp;
    private String name;
}

public class EventData implements Serializable {
   private Long eventId;
   private String key;
   private String value;
}

Also, you can use ScanQuery for the desired behavior.
Similar problem is discussed in the thread below
http://apache-ignite-users.70518.x6.nabble.com/Query-on-collections-in-a-cache-object-td11529.html

On Thu, Mar 30, 2017 at 6:21 PM, dimamir999 [via Apache Ignite Users] <
ml-node+s70518n11576h90@n6.nabble.com> wrote:

> Thanks for answer.
> But if i implement custom serialization when i take every entry in map and
> use key of this entry like column name how i can use this fields in SQL
> queries? What i should write in XML configuration to do it? Can i build
> index on existing column in Ignite entry?
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
> http://apache-ignite-users.70518.x6.nabble.com/Ability-
> to-index-keys-in-Java-Map-tp11282p11576.html
> To start a new topic under Apache Ignite Users, email
> ml-node+s70518n1h65@n6.nabble.com
> To unsubscribe from Apache Ignite Users, click here
> <http://apache-ignite-users.70518.x6.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1&code=YWxleGFuZGVyLmZlZG90b2ZmQGdtYWlsLmNvbXwxfC0xMzYxNTU0NTg=>
> .
> NAML
> <http://apache-ignite-users.70518.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>



-- 
Kind regards,
Alex.




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Ability-to-index-keys-in-Java-Map-tp11282p11578.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
Mime
View raw message