@@ -288,6 +288,92 @@ def time_streamset_arrow_aligned_windows_values(
288
288
return results
289
289
290
290
291
+ def time_streamset_arrow_multistream_raw_values_non_timesnapped (
292
+ streamset : btrdb .stream .StreamSet ,
293
+ start : int ,
294
+ end : int ,
295
+ version : int = 0 ,
296
+ sampling_frequency : int = None ,
297
+ ) -> Dict [str , Union [str , int , float ]]:
298
+ """Use the arrow multistream endpoint that joins the stream data on-server before sending to the client.
299
+
300
+ We make sure to set a sampling rate of 0 to ensure that we do not time snap and just perform a full-outer join on
301
+ the streams.
302
+
303
+ Parameters
304
+ ----------
305
+ streamset : btrdb.stream.StreamSet, required
306
+ The streamset to perform the multistream query on.
307
+ start : int, required
308
+ The start time (in nanoseconds) to query raw data from.
309
+ end : int, required
310
+ The end time (in nanoseconds) non-exclusive, to query raw data from.
311
+ version : int, optional, default=0
312
+ The version of the stream to pin against, currently this is unused.
313
+ sampling_frequency : int, optional, ignored
314
+ The sampling frequency of the data stream in Hz
315
+
316
+ Notes
317
+ -----
318
+ Sampling_frequency is not used here, it will be manually set.
319
+ """
320
+ streamset = streamset .filter (start = start , end = end , sampling_frequency = 0 )
321
+ versions = {s .uuid : 0 for s in streamset }
322
+ streamset = streamset .pin_versions (versions )
323
+ tic = perf_counter ()
324
+ vals = streamset .arrow_values ()
325
+ toc = perf_counter ()
326
+ queried_points = vals .num_rows * len (streamset )
327
+ # print(vals)
328
+ # print(vals.to_pandas().describe())
329
+ run_time = toc - tic
330
+ results = _create_streamset_result_dict (
331
+ streamset = streamset , total_time = run_time , point_count = queried_points , version = 0
332
+ )
333
+ return results
334
+
335
+
336
+ def time_streamset_arrow_multistream_raw_values_timesnapped (
337
+ streamset : btrdb .stream .StreamSet ,
338
+ start : int ,
339
+ end : int ,
340
+ sampling_frequency : int ,
341
+ version : int = 0 ,
342
+ ) -> Dict [str , Union [str , int , float ]]:
343
+ """Use the arrow multistream endpoint that joins the stream data on-server before sending to the client.
344
+
345
+ We make sure to set a sampling rate to ensure that we time snap the returned data.
346
+
347
+ Parameters
348
+ ----------
349
+ streamset : btrdb.stream.StreamSet, required
350
+ The streamset to perform the multistream query on.
351
+ start : int, required
352
+ The start time (in nanoseconds) to query raw data from.
353
+ end : int, required
354
+ The end time (in nanoseconds) non-exclusive, to query raw data from.
355
+ sampling_frequency : int, required
356
+ The common sampling frequency (in Hz) of the data to snap the data points to.
357
+ version : int, optional, default=0
358
+ The version of the stream to pin against, currently this is unused.
359
+ """
360
+ streamset = streamset .filter (
361
+ start = start , end = end , sampling_frequency = sampling_frequency
362
+ )
363
+ versions = {s .uuid : 0 for s in streamset }
364
+ streamset = streamset .pin_versions (versions )
365
+ tic = perf_counter ()
366
+ vals = streamset .arrow_values ()
367
+ toc = perf_counter ()
368
+ queried_points = vals .num_rows * len (streamset )
369
+ # print(vals)
370
+ run_time = toc - tic
371
+ results = _create_streamset_result_dict (
372
+ streamset = streamset , total_time = run_time , point_count = queried_points , version = 0
373
+ )
374
+ return results
375
+
376
+
291
377
def _create_streamset_result_dict (
292
378
streamset : btrdb .stream .StreamSet ,
293
379
point_count : int ,
@@ -337,6 +423,13 @@ def main():
337
423
res = f (streamset , start , end , pointwidth = pointwidth , version = 0 )
338
424
res ["func" ] = f .__name__
339
425
res_list .append (res )
426
+ for f in [
427
+ time_streamset_arrow_multistream_raw_values_non_timesnapped ,
428
+ time_streamset_arrow_multistream_raw_values_timesnapped ,
429
+ ]:
430
+ res = f (streamset , start , end , sampling_frequency = 2 , version = 0 )
431
+ res ["func" ] = f .__name__
432
+ res_list .append (res )
340
433
341
434
return res_list
342
435
0 commit comments