Count unique items.

classic Classic list List threaded Threaded
4 messages Options
javadevmtl javadevmtl
Reply | Threaded
Open this post in threaded view
|

Count unique items.

This post has NOT been accepted by the mailing list yet.
Hi lets say i have the following model...

class Car {
    String manufacturer;
    String color;
    String model;
}

And I have the following data set

Honda, Black, Sedan
Honda, Red, Coupe
Honda, Red, Sport
Toyota, Black, Wagon
Toyota, Silver, Wagon
Toyota, Silver, Sedan

Given the above dataset, I want to know how many unique values I have given each property.

Given the key Honda, how many unique colors. Answer: 2
Given the key Honda, how many unique models. Answer: 3
Given the key Toyota, how many unique colors. Answer:  2
Given the key Toyota, how many unique models. Answer: 2
Given the key Black, how many unique manufacturers. Answer: 2
Given the key Black, how many unique models. Answer: 2
Given the key Silver, how many unique manufacturers. Answer: 1
Given the key Silver, how many unique models. Answer: 2
Given the key Sedan, how many unique manufacturers. Answer: 2
Given the key Sedan, how many unique colors. Answer: 2
Given the key Wagon, how many unique manufacturers. Answer: 1
Given the key Wagon, how many unique colors. Answer: 1

What's the most efficient way to do this with Ignite?
vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|

Re: Count unique items.

You can use SQL queries for this. E.g., to answer the first question you will use this query:

select distinct color from Car where manufacturer = 'Honda'

Here is the documentation page about hot to configure and use Ignite query APIs: http://apacheignite.readme.io/v1.2/docs/cache-queries

-Val
javadevmtl javadevmtl
Reply | Threaded
Open this post in threaded view
|

Re: Count unique items.

And distinct works cross the cluster?

On 7 July 2015 at 18:35, vkulichenko [via Apache Ignite Users] <[hidden email]> wrote:
You can use SQL queries for this. E.g., to answer the first question you will use this query:

select distinct color from Car where manufacturer = 'Honda'

Here is the documentation page about hot to configure and use Ignite query APIs: http://apacheignite.readme.io/v1.2/docs/cache-queries

-Val


If you reply to this email, your message will be added to the discussion below:
http://apache-ignite-users.70518.x6.nabble.com/Count-unique-items-tp615p616.html
To unsubscribe from Count unique items., click here.
NAML

Sergi Vladykin Sergi Vladykin
Reply | Threaded
Open this post in threaded view
|

Re: Count unique items.

Feel free to file a ticket in our Jira if it does not ;)
https://issues.apache.org/jira/browse/IGNITE/

Sergi

2015-07-09 23:24 GMT+03:00 javadevmtl <[hidden email]>:
And distinct works cross the cluster?

On 7 July 2015 at 18:35, vkulichenko [via Apache Ignite Users] <[hidden email]> wrote:
You can use SQL queries for this. E.g., to answer the first question you will use this query:

select distinct color from Car where manufacturer = 'Honda'

Here is the documentation page about hot to configure and use Ignite query APIs: http://apacheignite.readme.io/v1.2/docs/cache-queries

-Val


If you reply to this email, your message will be added to the discussion below:
http://apache-ignite-users.70518.x6.nabble.com/Count-unique-items-tp615p616.html
To unsubscribe from Count unique items., click here.
NAML



View this message in context: Re: Count unique items.

Sent from the Apache Ignite Users mailing list archive at Nabble.com.