Skip to content

Commit

Permalink
fixing random sample (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
fcollman authored Apr 28, 2024
1 parent 38a99d6 commit ad49ac3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions materializationengine/blueprints/client/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,10 @@ def handle_simple_query(
.filter(MaterializedMetadata.table_name == table_name)
.scalar()
)
random_sample = (100.0 * random_sample) / mat_row_count
if random_sample >= mat_row_count:
random_sample = None
else:
random_sample = (100.0 * random_sample) / mat_row_count

qm = QueryManager(
mat_db_name,
Expand Down Expand Up @@ -355,7 +358,10 @@ def handle_complex_query(
.filter(MaterializedMetadata.table_name == data["tables"][0][0])
.scalar()
)
random_sample = (100.0 * random_sample) / mat_row_count
if random_sample >= mat_row_count:
random_sample = None
else:
random_sample = (100.0 * random_sample) / mat_row_count

qm = QueryManager(
db_name,
Expand Down

0 comments on commit ad49ac3

Please sign in to comment.