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

Fix Array.consolidate keyword forwarding order #344

Merged
merged 1 commit into from
Jun 19, 2020
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
16 changes: 8 additions & 8 deletions tiledb/libtiledb.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3887,7 +3887,7 @@ cdef class Array(object):
"""
if self.mode == 'r':
raise TileDBError("cannot consolidate array opened in readonly mode (mode='r')")
return consolidate(self.ctx, config, uri=self.uri, key=key)
return consolidate(uri=self.uri, key=key, config=config, ctx=self.ctx)

def dump(self):
self.schema.dump()
Expand Down Expand Up @@ -4821,17 +4821,17 @@ cdef class SparseArrayImpl(Array):

return out

def consolidate(uri=None, Config config=None, key=None, Ctx ctx=None):
"""Consolidates a TileDB Array updates for improved read performance
def consolidate(uri, key=None, Config config=None, Ctx ctx=None):
"""Consolidates TileDB array fragments for improved read performance

:param tiledb.Config config: The TileDB Config with consolidation parameters set
:param str uri: URI to the TileDB Array
:param str: (default None) Key to decrypt array if the array is encrypted
:param str key: (default None) Key to decrypt array if the array is encrypted
:param tiledb.Config config: The TileDB Config with consolidation parameters set
:param tiledb.Ctx ctx: (default None) The TileDB Context
:rtype: str or bytes
:return: path (URI) to the consolidated TileDB Array
:raises TypeError: cannot convert path to unicode string
:raises: :py:exc:`tiledb.TileDBError`
:param tiledb.Ctx ctx: The TileDB Context

"""
if not ctx:
Expand All @@ -4842,7 +4842,7 @@ def consolidate(uri=None, Config config=None, key=None, Ctx ctx=None):
config_ptr = config.ptr
cdef bytes buri = unicode_path(uri)
cdef const char* uri_ptr = PyBytes_AS_STRING(buri)
# encyrption key
# encryption key
cdef:
bytes bkey
tiledb_encryption_type_t key_type = TILEDB_NO_ENCRYPTION
Expand Down Expand Up @@ -5779,7 +5779,7 @@ class FileIO(io.RawIOBase):

def vacuum(array_uri, Config config=None, Ctx ctx=None):
"""
Remove consolidated fragments. After consolidation, you may optionally
Remove fragments. After consolidation, you may optionally
remove the consolidated fragments with the "vacuum" step. This operation
of this function is controlled by the `sm.vacuum.mode` parameter, which
accepts the values `fragments`, `fragment_meta`, and `array_meta`.
Expand Down
11 changes: 10 additions & 1 deletion tiledb/tests/test_libtiledb.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ def test_array_create_encrypted(self):

# check that consolidating the array with the wrong key fails:
with self.assertRaises(tiledb.TileDBError):
tiledb.consolidate(self.path("foo"), config,
tiledb.consolidate(self.path("foo"), config=config,
key=b"0123456789abcdeF0123456789abcde", ctx=ctx)

def test_array_doesnt_exist(self):
Expand Down Expand Up @@ -2796,6 +2796,15 @@ def write_fragments(target_path):

self.assertEqual(len(paths), 3 + 2 * num_writes + 1)

path3 = self.path("test_array_vacuum2")
create_array(path3)
write_fragments(path3)
conf = tiledb.Config({'sm.consolidation.mode': 'fragment_meta'})
with tiledb.open(path3, 'w') as A:
A.consolidate(config=conf)

paths = vfs.ls(path2)

class RegTests(DiskTestCase):
def test_tiledb_py_0_6_anon_attr(self):
# Test that anonymous attributes internally stored as "__attr" are presented as ""
Expand Down