MCPcopy Create free account
hub / github.com/BIT-DataLab/LakeBench / get_keys

Method get_keys

join/LSH/datasketch/storage.py:589–610  ·  view source on GitHub ↗

Get all the keys. Note: selecting all keys in Cassandra via "SELECT DISTINCT key FROM table" is bound to time out since all nodes need to be contacted. To avoid this, we paginate through all keys using the TOKEN function. In this way we issue

(self)

Source from the content-addressed store, hash-verified

587 self._execute(statements_and_parameters)
588
589 def get_keys(self):
590 """
591 Get all the keys.
592
593 Note: selecting all keys in Cassandra via "SELECT DISTINCT key FROM table" is bound to
594 time out since all nodes need to be contacted. To avoid this, we paginate through
595 all keys using the TOKEN function. In this way we issue several different queries
596 which alone can not time out.
597
598 :rtype: set[byte|str]
599 :return: the set of all keys
600 """
601 min_token = self.MIN_TOKEN
602 keys = set([])
603 while True:
604 rows = self._session.execute(self._stmt_get_keys, (min_token, self.PAGE_SIZE))
605 if not rows:
606 break
607 for r in rows:
608 keys.add(self._key_decoder(r.key))
609 min_token = r.f_token + 1
610 return keys
611
612 def add_to_select_buffer(self, keys):
613 """

Callers 1

keysMethod · 0.80

Calls 1

addMethod · 0.45

Tested by

no test coverage detected