Skip to content

Commit

Permalink
fix flaky test (#706)
Browse files Browse the repository at this point in the history
  • Loading branch information
changhiskhan authored Mar 20, 2023
1 parent 04a66b7 commit 7688d07
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions python/python/tests/test_vector_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ def run(ds):
q = np.random.randn(768)
project = [None, ["price"], ["vector", "price"], ["vector", "meta", "price"]]
refine = [None, 1, 2]
filters = [None, "price > 50.0"]
test_filters = [None, pc.field("price") > 50.0]
filters = [None, pc.field("price") > 50.0]
times = []

for columns in project:
Expand All @@ -85,7 +84,7 @@ def run(ds):
if c not in expected_columns:
expected_columns.append(c)

for i, filter_ in enumerate(filters):
for filter_ in filters:
for rf in refine:
start = time.time()
rs = ds.to_table(
Expand All @@ -104,11 +103,11 @@ def run(ds):
assert rs.column_names == expected_columns
if filter_ is not None:
inmem = pa.dataset.dataset(rs)
assert len(inmem.to_table(filter=test_filters[i])) == len(rs)
assert len(inmem.to_table(filter=filter_)) == len(rs)
else:
assert len(rs) == 10
scores = rs["score"].to_numpy()
assert (scores.max() - scores.min()) > 1e-6
scores = rs["score"].to_numpy()
assert (scores.max() - scores.min()) > 1e-6
return times


Expand Down

0 comments on commit 7688d07

Please sign in to comment.