Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support to query params on http filesystem #355

Merged
merged 2 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,7 @@ _html/
.initialize_new_project.sh

# large, unused fits files
point_map.fits
point_map.fits

# test notebook
dev/test.ipynb
5 changes: 4 additions & 1 deletion src/lsdb/loaders/hipscat/abstract_catalog_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ def _get_paths_from_pixels(
self, catalog: HCHealpixDataset, ordered_pixels: List[HealpixPixel]
) -> List[hc.io.FilePointer]:
paths = hc.io.paths.pixel_catalog_files(
catalog.catalog_base_dir, ordered_pixels, storage_options=self.storage_options
catalog.catalog_base_dir,
ordered_pixels,
self.config.make_query_url_params(),
self.storage_options,
Schwarzam marked this conversation as resolved.
Show resolved Hide resolved
)
return paths

Expand Down
17 changes: 17 additions & 0 deletions src/lsdb/loaders/hipscat/hipscat_loading_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,20 @@ def get_dtype_mapper(self) -> Callable | None:
elif self.dtype_backend == "numpy_nullable":
mapper = _arrow_dtype_mapping().get
return mapper

def make_query_url_params(self) -> dict:
"""
Generates a dictionary of URL parameters with `columns` and `filters` attributes.
"""
url_params = {}

if self.columns and len(self.columns) > 0:
url_params["columns"] = self.columns

if "filters" in self.kwargs:
url_params["filters"] = []
for filtr in self.kwargs["filters"]:
# This is how hipscat expects the filters to add to the url
url_params["filters"].append(f"{filtr[0]}{filtr[1]}{filtr[2]}")

return url_params