Skip to content

Commit

Permalink
Add storage options to more catalog calls (#244)
Browse files Browse the repository at this point in the history
* Use storage options in catalog validation.

* Load index values from non-local sources
  • Loading branch information
delucchi-cmu authored Mar 21, 2024
1 parent deffbb2 commit bf275bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/hipscat/catalog/index/index_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from hipscat.catalog.dataset import Dataset
from hipscat.catalog.index import IndexCatalogInfo
from hipscat.io import paths
from hipscat.io.file_io.file_pointer import get_fs, strip_leading_slash_for_pyarrow
from hipscat.pixel_math import HealpixPixel
from hipscat.pixel_math.healpix_pixel_function import get_pixel_argsort

Expand All @@ -31,7 +32,12 @@ def loc_partitions(self, ids) -> List[HealpixPixel]:
that may contain rows for the id values
"""
metadata_file = paths.get_parquet_metadata_pointer(self.catalog_base_dir)
dataset = pds.parquet_dataset(metadata_file)
file_system, metadata_file = get_fs(file_pointer=metadata_file, storage_options=self.storage_options)

# pyarrow.dataset requires the pointer not lead with a slash
metadata_file = strip_leading_slash_for_pyarrow(metadata_file, file_system.protocol)

dataset = pds.parquet_dataset(metadata_file, filesystem=file_system)

# There's a lot happening in a few pyarrow dataset methods:
# We create a simple pyarrow expression that roughly corresponds to a SQL statement like
Expand Down
2 changes: 1 addition & 1 deletion src/hipscat/loaders/read_from_hipscat.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def read_from_hipscat(
else catalog_type
)
loader = _get_loader_from_catalog_type(catalog_type_to_use)
return loader.read_from_hipscat(catalog_path)
return loader.read_from_hipscat(catalog_path, storage_options=storage_options)


def _read_dataset_class_from_metadata(
Expand Down

0 comments on commit bf275bc

Please sign in to comment.