-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4b2e63b
commit da0a69c
Showing
4 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
abfs://hipscat/pytests/hipscat_import/data/small_sky_parts/catalog_00_of_05.csv | ||
abfs://hipscat/pytests/hipscat_import/data/small_sky_parts/catalog_01_of_05.csv | ||
abfs://hipscat/pytests/hipscat_import/data/small_sky_parts/catalog_02_of_05.csv | ||
abfs://hipscat/pytests/hipscat_import/data/small_sky_parts/catalog_03_of_05.csv | ||
abfs://hipscat/pytests/hipscat_import/data/small_sky_parts/catalog_04_of_05.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
abfs://hipscat/pytests/hipscat/data/small_sky_order1/Norder=1/Dir=0/Npix=44.parquet | ||
abfs://hipscat/pytests/hipscat/data/small_sky_order1/Norder=1/Dir=0/Npix=45.parquet | ||
abfs://hipscat/pytests/hipscat/data/small_sky_order1/Norder=1/Dir=0/Npix=46.parquet | ||
abfs://hipscat/pytests/hipscat/data/small_sky_order1/Norder=1/Dir=0/Npix=47.parquet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
from hipscat_import.catalog.file_readers import IndexedCsvReader, IndexedParquetReader | ||
|
||
|
||
def test_indexed_parquet_reader(storage_options, local_data_dir): | ||
# Chunksize covers all the inputs. | ||
total_chunks = 0 | ||
total_len = 0 | ||
for frame in IndexedParquetReader(chunksize=10_000, storage_options=storage_options).read( | ||
local_data_dir / "indexed_files" / "parquet_list_single.txt" | ||
): | ||
total_chunks += 1 | ||
assert len(frame) == 131 | ||
total_len += len(frame) | ||
|
||
assert total_chunks == 1 | ||
assert total_len == 131 | ||
|
||
# Requesting a very small chunksize. This will split up reads on the parquet. | ||
total_chunks = 0 | ||
total_len = 0 | ||
for frame in IndexedParquetReader(chunksize=5, storage_options=storage_options).read( | ||
local_data_dir / "indexed_files" / "parquet_list_single.txt" | ||
): | ||
total_chunks += 1 | ||
assert len(frame) <= 5 | ||
total_len += len(frame) | ||
|
||
assert total_chunks == 28 | ||
assert total_len == 131 | ||
|
||
|
||
def test_indexed_csv_reader(storage_options, local_data_dir): | ||
# Chunksize covers all the inputs. | ||
total_chunks = 0 | ||
total_len = 0 | ||
for frame in IndexedCsvReader(chunksize=10_000, storage_options=storage_options).read( | ||
local_data_dir / "indexed_files" / "csv_list_single.txt" | ||
): | ||
total_chunks += 1 | ||
assert len(frame) == 131 | ||
total_len += len(frame) | ||
|
||
assert total_chunks == 1 | ||
assert total_len == 131 | ||
|
||
# Requesting a very small chunksize. This will split up reads on the parquet. | ||
total_chunks = 0 | ||
total_len = 0 | ||
for frame in IndexedCsvReader(chunksize=5, storage_options=storage_options).read( | ||
local_data_dir / "indexed_files" / "csv_list_single.txt" | ||
): | ||
total_chunks += 1 | ||
assert len(frame) <= 5 | ||
total_len += len(frame) | ||
|
||
assert total_chunks == 29 | ||
assert total_len == 131 |