RedisTimeSeries / JRedisTimeSeries

Java Client for RedisTimeSeries
https://redistimeseries.io
BSD 3-Clause "New" or "Revised" License
33 stars 16 forks source link

TS Range multiple value buckets for aggregate . #17

Open borgrodrick opened 4 years ago

borgrodrick commented 4 years ago

I am using redis version 6.0.1 running via docker (docker run -p 6379:6379 -it --rm redislabs/redistimeseries)

I am trying to get an daily sum aggregate of values on a given key via:

rts.range(key, LocalDateTime.now().minusDays(1).toInstant(ZoneOffset.ofHours(2)).toEpochMilli(),LocalDateTime.now().toInstant(ZoneOffset.ofHours(2)).toEpochMilli(), Aggregation.SUM, 863400000);

The result is an array having 2 values. This is different from running the same TS.RANGE command directly via redis which will produce only a single data value.

Below screenshot shows values in intelij 84792605-561f6300-aff4-11ea-8546-b889f08499f0

result in redisinsight 84792754-8b2bb580-aff4-11ea-8874-0ca683365db4

Sample repo having : JRedisTimeSeriesUserDepositTest class replicating issue above .

https://github.com/borgrodrick/JRedisTimeSeries.git

gkorland commented 4 years ago

I ran the Java test and from redis-cli and got the same results.

24hrs Key: deposit Value: 6.0
24hrs Key: deposit Value: 17.0
Daily sum is : 23.0
JedisPool: Active=0, Idle=0, Waiters=0, total=0, maxTotal=100, minIdle=8, maxIdle=0
1) 1) (integer) 1592179200000
   2) 6
2) 1) (integer) 1592265600000
   2) 17
127.0.0.1:6379> 

I suggest you run the following while running the java test to see that is sent to the server.

redis-cli monitor