@@ -1536,23 +1536,24 @@ def test_ivf_flat_copy_centroids_uri(tmp_path):
15361536 centroids = np .array ([[1 , 1 , 1 , 1 ], [2 , 2 , 2 , 2 ]], dtype = np .float32 )
15371537 centroids_in_size = centroids .shape [0 ]
15381538 dimensions = centroids .shape [1 ]
1539+ domain = tiledb .Domain (
1540+ * [
1541+ tiledb .Dim (
1542+ name = "rows" ,
1543+ domain = (0 , dimensions - 1 ),
1544+ tile = dimensions ,
1545+ dtype = np .dtype (np .int32 ),
1546+ ),
1547+ tiledb .Dim (
1548+ name = "cols" ,
1549+ domain = (0 , np .iinfo (np .dtype ("int32" )).max ),
1550+ tile = 100000 ,
1551+ dtype = np .dtype (np .int32 ),
1552+ ),
1553+ ]
1554+ )
15391555 schema = tiledb .ArraySchema (
1540- domain = tiledb .Domain (
1541- * [
1542- tiledb .Dim (
1543- name = "rows" ,
1544- domain = (0 , dimensions - 1 ),
1545- tile = dimensions ,
1546- dtype = np .dtype (np .int32 ),
1547- ),
1548- tiledb .Dim (
1549- name = "cols" ,
1550- domain = (0 , np .iinfo (np .dtype ("int32" )).max ),
1551- tile = 100000 ,
1552- dtype = np .dtype (np .int32 ),
1553- ),
1554- ]
1555- ),
1556+ domain = domain ,
15561557 sparse = False ,
15571558 attrs = [
15581559 tiledb .Attr (
@@ -1570,6 +1571,17 @@ def test_ivf_flat_copy_centroids_uri(tmp_path):
15701571 with tiledb .open (centroids_uri , mode = "w" , timestamp = index_timestamp ) as A :
15711572 A [0 :dimensions , 0 :centroids_in_size ] = centroids .transpose ()
15721573
1574+ ctx = tiledb .Ctx ()
1575+ ndrect = tiledb .NDRectangle (ctx , domain )
1576+ range_one = (0 , 1 )
1577+ range_two = (0 , 2 )
1578+ ndrect .set_range (0 , range_one [0 ], range_one [1 ])
1579+ ndrect .set_range (1 , range_two [0 ], range_two [1 ])
1580+
1581+ current_domain = tiledb .CurrentDomain (ctx )
1582+ current_domain .set_ndrectangle (ndrect )
1583+ A .schema .set_current_domain (current_domain )
1584+
15731585 # Create the index.
15741586 index_uri = os .path .join (tmp_path , "array" )
15751587 index = ingest (
@@ -2010,3 +2022,83 @@ def test_ivf_flat_taskgraph_query(tmp_path):
20102022 queries , k = k , nprobe = nprobe , nthreads = 8 , mode = Mode .LOCAL , num_partitions = 10
20112023 )
20122024 assert accuracy (result , gt_i ) > MINIMUM_ACCURACY
2025+
2026+
2027+ # def test_ingestion_current_domain(tmp_path):
2028+ # # ################################################################################################
2029+ # # # First set up the data.
2030+ # # ################################################################################################
2031+ # # data = np.array(
2032+ # # [
2033+ # # [1.0, 1.1, 1.2, 1.3],
2034+ # # [2.0, 2.1, 2.2, 2.3],
2035+ # # [3.0, 3.1, 3.2, 3.3],
2036+ # # [4.0, 4.1, 4.2, 4.3],
2037+ # # [5.0, 5.1, 5.2, 5.3],
2038+ # # ],
2039+ # # dtype=np.float32,
2040+ # # )
2041+ # # training_data = data[1:3]
2042+
2043+ # # ################################################################################################
2044+ # # # Test we can ingest, query, update, and consolidate.
2045+ # # ################################################################################################
2046+ # # index_uri = os.path.join(tmp_path, "array")
2047+ # # index = ingest(
2048+ # # index_type="IVF_FLAT",
2049+ # # index_uri=index_uri,
2050+ # # input_vectors=data,
2051+ # # training_input_vectors=training_data,
2052+ # # )
2053+
2054+ # # ======
2055+
2056+ # dimensions = 128
2057+ # schema = tiledb.ArraySchema(
2058+ # domain=tiledb.Domain(
2059+ # *[
2060+ # tiledb.Dim(
2061+ # name="rows",
2062+ # domain=(0, dimensions - 1),
2063+ # tile=dimensions,
2064+ # dtype=np.dtype(np.int32),
2065+ # ),
2066+ # tiledb.Dim(
2067+ # name="cols",
2068+ # domain=(0, np.iinfo(np.dtype("int32")).max),
2069+ # tile=100000,
2070+ # dtype=np.dtype(np.int32),
2071+ # ),
2072+ # ]
2073+ # ),
2074+ # sparse=False,
2075+ # attrs=[
2076+ # tiledb.Attr(
2077+ # name="attr",
2078+ # dtype="float32",
2079+ # filters=tiledb.FilterList([tiledb.ZstdFilter()]),
2080+ # )
2081+ # ],
2082+ # cell_order="col-major",
2083+ # tile_order="col-major",
2084+ # )
2085+ # uri = os.path.join(tmp_path, "array")
2086+ # tiledb.Array.create(uri, schema)
2087+
2088+ # index_timestamp = int(time.time() * 1000)
2089+ # with tiledb.open(uri, mode="w", timestamp=index_timestamp) as A:
2090+ # A[0:dimensions, 0:dimensions] = np.random.rand(dimensions, dimensions).astype(
2091+ # np.float32
2092+ # )
2093+
2094+ # data = np.random.rand(1000, dimensions).astype(np.float32)
2095+
2096+ # # Create the index.
2097+ # index_uri = os.path.join(tmp_path, "array")
2098+ # index = ingest(
2099+ # index_type="IVF_FLAT",
2100+ # index_uri=index_uri,
2101+ # input_vectors=data,
2102+ # copy_centroids_uri=uri,
2103+ # partitions=centroids_in_size,
2104+ # )
0 commit comments