From b5549b9e48b2e9bcf9747f500a0afab3c950a8b8 Mon Sep 17 00:00:00 2001 From: Achal Shah Date: Fri, 24 Mar 2023 15:05:09 -0700 Subject: [PATCH] fix: Use pyarrow in a way that works across versions Signed-off-by: Achal Shah --- sdk/python/feast/infra/offline_stores/file_source.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sdk/python/feast/infra/offline_stores/file_source.py b/sdk/python/feast/infra/offline_stores/file_source.py index e9f3735dee..d8522fb445 100644 --- a/sdk/python/feast/infra/offline_stores/file_source.py +++ b/sdk/python/feast/infra/offline_stores/file_source.py @@ -158,7 +158,13 @@ def get_table_column_names_and_types( # Adding support for different file format path # based on S3 filesystem if filesystem is None: - schema = ParquetDataset(path).schema.to_arrow_schema() + schema = ParquetDataset(path).schema + if hasattr(schema, "names") and hasattr(schema, "types"): + # Newer versions of pyarrow doesn't have this method, + # but this field is good enough. + pass + else: + schema = schema.to_arrow_schema() else: schema = ParquetDataset(path, filesystem=filesystem).schema