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/Generalize test added in #2083 #2116

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ if (NOT TileDB_FOUND)
message(STATUS "Downloading TileDB default version ...")
# Download latest release
fetch_prebuilt_tiledb(
VERSION 2.26.2
RELLIST_HASH SHA256=86c19d7c5246cb18e370a4272cead63ea84bd651789842e618de4d57d4510522
VERSION 2.27.0
RELLIST_HASH SHA256=8056514b1949cdab19405376e32e299578491a6d3e953321d12d761f94dc19b9
)
endif()
find_package(TileDB REQUIRED)
Expand Down
17 changes: 11 additions & 6 deletions tiledb/tests/test_schema_evolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,10 @@ def test_schema_evolution_extend_check_bad_type():
reason="Dropping a fixed-sized attribute and adding it back"
"as a var-sized attribute is not supported in TileDB < 2.27",
)
def test_schema_evolution_drop_fixed_attribute_and_add_back_as_var_sized(tmp_path):
@pytest.mark.parametrize("dtype_str", ["S", "U"])
def test_schema_evolution_drop_fixed_attribute_and_add_back_as_var_sized(
tmp_path, dtype_str
):
ctx = tiledb.default_ctx()
uri = str(tmp_path)
attrs = [
Expand All @@ -260,21 +263,23 @@ def test_schema_evolution_drop_fixed_attribute_and_add_back_as_var_sized(tmp_pat
assert A.schema.attr("b").dtype == np.int32

se = tiledb.ArraySchemaEvolution(ctx)
newattr = tiledb.Attr("a", dtype="S", var=True)
newattr = tiledb.Attr("a", dtype=dtype_str, var=True)
se.add_attribute(newattr)
se.array_evolve(uri)

# check schema and data after adding attribute back as a var-sized attribute
with tiledb.open(uri) as A:
assert A.schema.has_attr("a")
assert A.schema.attr("a").dtype == "S"
assert A.schema.attr("a").dtype == dtype_str
assert A.schema.attr("b").dtype == np.int32
# check that each value == b'\x80' (empty byte)
assert_array_equal(A[:]["a"], np.array([b"\x80" for _ in range(10)]))
# check that each value equals to the fill value of "a" attribute
assert_array_equal(A[:]["a"], np.array([newattr.fill] * 10, dtype=dtype_str))
# check that nothing has changed for the "b" attribute
assert_array_equal(A[:]["b"], original_data)

# add new data to the array
new_data = np.array(
["tiledb-string-n.{}".format(i) for i in range(1, 11)], dtype="S"
["tiledb-string-n.{}".format(i) for i in range(1, 11)], dtype=dtype_str
)
with tiledb.open(uri, "w") as A:
A[:] = {"a": new_data, "b": original_data}
Expand Down
Loading