Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Fragment Info API non_empty_domain -> nonempty_domain #553

Merged
merged 1 commit into from
May 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
rather than the the default behavior of resizing buffers and resubmitting to completion.
Usage example: `examples/incomplete_iteration.py`
(along with test in: `test_libtiledb.py:test_incomplete_return`)
* Rename FragmentsInfo to FragmentInfoList [#551](https://github.com/TileDB-Inc/TileDB-Py/pull/551)
* Dataframe creation uses Zstd default compression level (-1) [#552](https://github.com/TileDB-Inc/TileDB-Py/pull/552)
* Rename Fragment Info API's non_empty_domain attribute to nonempty_domain [#553](https://github.com/TileDB-Inc/TileDB-Py/pull/553)

## Bug fixes
* Fixed incorrected error raised in .df[] indexer when pyarrow not installed [#554](https://github.com/TileDB-Inc/TileDB-Py/pull/554)
Expand Down
2 changes: 1 addition & 1 deletion examples/fragment_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def write_array_3():
print("is sparse: {}".format(fragment.sparse))
print("cell num: {}".format(fragment.cell_num))
print("has consolidated metadata: {}".format(fragment.has_consolidated_metadata))
print("non empty domain: {}".format(fragment.non_empty_domain))
print("nonempty domain: {}".format(fragment.nonempty_domain))
print("timestamp range: {}".format(fragment.timestamp_range))
print("number of fragments to vacuum: {}".format(fragment.to_vacuum_num))
print("uri of fragments to vacuum: {}".format(fragment.to_vacuum_uri))
Expand Down
22 changes: 20 additions & 2 deletions tiledb/fragment.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, array_uri, ctx=None):
self.uri = fi.fragment_uri()
self.__nums = fi.fragment_num()
self.version = fi.version()
self.non_empty_domain = fi.get_non_empty_domain(schema)
self.nonempty_domain = fi.get_non_empty_domain(schema)
self.cell_num = fi.cell_num()
self.timestamp_range = fi.timestamp_range()
self.dense = fi.dense()
Expand All @@ -35,6 +35,15 @@ def __init__(self, array_uri, ctx=None):
self.to_vacuum_num = fi.to_vacuum_num()
self.to_vacuum_uri = fi.to_vacuum_uri() if self.to_vacuum_num > 0 else []

@property
def non_empty_domain(self):
warnings.warn(
"FragmentInfoList.non_empty_domain is deprecated; "
"please use FragmentInfoList.nonempty_domain",
DeprecationWarning,
)
return self.nonempty_domain

def __iter__(self):
return FragmentsInfoIterator(self)

Expand Down Expand Up @@ -86,7 +95,7 @@ def __init__(self, fragments: FragmentInfoList, num):
self.num = num
self.uri = fragments.uri[num]
self.version = fragments.version[num]
self.non_empty_domain = fragments.non_empty_domain[num]
self.nonempty_domain = fragments.nonempty_domain[num]
self.cell_num = fragments.cell_num[num]
self.timestamp_range = fragments.timestamp_range[num]
self.dense = fragments.dense[num]
Expand All @@ -101,6 +110,15 @@ def __init__(self, fragments: FragmentInfoList, num):
def __repr__(self):
return pprint.PrettyPrinter().pformat(self.__dict__)

@property
def non_empty_domain(self):
warnings.warn(
"FragmentInfo.non_empty_domain is deprecated; "
"please use FragmentInfo.nonempty_domain",
DeprecationWarning,
)
return self.nonempty_domain


def FragmentsInfo(array_uri, ctx=None):
"""
Expand Down
20 changes: 10 additions & 10 deletions tiledb/tests/test_fragment_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_array_fragments(self):
fragments_info.has_consolidated_metadata, (False, False, False)
)
self.assertEqual(
fragments_info.non_empty_domain, (((0, 0),), ((1, 1),), ((2, 2),))
fragments_info.nonempty_domain, (((0, 0),), ((1, 1),), ((2, 2),))
)
self.assertEqual(fragments_info.sparse, (False, False, False))
self.assertEqual(fragments_info.timestamp_range, ((1, 1), (2, 2), (3, 3)))
Expand All @@ -68,7 +68,7 @@ def test_array_fragments(self):
self.assertEqual(frag.cell_num, 3)
self.assertEqual(frag.dense, True)
self.assertEqual(frag.has_consolidated_metadata, False)
self.assertEqual(frag.non_empty_domain, ((idx, idx),))
self.assertEqual(frag.nonempty_domain, ((idx, idx),))
self.assertEqual(frag.sparse, False)
self.assertEqual(frag.timestamp_range, (idx + 1, idx + 1))

Expand Down Expand Up @@ -112,12 +112,12 @@ def test_array_fragments_var(self):
fragments_info = tiledb.array_fragments(uri)

self.assertEqual(
fragments_info.non_empty_domain,
fragments_info.nonempty_domain,
((("one", "zero"),), (("one", "zero"),), (("one", "zero"),)),
)

for frag in fragments_info:
self.assertEqual(frag.non_empty_domain, (("one", "zero"),))
self.assertEqual(frag.nonempty_domain, (("one", "zero"),))

def test_dense_fragments(self):
fragments = 3
Expand Down Expand Up @@ -253,8 +253,8 @@ def test_sparse_fragments(self):
else:
self.assertEqual(fragment_info.version(), (9, 9, 9))

def test_non_empty_domain(self):
uri = self.path("test_non_empty_domain")
def test_nonempty_domain(self):
uri = self.path("test_nonempty_domain")
ctx = tiledb.default_ctx()
dom = tiledb.Domain(
tiledb.Dim(name="x", ctx=ctx, domain=(1, 4)),
Expand Down Expand Up @@ -313,8 +313,8 @@ def test_non_empty_domain(self):
(((1, 4), (-1.0, 2.0)), ((1, 3), (-1.5, -1.25))),
)

def test_non_empty_domain_date(self):
uri = self.path("test_non_empty_domain")
def test_nonempty_domain_date(self):
uri = self.path("test_nonempty_domain")
ctx = tiledb.default_ctx()
dom = tiledb.Domain(
tiledb.Dim(
Expand Down Expand Up @@ -381,8 +381,8 @@ def test_non_empty_domain_date(self):
),
)

def test_non_empty_domain_strings(self):
uri = self.path("test_non_empty_domain_strings")
def test_nonempty_domain_strings(self):
uri = self.path("test_nonempty_domain_strings")
ctx = tiledb.default_ctx()
dom = tiledb.Domain(
tiledb.Dim(name="x", ctx=ctx, domain=(None, None), dtype=np.bytes_),
Expand Down