Skip to content

Commit 0d0bdfe

Browse files
authored
Merge pull request #2694 from mabel-dev/prefilter-renamed-prune,-stats-added
pruned blob statisitics
2 parents cd2db7a + 97bb362 commit 0d0bdfe

4 files changed

Lines changed: 9 additions & 4 deletions

File tree

opteryx/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__build__ = 1381
1+
__build__ = 1382
22

33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

opteryx/connectors/capabilities/statistics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def read_blob_statistics(
4444
self.stats_cache.set(key, cached_stats)
4545
return cached_stats
4646

47-
def prefilter_blobs(self, blob_names: list[str], query_statistics, selection) -> list[str]:
47+
def prune_blobs(self, blob_names: list[str], query_statistics, selection) -> list[str]:
4848
new_blob_names = []
4949

5050
for blob_name in blob_names:

opteryx/models/query_statistics.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ def as_dict(self):
4242
"""
4343
Return statistics as a dictionary
4444
"""
45+
import opteryx
46+
4547
stats_dict = dict(self._stats)
4648
for k, v in stats_dict.items():
4749
# times are recorded in ns but reported in seconds
@@ -53,6 +55,7 @@ def as_dict(self):
5355
# sort the keys in the dictionary
5456
stats_dict = {key: stats_dict[key] for key in sorted(stats_dict)}
5557
# put messages and executed_plan at the end
58+
stats_dict["version"] = opteryx.__version__
5659
stats_dict["messages"] = stats_dict.pop("messages", [])
5760
stats_dict["executed_plan"] = stats_dict.pop("executed_plan", None)
5861
return stats_dict

opteryx/operators/async_read_node.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,13 @@ def execute(self, morsel, **kwargs) -> Generator:
106106
predicates=self.predicates,
107107
)
108108

109-
if self.predicates and hasattr(reader, "prefilter_blobs"):
109+
if self.predicates and hasattr(reader, "prune_blobs"):
110110
# if we're capturing statistics, we can prefilter the blobs
111-
blob_names = reader.prefilter_blobs(
111+
start = time.monotonic_ns()
112+
blob_names = reader.prune_blobs(
112113
blob_names=blob_names, query_statistics=self.statistics, selection=self.predicates
113114
)
115+
self.statistics.time_pruning_blobs += time.monotonic_ns() - start
114116

115117
if len(blob_names) == 0:
116118
# if we don't have any matching blobs, create an empty dataset

0 commit comments

Comments
 (0)