ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Denis Magda <dma...@gridgain.com>
Subject Re: Sorting behaviour on Time Series data in partitioned cache
Date Wed, 23 Dec 2015 08:09:23 GMT
Welly,

The data won't be sorted by "idx" in a result set just because you have 
an index on this field.
In fact all TimeSeries will be stored in different partitions on a 
single node. Each partition is a ConcurrentHashMap.
Query indexes lets you get data from partitions quickly but they are not 
doing any additional ordering as far as I know.

*Sergi*, please join the discussion and correct me if I'm wrong.

--
Denis

On 12/23/2015 11:01 AM, Welly Tambunan wrote:
> Hi Denis,
>
> I try this one but still it's not sorted
>
> Entry [key=SeriesKey(274061d5-7b48-4b35-b08a-1742c97865ef,1), 
> val=TimeSeries(274061d5-7b48-4b35-b08a-1742c97865ef,*1*,1)]
> Entry [key=SeriesKey(274061d5-7b48-4b35-b08a-1742c97865ef,2), 
> val=TimeSeries(274061d5-7b48-4b35-b08a-1742c97865ef,*2*,2)]
> Entry [key=SeriesKey(274061d5-7b48-4b35-b08a-1742c97865ef,8), 
> val=TimeSeries(274061d5-7b48-4b35-b08a-1742c97865ef,*8*,8)]
> Entry [key=SeriesKey(274061d5-7b48-4b35-b08a-1742c97865ef,3), 
> val=TimeSeries(274061d5-7b48-4b35-b08a-1742c97865ef,*3*,3)]
> Entry [key=SeriesKey(274061d5-7b48-4b35-b08a-1742c97865ef,5), 
> val=TimeSeries(274061d5-7b48-4b35-b08a-1742c97865ef,*5*,5)]
> Entry [key=SeriesKey(274061d5-7b48-4b35-b08a-1742c97865ef,4), 
> val=TimeSeries(274061d5-7b48-4b35-b08a-1742c97865ef,*4*,4)]
> Entry [key=SeriesKey(274061d5-7b48-4b35-b08a-1742c97865ef,9), 
> val=TimeSeries(274061d5-7b48-4b35-b08a-1742c97865ef,*9*,9)]
> Entry [key=SeriesKey(274061d5-7b48-4b35-b08a-1742c97865ef,6), 
> val=TimeSeries(274061d5-7b48-4b35-b08a-1742c97865ef,*6*,6)]
> Entry [key=SeriesKey(274061d5-7b48-4b35-b08a-1742c97865ef,7), 
> val=TimeSeries(274061d5-7b48-4b35-b08a-1742c97865ef,*7*,7)]
>
> On Wed, Dec 23, 2015 at 2:44 PM, Denis Magda <dmagda@gridgain.com 
> <mailto:dmagda@gridgain.com>> wrote:
>
>     Hi Welly,
>
>     "chId" field of your TimeSeries class is not indexed. So your
>     query is doing a full scan.
>     Modify class definition this way and check the result
>
>     case class TimeSeries(@(QuerySqlField @field)*(index = true)***chId: UUID,@(QuerySqlField
@field)(index =true) idx: Long, value: Any)extends Serializable
>
>
>     Regards,
>     Denis
>
>     On 12/23/2015 10:27 AM, Welly Tambunan wrote:
>>     Hi All,
>>
>>     I have a node with this configuration for working with TimeSeries
>>     valcacheConfig =new CacheConfiguration[SeriesKey, TimeSeries]("time-series")
>>     cacheConfig.setCacheMode(CacheMode.PARTITIONED)
>>     cacheConfig.setIndexedTypes(classOf[SeriesKey],classOf[TimeSeries])
>>     val cfg =new IgniteConfiguration()
>>     cfg.setCacheConfiguration(cacheConfig)
>>
>>     The class i have is the simple one like this
>>
>>     case class SeriesKey(@AffinityKeyMapped chId: UUID, idx: Long)extends Serializable
>>
>>     case class TimeSeries(@(QuerySqlField @field) chId: UUID,@(QuerySqlField @field)(index
=true) idx: Long, value: Any)extends Serializable
>>     I expect that the series with the same channel will be cached in
>>     a single node and it will be sorted based on the index. However
>>     when i'm querying the cache like this i found out of order series.
>>     val sql =new SqlQuery(classOf[TimeSeries],"chId = ?")val chId = UUID.fromString("274061d5-7b48-4b35-b08a-1742c97865ef")
>>
>>     // Find only persons earning more than 1,000. val cursor = cache.query(sql.setArgs(chId))
>>     I'm confuse with this behavior as it seems doesn't index the
>>     TimeSeries right. If i add the order by idx it works fine even
>>     when i don't set querysqlfield index=true
>>
>>     Any thoughts ?
>>
>>     Cheers
>>     -- 
>>     Welly Tambunan
>>     Triplelands
>>
>>     http://weltam.wordpress.com
>>     http://www.triplelands.com <http://www.triplelands.com/blog/>
>
>
>
>
> -- 
> Welly Tambunan
> Triplelands
>
> http://weltam.wordpress.com
> http://www.triplelands.com <http://www.triplelands.com/blog/>


Mime
View raw message