diff --git a/src/hats_import/catalog/arguments.py b/src/hats_import/catalog/arguments.py index 8317cebf..53b4b66c 100644 --- a/src/hats_import/catalog/arguments.py +++ b/src/hats_import/catalog/arguments.py @@ -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 @@ -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}") diff --git a/tests/hats_import/catalog/test_reimport_hats.py b/tests/hats_import/catalog/test_reimport_hats.py index 29c49bfe..4443d5e6 100644 --- a/tests/hats_import/catalog/test_reimport_hats.py +++ b/tests/hats_import/catalog/test_reimport_hats.py @@ -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)