spark-redis icon indicating copy to clipboard operation
spark-redis copied to clipboard

Support for PFADD , PFCOUNT

Open justinrmiller opened this issue 6 years ago • 10 comments

Support for PFADD , PFCOUNT from spark - This is the work of @nirmalc, I've simply created a new branch, fixed a few tests, and provided an easier to merge branch off of master.

justinrmiller avatar Apr 17 '19 08:04 justinrmiller

Thanks @justinrmiller

nirmalc avatar Apr 17 '19 12:04 nirmalc

Hi Justin, Thanks for the PR! Some unit tests failing on Travis, could you please take a look?

fe2s avatar Apr 17 '19 14:04 fe2s

@fe2s Looking at the errors in Travis, I'm not sure those are caused by this change. Did I miss something in the review?

The following appear to be failing, but I didn't alter them:

  • RedisKVRDD *** FAILED ***
  • groupKeysByNode

justinrmiller avatar Apr 18 '19 15:04 justinrmiller

@justinrmiller

The issue is that HLL datastructure is implemented in Redis as a String:

127.0.0.1:6379> PFADD hll-test a a b
(integer) 1
127.0.0.1:6379> type hll-test
string
127.0.0.1:6379> get hll-test
"HYLL\x01\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00q\xa6\x84K\xfb\x80BZ"

RedisKVRDD reads all KVs (strings) from a database (using pattern *). Since extra HLL strings are inserted in beforeAll() method, the actual number of strings doesn't match the expected number. I think it can be fixed by writing word count strings (sc.toRedisKV(wcnts)) with a prefix and also prefix HLL keys, so we can read them separately.

fe2s avatar Apr 18 '19 19:04 fe2s

@fe2s ahh that makes sense, OK let me try to get that going when I get home. Thanks!

justinrmiller avatar Apr 18 '19 20:04 justinrmiller

Ok I think that should take care of the tests, I did notice some exceptions getting thrown but I've seen those exceptions thrown in other PRs so I'm not sure if that's something introduced by this PR. Is there any documentation on setting up the test environment? I kind of had to piece one together locally.

justinrmiller avatar Apr 19 '19 03:04 justinrmiller

@justinrmiller to run all the tests just execute make test in terminal If you'd like to debug individual test in IDE you can start redis test instances with make start and then run any test from IDE. There are tests that throw exceptions intentionally, those are intercepted and shouldn't result in failing tests. I will add a page to the documentation with some details how to setup a dev environment and run tests.

fe2s avatar Apr 20 '19 13:04 fe2s

Ah yeah I was just running mike test. I'll try running make start to get the Redis instances going next time.

justinrmiller avatar Apr 21 '19 02:04 justinrmiller

Hi @justinrmiller,

Would you have some time to address the review comments? If not, I can take over from here if you'd like.

fe2s avatar Jun 13 '19 07:06 fe2s

My wife and I just finished moving back to LA. I should be able to take a look at it over the next few days. Thanks.

justinrmiller avatar Jun 13 '19 14:06 justinrmiller