Skip to content

Commit

Permalink
Update tests to use the new delete_fragments API.
Browse files Browse the repository at this point in the history
  • Loading branch information
teo-tsirpanis committed Apr 23, 2024
1 parent 1fba317 commit d3fd583
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
26 changes: 12 additions & 14 deletions tiledb/tests/test_fragments.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,13 +704,12 @@ def write_fragments(target_path, dshape, num_writes):
if use_timestamps:
assert frags.timestamp_range == ts

with tiledb.open(path, "m") as A:
if use_timestamps:
A.delete_fragments(3, 6)
else:
A.delete_fragments(
frags.timestamp_range[2][0], frags.timestamp_range[5][1]
)
if use_timestamps:
tiledb.Array.delete_fragments(path, 3, 6)
else:
tiledb.Array.delete_fragments(
path, frags.timestamp_range[2][0], frags.timestamp_range[5][1]
)

frags = tiledb.array_fragments(path)
assert len(frags) == 6
Expand Down Expand Up @@ -755,13 +754,12 @@ def test_delete_fragments_with_schema_evolution(self, use_timestamps):
assert_array_equal(A[:]["a1"], ts2_data)
assert_array_equal(A[:]["a2"], ts2_data)

with tiledb.open(path, "m") as A:
if use_timestamps:
A.delete_fragments(2, 2)
else:
A.delete_fragments(
frags.timestamp_range[1][0], frags.timestamp_range[1][1]
)
if use_timestamps:
tiledb.Array.delete_fragments(path, 2, 2)
else:
tiledb.Array.delete_fragments(
path, frags.timestamp_range[1][0], frags.timestamp_range[1][1]
)

frags = tiledb.array_fragments(path)
assert len(frags) == 1
Expand Down
6 changes: 2 additions & 4 deletions tiledb/tests/test_libtiledb.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,10 @@ def write_fragments(target_path, dshape, num_writes):
assert frags.timestamp_range == ts

if use_timestamps:
with tiledb.open(path, "m") as arr:
arr.delete_fragments(3, 6)
tiledb.Array.delete_fragments(path, 3, 6)
else:
timestamps = [t[0] for t in tiledb.array_fragments(path).timestamp_range]
with tiledb.open(path, "m") as arr:
arr.delete_fragments(timestamps[2], timestamps[5])
tiledb.Array.delete_fragments(path, timestamps[2], timestamps[5])

frags = tiledb.array_fragments(path)
assert len(frags) == 6
Expand Down

0 comments on commit d3fd583

Please sign in to comment.