Skip to content

Commit 661c053

Browse files
fix: Do not allow same column to be reused in data sources (feast-dev#2965)
* Do not allow same column to be reused in data sources Signed-off-by: Felix Wang <[email protected]> * Fix bug Signed-off-by: Felix Wang <[email protected]>
1 parent 5e45228 commit 661c053

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

sdk/python/feast/data_source.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,13 @@ def __init__(
273273
),
274274
DeprecationWarning,
275275
)
276+
if (
277+
self.timestamp_field
278+
and self.timestamp_field == self.created_timestamp_column
279+
):
280+
raise ValueError(
281+
"Please do not use the same column for 'timestamp_field' and 'created_timestamp_column'."
282+
)
276283
self.description = description or ""
277284
self.tags = tags or {}
278285
self.owner = owner or ""

sdk/python/tests/unit/test_data_sources.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,3 +261,13 @@ def test_proto_conversion():
261261
assert DataSource.from_proto(kinesis_source.to_proto()) == kinesis_source
262262
assert DataSource.from_proto(push_source.to_proto()) == push_source
263263
assert DataSource.from_proto(request_source.to_proto()) == request_source
264+
265+
266+
def test_column_conflict():
267+
with pytest.raises(ValueError):
268+
_ = FileSource(
269+
name="test_source",
270+
path="test_path",
271+
timestamp_field="event_timestamp",
272+
created_timestamp_column="event_timestamp",
273+
)

0 commit comments

Comments
 (0)