Skip to content
Merged
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
6 changes: 4 additions & 2 deletions sdk/python/feast/stream_feature_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ def __copy__(self):
fv = StreamFeatureView(
name=self.name,
schema=self.schema,
entities=self.entities,
ttl=self.ttl,
tags=self.tags,
online=self.online,
Expand All @@ -293,9 +292,12 @@ def __copy__(self):
aggregations=self.aggregations,
mode=self.mode,
timestamp_field=self.timestamp_field,
source=self.source,
source=self.stream_source if self.stream_source else self.batch_source,
udf=self.udf,
)
fv.entities = self.entities
fv.features = copy.copy(self.features)
fv.entity_columns = copy.copy(self.entity_columns)
fv.projection = copy.copy(self.projection)
return fv

Expand Down
20 changes: 20 additions & 0 deletions sdk/python/tests/unit/test_feature_views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import copy
from datetime import timedelta

import pytest
Expand Down Expand Up @@ -299,3 +300,22 @@ def test_stream_feature_view_proto_type():
aggregations=[],
)
assert sfv.proto_class is StreamFeatureViewProto


def test_stream_feature_view_copy():
stream_source = KafkaSource(
name="kafka",
timestamp_field="event_timestamp",
kafka_bootstrap_servers="",
message_format=AvroFormat(""),
topic="topic",
batch_source=FileSource(path="some path"),
)
sfv = StreamFeatureView(
name="test stream featureview proto class",
entities=[],
ttl=timedelta(days=30),
source=stream_source,
aggregations=[],
)
assert sfv == copy.copy(sfv)