diff --git a/.gitignore b/.gitignore index 36af9231..f17bcc09 100644 --- a/.gitignore +++ b/.gitignore @@ -157,4 +157,5 @@ _html/ .initialize_new_project.sh # large, unused fits files -point_map.fits \ No newline at end of file +point_map.fits +dev/test.ipynb diff --git a/src/lsdb/loaders/hipscat/abstract_catalog_loader.py b/src/lsdb/loaders/hipscat/abstract_catalog_loader.py index 1666c22c..1235b7f9 100644 --- a/src/lsdb/loaders/hipscat/abstract_catalog_loader.py +++ b/src/lsdb/loaders/hipscat/abstract_catalog_loader.py @@ -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, self.storage_options + catalog.catalog_base_dir, + ordered_pixels, + self.storage_options, + query_params=self.config.make_query_url_params(), ) return paths diff --git a/src/lsdb/loaders/hipscat/hipscat_loading_config.py b/src/lsdb/loaders/hipscat/hipscat_loading_config.py index 1e97317a..d5b1273d 100644 --- a/src/lsdb/loaders/hipscat/hipscat_loading_config.py +++ b/src/lsdb/loaders/hipscat/hipscat_loading_config.py @@ -47,3 +47,22 @@ 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) -> str: + """ + 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 filter in self.kwargs["filters"]: + # This is how hipscat expects the filters to add to the url + url_params["filters"].append(f"{filter[0]}{filter[1]}{filter[2]}") + + # The filter should be only computed on the server side + self.kwargs.pop("filters", None) + return url_params