Skip to content

Commit f969e53

Browse files
authored
Use FeatureViewProjection instead of FeatureView in ODFV (#2186)
* Use FeatureViewProjection instead of FeatureView in ODFV Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com> * Refactor `get_online_features` to allow for use of FeatureViewProjections in ODFVs. Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com> * Refactor `get_online_features` to improve performance Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com> * Fix linting error Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com> * Refactor `_set_table_entity_keys` for clarity and performance Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com> * Customer IDs should be `ValueType.STRING` Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com> * Use Entity ValueType information in `_convert_arrow_to_proto` Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com> * Only call `_augment_response_with_on_demand_transforms` if needed Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
1 parent 30f7bba commit f969e53

File tree

11 files changed

+241
-314
lines changed

11 files changed

+241
-314
lines changed

protos/feast/core/OnDemandFeatureView.proto

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ option java_package = "feast.proto.core";
2424

2525
import "google/protobuf/timestamp.proto";
2626
import "feast/core/FeatureView.proto";
27+
import "feast/core/FeatureViewProjection.proto";
2728
import "feast/core/Feature.proto";
2829
import "feast/core/DataSource.proto";
2930

@@ -43,7 +44,7 @@ message OnDemandFeatureViewSpec {
4344
// List of features specifications for each feature defined with this feature view.
4445
repeated FeatureSpecV2 features = 3;
4546

46-
// List of features specifications for each feature defined with this feature view.
47+
// Map of inputs for this feature view.
4748
map<string, OnDemandInput> inputs = 4;
4849

4950
UserDefinedFunction user_defined_function = 5;
@@ -59,6 +60,7 @@ message OnDemandFeatureViewMeta {
5960
message OnDemandInput {
6061
oneof input {
6162
FeatureView feature_view = 1;
63+
FeatureViewProjection feature_view_projection = 3;
6264
DataSource request_data_source = 2;
6365
}
6466
}

sdk/go/request.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ func (r OnlineFeaturesRequest) buildRequest() (*serving.GetOnlineFeaturesRequest
3535
if err != nil {
3636
return nil, err
3737
}
38-
if len(r.Entities) == 0 {
39-
return nil, fmt.Errorf("Entities must be provided")
40-
}
38+
if len(r.Entities) == 0 {
39+
return nil, fmt.Errorf("Entities must be provided")
40+
}
4141

42-
firstRow := r.Entities[0]
43-
columnSize := len(firstRow)
42+
firstRow := r.Entities[0]
43+
columnSize := len(firstRow)
4444

4545
// build request entity rows from native entities
4646
entityColumns := make(map[string][]*types.Value, columnSize)

sdk/go/request_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ func TestGetOnlineFeaturesRequest(t *testing.T) {
3737
},
3838
},
3939
Entities: map[string]*types.RepeatedValue{
40-
"entity1": &types.RepeatedValue{
40+
"entity1": {
4141
Val: []*types.Value{
4242
Int64Val(1), Int64Val(1), Int64Val(1),
4343
},
4444
},
45-
"entity2": &types.RepeatedValue{
45+
"entity2": {
4646
Val: []*types.Value{
4747
StrVal("bob"), StrVal("annie"), StrVal("jane"),
4848
},

sdk/python/feast/cli.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,8 @@ def feature_view_list(ctx: click.Context):
284284
if isinstance(feature_view, FeatureView):
285285
entities.update(feature_view.entities)
286286
elif isinstance(feature_view, OnDemandFeatureView):
287-
for backing_fv in feature_view.inputs.values():
288-
if isinstance(backing_fv, FeatureView):
289-
entities.update(backing_fv.entities)
287+
for backing_fv in feature_view.input_feature_view_projections.values():
288+
entities.update(store.get_feature_view(backing_fv.name).entities)
290289
table.append(
291290
[
292291
feature_view.name,

0 commit comments

Comments
 (0)