diff --git a/stac_table.py b/stac_table.py index 5be0300..62057cb 100644 --- a/stac_table.py +++ b/stac_table.py @@ -265,8 +265,12 @@ def get_columns(ds: pyarrow.parquet.ParquetDataset) -> list: for field, col in zip(ds.schema, fragment.metadata.schema): if field.name == "__null_dask_index__": continue - - column = {"name": field.name, "type": col.physical_type.lower()} + + if col.logical_type.type == "NONE": + col_type = col.physical_type + else: + col_type = col.logical_type.type + column = {"name": field.name, "type": col_type.lower()} if field.metadata is not None: column["metadata"] = field.metadata columns.append(column) diff --git a/test_stac_table.py b/test_stac_table.py index 339b492..f5bbbc6 100644 --- a/test_stac_table.py +++ b/test_stac_table.py @@ -51,11 +51,11 @@ def test_generate_item(self, partition): ) expected_columns = [ - {"name": "pop_est", "type": "int64"}, - {"name": "continent", "type": "byte_array"}, - {"name": "name", "type": "byte_array"}, - {"name": "iso_a3", "type": "byte_array"}, - {"name": "gdp_md_est", "type": "double"}, + {"name": "pop_est", "type": "double"}, + {"name": "continent", "type": "string"}, + {"name": "name", "type": "string"}, + {"name": "iso_a3", "type": "string"}, + {"name": "gdp_md_est", "type": "int64"}, {"name": "geometry", "type": "byte_array"}, ] assert result.properties["table:columns"] == expected_columns