@@ -40,17 +40,21 @@ def __init__(
4040 self .ctx = Ctx (config )
4141 self .group = tiledb .Group (self .uri , "r" , ctx = tiledb .Ctx (config ))
4242 self .storage_version = self .group .meta .get ("storage_version" , "0.1" )
43+ if not storage_formats [self .storage_version ]["SUPPORT_TIMETRAVEL" ] and timestamp is not None :
44+ raise ValueError (f"Time traveling is not supported for index storage_version={ self .storage_version } " )
45+
4346 updates_array_name = storage_formats [self .storage_version ][
4447 "UPDATES_ARRAY_NAME"
4548 ]
4649 self .updates_array_uri = f"{ self .group .uri } /{ updates_array_name } "
4750 self .index_version = self .group .meta .get ("index_version" , "" )
48- self .ingestion_timestamps = list (json .loads (self .group .meta .get ("ingestion_timestamps" , "[]" )))
51+ self .ingestion_timestamps = [int (x ) for x in
52+ list (json .loads (self .group .meta .get ("ingestion_timestamps" , "[]" )))]
4953 if len (self .ingestion_timestamps ) > 0 :
5054 self .latest_ingestion_timestamp = self .ingestion_timestamps [len (self .ingestion_timestamps )- 1 ]
5155 else :
5256 self .latest_ingestion_timestamp = MAX_UINT64
53- self .base_sizes = list (json .loads (self .group .meta .get ("base_sizes" , "[]" )))
57+ self .base_sizes = [ int ( x ) for x in list (json .loads (self .group .meta .get ("base_sizes" , "[]" )))]
5458 if len (self .base_sizes ) > 0 :
5559 self .base_size = self .base_sizes [len (self .ingestion_timestamps )- 1 ]
5660 else :
@@ -245,9 +249,12 @@ def get_updates_uri(self):
245249 return self .updates_array_uri
246250
247251 def open_updates_array (self , timestamp : int = None ):
248- if timestamp is not None and timestamp <= self .latest_ingestion_timestamp :
249- raise ValueError (f"Updates at a timestamp before the latest_ingestion_timestamp are not supported. "
250- f"timestamp: { timestamp } , latest_ingestion_timestamp: { self .latest_ingestion_timestamp } " )
252+ if timestamp is not None :
253+ if not storage_formats [self .storage_version ]["SUPPORT_TIMETRAVEL" ]:
254+ raise ValueError (f"Time traveling is not supported for index storage_version={ self .storage_version } " )
255+ if timestamp <= self .latest_ingestion_timestamp :
256+ raise ValueError (f"Updates at a timestamp before the latest_ingestion_timestamp are not supported. "
257+ f"timestamp: { timestamp } , latest_ingestion_timestamp: { self .latest_ingestion_timestamp } " )
251258 if not tiledb .array_exists (self .updates_array_uri ):
252259 updates_array_name = storage_formats [self .storage_version ][
253260 "UPDATES_ARRAY_NAME"
0 commit comments