Skip to content

Commit de8babe

Browse files
chore!: Delete unused code in feature view (#3016)
* Switch from `batch_source` to `source` Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Switch from `stream_source` to `source` Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Remove entity strings Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Remove unused example feature repo Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Fix feature views Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Fix test Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Delete unused method Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Switch from features to fields Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Fix odfv Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Switch from `inputs` to `sources` and from `features` to `schema` for odfv Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Delete unnecessary odfv test Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Fix durations in java and go repos Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Remove stray comment Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Fix java repo Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Fix Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Fix feature view docstrings Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Fix materialization test Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Remove stray comment about deprecation Signed-off-by: Felix Wang <wangfelix98@gmail.com>
1 parent 5fc73d5 commit de8babe

31 files changed

+199
-704
lines changed

examples/java-demo/feature_repo/driver_repo.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
from datetime import timedelta
2+
13
import pandas as pd
4+
25
from feast.data_source import RequestSource
36
from feast.field import Field
47
from feast.on_demand_feature_view import on_demand_feature_view
58
from feast.request_feature_view import RequestFeatureView
69
from feast.types import Float32, Float64, Int64, String
7-
from google.protobuf.duration_pb2 import Duration
810
from feast.field import Field
911

1012
from feast import Entity, Feature, BatchFeatureView, FileSource
@@ -17,16 +19,16 @@
1719
driver = Entity(name="driver_id", description="driver id",)
1820
driver_hourly_stats_view = BatchFeatureView(
1921
name="driver_hourly_stats",
20-
entities=["driver_id"],
21-
ttl=Duration(seconds=86400000),
22+
entities=[driver],
23+
ttl=timedelta(seconds=86400000),
2224
schema=[
2325
Field(name="conv_rate", dtype=Float32),
2426
Field(name="acc_rate", dtype=Float32),
2527
Field(name="avg_daily_trips", dtype=Int64),
2628
Field(name="string_feature", dtype=String),
2729
],
2830
online=True,
29-
batch_source=driver_hourly_stats,
31+
source=driver_hourly_stats,
3032
tags={},
3133
)
3234

go/internal/test/feature_repo/example.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This is an example feature definition file
22

3-
from google.protobuf.duration_pb2 import Duration
3+
from datetime import timedelta
44

55
from feast import Entity, Feature, FeatureView, Field, FileSource, FeatureService
66
from feast.feature_logging import LoggingConfig
@@ -26,14 +26,14 @@
2626
driver_hourly_stats_view = FeatureView(
2727
name="driver_hourly_stats",
2828
entities=[driver],
29-
ttl=Duration(seconds=86400 * 365 * 10),
29+
ttl=timedelta(seconds=86400 * 365 * 10),
3030
schema=[
3131
Field(name="conv_rate", dtype=Float32),
3232
Field(name="acc_rate", dtype=Float32),
3333
Field(name="avg_daily_trips", dtype=Int64),
3434
],
3535
online=True,
36-
batch_source=driver_hourly_stats,
36+
source=driver_hourly_stats,
3737
tags={},
3838
)
3939

java/serving/src/test/resources/docker-compose/feast10/definitions.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
from datetime import timedelta
2+
13
import pandas as pd
4+
25
from feast.data_source import RequestSource
36
from feast.entity import Entity
47
from feast.feature_service import FeatureService
@@ -7,7 +10,6 @@
710
from feast.on_demand_feature_view import on_demand_feature_view
811
from feast.types import Float32, Float64, Int64
912
from feast.value_type import ValueType
10-
from google.protobuf.duration_pb2 import Duration
1113
from feast import FileSource
1214

1315
file_path = "driver_stats.parquet"
@@ -27,7 +29,7 @@
2729
driver_hourly_stats_view = FeatureView(
2830
name="driver_hourly_stats",
2931
entities=[driver],
30-
ttl=Duration(seconds=86400 * 7),
32+
ttl=timedelta(seconds=86400 * 7),
3133
schema=[
3234
Field(name="conv_rate", dtype=Float64),
3335
Field(name="acc_rate", dtype=Float32),
@@ -77,7 +79,7 @@ def transformed_conv_rate(features_df: pd.DataFrame) -> pd.DataFrame:
7779
FeatureView(
7880
name=f"feature_view_{i}",
7981
entities=[entity],
80-
ttl=Duration(seconds=86400),
82+
ttl=timedelta(seconds=86400),
8183
schema=[Field(name=f"feature_{10 * i + j}", dtype=Int64) for j in range(10)],
8284
online=True,
8385
source=generated_data_source,

sdk/python/feast/batch_feature_view.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ def __init__(
4747
name=name,
4848
entities=entities,
4949
ttl=ttl,
50-
batch_source=None,
51-
stream_source=None,
5250
tags=tags,
5351
online=online,
5452
description=description,

sdk/python/feast/feature_store.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ def plan(
677677
... name="driver_hourly_stats",
678678
... entities=[driver],
679679
... ttl=timedelta(seconds=86400 * 1),
680-
... batch_source=driver_hourly_stats,
680+
... source=driver_hourly_stats,
681681
... )
682682
>>> registry_diff, infra_diff, new_infra = fs.plan(RepoContents(
683683
... data_sources=[driver_hourly_stats],
@@ -790,7 +790,7 @@ def apply(
790790
... name="driver_hourly_stats",
791791
... entities=[driver],
792792
... ttl=timedelta(seconds=86400 * 1),
793-
... batch_source=driver_hourly_stats,
793+
... source=driver_hourly_stats,
794794
... )
795795
>>> fs.apply([driver_hourly_stats_view, driver]) # register entity and feature view
796796
"""

0 commit comments

Comments
 (0)