Skip to content

Instantly share code, notes, and snippets.

@nenorbot
Last active April 26, 2020 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nenorbot/e89fd835b57b707e7053c455003c61f1 to your computer and use it in GitHub Desktop.
Save nenorbot/e89fd835b57b707e7053c455003c61f1 to your computer and use it in GitHub Desktop.
def scan_leaf(leaf):
rowkey_prefix = leaf.app_id + '|' + leaf.event_date + '|' + leaf.event_type
filters = get_scan_filters(leaf.event_attributes)
scan_request = new_hbase_scan(table = 'events')
scan_request.set_rowkey_prefix(rowkey_prefix)
scan_request.set_filters(filters)
rows_result_set = scan_request.scan()
return rows_result_set
def get_sketch_for_leaf(leaf):
result_set = scan_leaf(leaf)
result_sketch = new_empty_sketch()
for row in result_set:
result_sketch = result_sketch.union(row.users_sketch)
return result_sketch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment