@@ -454,37 +454,39 @@ def test_indexer_get_rows_index_sharded_with_parquet_metadata(
454454 assert metadata_path .exists ()
455455
456456
457- def test_rows_index_query_with_parquet_metadata (
457+ @pytest .mark .asyncio
458+ async def test_rows_index_query_with_parquet_metadata (
458459 rows_index_with_parquet_metadata : RowsIndex , ds_sharded : Dataset
459460) -> None :
460461 assert isinstance (rows_index_with_parquet_metadata .parquet_index , ParquetIndexWithMetadata )
461462 assert not hasattr (rows_index_with_parquet_metadata , "viewer_index" )
462- result , _ = rows_index_with_parquet_metadata .query_parquet_index (offset = 1 , length = 3 )
463+ result , _ = await rows_index_with_parquet_metadata .query_parquet_index (offset = 1 , length = 3 )
463464 assert result .to_pydict () == ds_sharded [1 :4 ]
464465
465- result , _ = rows_index_with_parquet_metadata .query_parquet_index (offset = 1 , length = - 1 )
466+ result , _ = await rows_index_with_parquet_metadata .query_parquet_index (offset = 1 , length = - 1 )
466467 assert result .to_pydict () == ds_sharded [:0 ]
467468
468- result , _ = rows_index_with_parquet_metadata .query_parquet_index (offset = 1 , length = 0 )
469+ result , _ = await rows_index_with_parquet_metadata .query_parquet_index (offset = 1 , length = 0 )
469470 assert result .to_pydict () == ds_sharded [:0 ]
470471
471- result , _ = rows_index_with_parquet_metadata .query_parquet_index (offset = 999999 , length = 1 )
472+ result , _ = await rows_index_with_parquet_metadata .query_parquet_index (offset = 999999 , length = 1 )
472473 assert result .to_pydict () == ds_sharded [:0 ]
473474
474- result , _ = rows_index_with_parquet_metadata .query_parquet_index (offset = 1 , length = 99999999 )
475+ result , _ = await rows_index_with_parquet_metadata .query_parquet_index (offset = 1 , length = 99999999 )
475476 assert result .to_pydict () == ds_sharded [1 :]
476477
477478 with pytest .raises (IndexError ):
478- rows_index_with_parquet_metadata .query_parquet_index (offset = - 1 , length = 2 )
479+ await rows_index_with_parquet_metadata .query_parquet_index (offset = - 1 , length = 2 )
479480
480481 # test that the other query() calls query_parquet_index() rather than query_libviewer_index()
481- result , _ = rows_index_with_parquet_metadata .query (offset = 1 , length = 3 )
482+ result , _ = await rows_index_with_parquet_metadata .query (offset = 1 , length = 3 )
482483 assert result .to_pydict () == ds_sharded [1 :4 ]
483484 with pytest .raises (AttributeError ):
484- rows_index_with_parquet_metadata .query_libviewer_index (offset = 1 , length = 3 )
485+ await rows_index_with_parquet_metadata .query_libviewer_index (offset = 1 , length = 3 )
485486
486487
487- def test_rows_index_query_with_parquet_metadata_libviewer (
488+ @pytest .mark .asyncio
489+ async def test_rows_index_query_with_parquet_metadata_libviewer (
488490 ds_sharded : Dataset ,
489491 ds_sharded_fs : AbstractFileSystem ,
490492 dataset_sharded_with_config_parquet_metadata : dict [str , Any ],
@@ -508,27 +510,28 @@ def test_rows_index_query_with_parquet_metadata_libviewer(
508510
509511 assert isinstance (rows_index_with_parquet_metadata .viewer_index , lv .Dataset )
510512 assert not hasattr (rows_index_with_parquet_metadata , "parquet_index" )
511- result , _truncated_cols = rows_index_with_parquet_metadata .query_libviewer_index (offset = 1 , length = 3 )
513+ result , _truncated_cols = await rows_index_with_parquet_metadata .query_libviewer_index (offset = 1 , length = 3 )
512514 assert result .to_pydict () == ds_sharded [1 :4 ]
513- result , _truncated_cols = rows_index_with_parquet_metadata .query_libviewer_index (offset = 1 , length = 0 )
515+ result , _truncated_cols = await rows_index_with_parquet_metadata .query_libviewer_index (offset = 1 , length = 0 )
514516 assert result .to_pydict () == ds_sharded [:0 ]
515- result , _truncated_cols = rows_index_with_parquet_metadata .query_libviewer_index (offset = 999999 , length = 1 )
517+ result , _truncated_cols = await rows_index_with_parquet_metadata .query_libviewer_index (offset = 999999 , length = 1 )
516518 assert result .to_pydict () == ds_sharded [:0 ]
517- result , _truncated_cols = rows_index_with_parquet_metadata .query_libviewer_index (offset = 1 , length = 99999999 )
519+ result , _truncated_cols = await rows_index_with_parquet_metadata .query_libviewer_index (offset = 1 , length = 99999999 )
518520 assert result .to_pydict () == ds_sharded [1 :]
519521 with pytest .raises (IndexError ):
520- rows_index_with_parquet_metadata .query_libviewer_index (offset = 0 , length = - 1 )
522+ await rows_index_with_parquet_metadata .query_libviewer_index (offset = 0 , length = - 1 )
521523 with pytest .raises (IndexError ):
522- rows_index_with_parquet_metadata .query_libviewer_index (offset = - 1 , length = 2 )
524+ await rows_index_with_parquet_metadata .query_libviewer_index (offset = - 1 , length = 2 )
523525
524526 # test that the other query() calls query_libviewer_index() rather than query_parquet_index()
525- result , _ = rows_index_with_parquet_metadata .query (offset = 1 , length = 3 )
527+ result , _ = await rows_index_with_parquet_metadata .query (offset = 1 , length = 3 )
526528 assert result .to_pydict () == ds_sharded [1 :4 ]
527529 with pytest .raises (AttributeError ):
528- rows_index_with_parquet_metadata .query_parquet_index (offset = 1 , length = 3 )
530+ await rows_index_with_parquet_metadata .query_parquet_index (offset = 1 , length = 3 )
529531
530532
531- def test_rows_index_query_with_too_big_rows (
533+ @pytest .mark .asyncio
534+ async def test_rows_index_query_with_too_big_rows (
532535 parquet_metadata_directory : StrPath ,
533536 ds_sharded : Dataset ,
534537 ds_sharded_fs : AbstractFileSystem ,
@@ -546,7 +549,7 @@ def test_rows_index_query_with_too_big_rows(
546549 )
547550
548551 with pytest .raises (TooBigRows ):
549- index .query_parquet_index (offset = 0 , length = 3 )
552+ await index .query_parquet_index (offset = 0 , length = 3 )
550553
551554 with patch ("libcommon.parquet_utils.libviewer_config" , LibviewerConfig (enable_for_datasets = True )):
552555 index = RowsIndex (
@@ -563,10 +566,11 @@ def test_rows_index_query_with_too_big_rows(
563566
564567 # test the same with page pruning API
565568 with pytest .raises (TooBigRows ):
566- index .query_libviewer_index (offset = 0 , length = 2 )
569+ await index .query_libviewer_index (offset = 0 , length = 2 )
567570
568571
569- def test_rows_index_query_with_empty_dataset (
572+ @pytest .mark .asyncio
573+ async def test_rows_index_query_with_empty_dataset (
570574 ds_empty : Dataset ,
571575 ds_empty_fs : AbstractFileSystem ,
572576 dataset_empty_with_config_parquet_metadata : dict [str , Any ],
@@ -585,10 +589,10 @@ def test_rows_index_query_with_empty_dataset(
585589
586590 assert isinstance (index .parquet_index , ParquetIndexWithMetadata )
587591 assert not hasattr (index , "viewer_index" )
588- result , _ = index .query_parquet_index (offset = 0 , length = 1 )
592+ result , _ = await index .query_parquet_index (offset = 0 , length = 1 )
589593 assert result .to_pydict () == ds_empty [:0 ]
590594 with pytest .raises (IndexError ):
591- index .query_parquet_index (offset = - 1 , length = 2 )
595+ await index .query_parquet_index (offset = - 1 , length = 2 )
592596
593597 # test the same with page pruning API
594598 import libviewer as lv
@@ -608,13 +612,14 @@ def test_rows_index_query_with_empty_dataset(
608612
609613 assert isinstance (index .viewer_index , lv .Dataset )
610614 assert not hasattr (index , "parquet_index" )
611- result , _ = index .query_libviewer_index (offset = 0 , length = 1 )
615+ result , _ = await index .query_libviewer_index (offset = 0 , length = 1 )
612616 assert result .to_pydict () == ds_empty [:0 ]
613617 with pytest .raises (IndexError ):
614- index .query_libviewer_index (offset = - 1 , length = 2 )
618+ await index .query_libviewer_index (offset = - 1 , length = 2 )
615619
616620
617- def test_indexer_schema_mistmatch_error (
621+ @pytest .mark .asyncio
622+ async def test_indexer_schema_mistmatch_error (
618623 ds_sharded_fs : AbstractFileSystem ,
619624 ds_sharded_fs_with_different_schema : AbstractFileSystem ,
620625 dataset_sharded_with_config_parquet_metadata : dict [str , Any ],
@@ -632,7 +637,7 @@ def test_indexer_schema_mistmatch_error(
632637 max_arrow_data_in_memory = 9999999999 ,
633638 )
634639 with pytest .raises (SchemaMismatchError ):
635- index .query_parquet_index (offset = 0 , length = 3 )
640+ await index .query_parquet_index (offset = 0 , length = 3 )
636641
637642
638643@pytest .mark .parametrize (
0 commit comments