Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis::TimeSeries.madd fails when multiple keys are provided #71

Closed
fcbm opened this issue Feb 25, 2022 · 1 comment · Fixed by #77
Closed

Redis::TimeSeries.madd fails when multiple keys are provided #71

fcbm opened this issue Feb 25, 2022 · 1 comment · Fixed by #77
Labels
bug Something isn't working
Milestone

Comments

@fcbm
Copy link

fcbm commented Feb 25, 2022

Steps to reproduce the issue:

$ docker run --network host --name redis -it -d --rm redislabs/redistimeseries:latest
$ docker exec -it redis redis-cli
127.0.0.1:6379> ts.create foo
OK
127.0.0.1:6379> ts.create bar
OK
$ docker run --rm --name ruby -it  --network host ruby:3-alpine /bin/sh
/ # gem install redis redis-time-series
Fetching redis-4.6.0.gem
Successfully installed redis-4.6.0
Fetching redis-time-series-0.7.0.gem
Successfully installed redis-time-series-0.7.0
2 gems installed
/ # irb
irb(main):001:0> require 'redis'
=> true
irb(main):002:0> require 'redis-time-series'
=> true
irb(main):003:0> Redis::TimeSeries.madd(foo: { 1 => 1234 }, bar: { 2 => 2345 })
`Redis.current=` is deprecated and will be removed in 5.0. (called from: /usr/local/bundle/gems/redis-time-series-0.7.0/lib/redis/time_series/client.rb:47:in `redis')
/usr/local/bundle/gems/redis-time-series-0.7.0/lib/redis/time_series/sample.rb:19:in `BigDecimal': can't convert nil into BigDecimal (TypeError)
        from /usr/local/bundle/gems/redis-time-series-0.7.0/lib/redis/time_series/sample.rb:19:in `initialize'
        from /usr/local/bundle/gems/redis-time-series-0.7.0/lib/redis/time_series.rb:115:in `new'
        from /usr/local/bundle/gems/redis-time-series-0.7.0/lib/redis/time_series.rb:115:in `block (2 levels) in madd'
        from /usr/local/bundle/gems/redis-time-series-0.7.0/lib/redis/time_series.rb:114:in `each'
        from /usr/local/bundle/gems/redis-time-series-0.7.0/lib/redis/time_series.rb:114:in `each_with_index'
        from /usr/local/bundle/gems/redis-time-series-0.7.0/lib/redis/time_series.rb:114:in `each'
        from /usr/local/bundle/gems/redis-time-series-0.7.0/lib/redis/time_series.rb:114:in `map'
        from /usr/local/bundle/gems/redis-time-series-0.7.0/lib/redis/time_series.rb:114:in `block in madd'
        from <internal:kernel>:124:in `then'
        from /usr/local/bundle/gems/redis-time-series-0.7.0/lib/redis/time_series.rb:113:in `madd'
        from (irb):3:in `<main>'
        from /usr/local/lib/ruby/gems/3.1.0/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
        from /usr/local/bin/irb:25:in `load'
        from /usr/local/bin/irb:25:in `<main>'

The time series are updated, the error seems to be thrown when reply from redis is decoded

127.0.0.1:6379> ts.range foo - +
1) 1) (integer) 1
   2) 1234
127.0.0.1:6379> ts.range bar - +
1) 1) (integer) 2
   2) 2345

The same issue happens when issuing madd with multiple keys and timestamp/value pairs:

Redis::TimeSeries.madd(foo: { 1 => 1234, 10 => 12340 }, bar: { 2 => 2345, 20 => 23450 })
@dzunk dzunk added this to the 0.7.1 milestone Feb 28, 2022
@dzunk dzunk added the bug Something isn't working label Feb 28, 2022
@dzunk dzunk modified the milestones: 0.7.1, 0.7.2 Jul 21, 2022
@dzunk dzunk closed this as completed in #77 Jul 26, 2022
@dzunk
Copy link
Owner

dzunk commented Jul 26, 2022

Fix released in version 0.7.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants