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: 7 additions & 0 deletions sdk/python/feast/infra/offline_stores/duckdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ def _read_data_source(data_source: DataSource, repo_path: str) -> Table:
if storage_options:
return ibis.read_delta(data_source.path, storage_options=storage_options)
return ibis.read_delta(data_source.path)
else:
raise ValueError(
f"Unable to determine the file format for data source "
f"'{data_source.name}' with path '{data_source.path}'. Either set "
f"'file_format' explicitly on the FileSource (e.g. ParquetFormat()) "
f"or use a path with a recognized file extension (e.g. '.parquet')."
)


def _read_iceberg_catalog_source(data_source: "IcebergSource", repo_path: str) -> Table:
Expand Down
15 changes: 15 additions & 0 deletions sdk/python/tests/unit/infra/offline_stores/test_duckdb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import pytest

from feast.infra.offline_stores.duckdb import _read_data_source
from feast.infra.offline_stores.file_source import FileSource


def test_read_data_source_raises_on_unresolvable_file_format():
data_source = FileSource(
name="driver_hourly_stats_source",
path="data/driver_stats.csv",
timestamp_field="event_timestamp",
)

with pytest.raises(ValueError, match="Unable to determine the file format"):
_read_data_source(data_source, repo_path=".")