diff options
author | dvora-h <67596500+dvora-h@users.noreply.github.com> | 2022-08-02 17:45:14 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-02 17:45:14 +0300 |
commit | fcc0c4114a7142ba58daed0cdafbbbaefe1680a6 (patch) | |
tree | 9e4ca1ba8b630f24717f4c21373f15e47a6d5885 /redis/commands | |
parent | 19cedab73a9b7d8e6af2753a1206e79c50ee2d37 (diff) | |
download | redis-py-fcc0c4114a7142ba58daed0cdafbbbaefe1680a6.tar.gz |
Support TDIGEST.MERGESTORE and make compression optional on TDIGEST.CREATE (#2319)
* support 2.4
* async test
* skip tests
* linters
Diffstat (limited to 'redis/commands')
-rw-r--r-- | redis/commands/bf/commands.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/redis/commands/bf/commands.py b/redis/commands/bf/commands.py index 7d36b93..84a6b5f 100644 --- a/redis/commands/bf/commands.py +++ b/redis/commands/bf/commands.py @@ -49,6 +49,7 @@ TDIGEST_QUANTILE = "TDIGEST.QUANTILE" TDIGEST_MIN = "TDIGEST.MIN" TDIGEST_MAX = "TDIGEST.MAX" TDIGEST_INFO = "TDIGEST.INFO" +TDIGEST_MERGESTORE = "TDIGEST.MERGESTORE" class BFCommands: @@ -344,7 +345,7 @@ class TOPKCommands: class TDigestCommands: - def create(self, key, compression): + def create(self, key, compression=100): """ Allocate the memory and initialize the t-digest. For more information see `TDIGEST.CREATE <https://redis.io/commands/tdigest.create>`_. @@ -417,6 +418,19 @@ class TDigestCommands: """ # noqa return self.execute_command(TDIGEST_INFO, key) + def mergestore(self, dest_key, numkeys, *sourcekeys, compression=False): + """ + Merges all of the values from `sourcekeys` keys to `dest_key` sketch. + If destination already exists, it is overwritten. + + + For more information see `TDIGEST.MERGESTORE <https://redis.io/commands/tdigest.mergestore>`_. + """ # noqa + params = [dest_key, numkeys, *sourcekeys] + if compression: + params.extend(["COMPRESSION", compression]) + return self.execute_command(TDIGEST_MERGESTORE, *params) + class CMSCommands: """Count-Min Sketch Commands""" |