Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 5 additions & 2 deletions src/hats_import/catalog/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from hats.catalog import TableProperties
from hats.catalog.catalog_collection import CatalogCollection
from hats.io.file_io import get_upath
from hats.io.paths import DATASET_DIR, PARTITION_ORDER
from hats.io.paths import DATASET_DIR, HIVE_COLUMNS, PARTITION_ORDER
from hats.io.validation import is_valid_catalog
from hats.pixel_math import spatial_index
from hats.pixel_math.spatial_index import SPATIAL_INDEX_COLUMN, SPATIAL_INDEX_ORDER
Expand Down Expand Up @@ -234,7 +234,10 @@ def reimport_from_hats(cls, path: str | Path | UPath, output_dir: str | Path | U
if not is_valid_catalog(path, strict=True):
raise ValueError("path not a valid catalog")

column_names = catalog.schema.names if catalog.schema is not None else None
column_names = None
if catalog.schema is not None:
column_names = catalog.schema.names
column_names = [name for name in column_names if name not in HIVE_COLUMNS]

in_file_paths = list(
(path / DATASET_DIR).rglob(f"{PARTITION_ORDER}*/**/*{catalog.catalog_info.npix_suffix}")
Expand Down
1 change: 1 addition & 0 deletions tests/hats_import/catalog/test_reimport_hats.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def test_run_reimport(
assert catalog.catalog_info.default_columns == old_cat.catalog_info.default_columns
assert catalog.catalog_info.__pydantic_extra__["obs_regime"] == "Optical"
assert len(catalog.get_healpix_pixels()) == 4
assert catalog.schema == old_cat.schema

# Check that the schema is correct for leaf parquet and _metadata files
original_common_md = paths.get_common_metadata_pointer(old_cat.catalog_base_dir)
Expand Down