Skip to content

Commit

Permalink
feat: Adding 'SortedFeatureView' type to support Range Queries (#168)
Browse files Browse the repository at this point in the history
* Adding 'SortedFeatureView' type to support range queries

* Adding type to ApplyFeatureViewRequest

* Addressing PR Comments: made modifications to SortedFeatureView.proto, RegistryServer.proto and SortedFeatureView.proto

* Addressing PR Comments: adding delete and apply back for remote registry use case

* Addressing PR Comments: removing delete and apply after some discussion

---------

Co-authored-by: Manisha Sudhir <[email protected]>
  • Loading branch information
Manisha4 and Manisha Sudhir authored Feb 11, 2025
1 parent 408c3c6 commit 38be3e4
Show file tree
Hide file tree
Showing 3 changed files with 157 additions and 9 deletions.
4 changes: 3 additions & 1 deletion protos/feast/core/Registry.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import "feast/core/OnDemandFeatureView.proto";
import "feast/core/StreamFeatureView.proto";
import "feast/core/DataSource.proto";
import "feast/core/SavedDataset.proto";
import "feast/core/SortedFeatureView.proto";
import "feast/core/ValidationProfile.proto";
import "google/protobuf/timestamp.proto";
import "feast/core/Permission.proto";
Expand All @@ -43,6 +44,7 @@ message Registry {
repeated DataSource data_sources = 12;
repeated OnDemandFeatureView on_demand_feature_views = 8;
repeated StreamFeatureView stream_feature_views = 14;
repeated SortedFeatureView sorted_feature_views = 30;
repeated FeatureService feature_services = 7;
repeated SavedDataset saved_datasets = 11;
repeated ValidationReference validation_references = 13;
Expand All @@ -62,4 +64,4 @@ message ProjectMetadata {
string project_uuid = 2;
google.protobuf.Timestamp last_updated_timestamp = 3;

}
}
121 changes: 121 additions & 0 deletions protos/feast/core/SortedFeatureView.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
//
// Copyright 2020 The Feast Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//


syntax = "proto3";
package feast.core;

option go_package = "github.com/feast-dev/feast/go/protos/feast/core";
option java_outer_classname = "SortedFeatureViewProto";
option java_package = "feast.proto.core";

import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "feast/core/DataSource.proto";
import "feast/core/Entity.proto";
import "feast/core/Feature.proto";
import "feast/core/FeatureView.proto";
import "feast/types/Value.proto";

// Represents a SortedFeatureView, used for range queries on features
message SortedFeatureView {
// User-specified specifications of the sorted feature view.
SortedFeatureViewSpec spec = 1;

// System-populated metadata for this feature view.
FeatureViewMeta meta = 2;
}

message SortedFeatureViewSpec {
// Name of the feature view. Must be unique. Not updated.
string name = 1;

// Name of Feast project that this feature view belongs to.
string project = 2;

// List of names of entities associated with this feature view.
repeated string entities = 3;

// List of specifications for each feature defined as part of this feature view.
repeated FeatureSpecV2 features = 4;

// List of specifications for each entity defined as part of this feature view.
repeated FeatureSpecV2 entity_columns = 12;

// List of sort keys for this feature view.
repeated SortKey sort_keys = 13;

// Description of the feature view.
string description = 10;

// User defined metadata
map<string,string> tags = 5;

// Owner of the feature view.
string owner = 11;

// Features in this feature view can only be retrieved from online serving
// younger than ttl. Ttl is measured as the duration of time between
// the feature's event timestamp and when the feature is retrieved
// Feature values outside ttl will be returned as unset values and indicated to end user
google.protobuf.Duration ttl = 6;

// Batch/Offline DataSource where this view can retrieve offline feature data.
DataSource batch_source = 7;

// Streaming DataSource from where this view can consume "online" feature data.
DataSource stream_source = 9;

// Whether these features should be served online or not
bool online = 8;

// User-specified specifications of this entity.
// Adding higher index to avoid conflicts in future
// if Feast adds more fields
repeated Entity original_entities = 30;
}

// Defines the sorting criteria for range-based feature queries.
message SortKey {
// Name of the feature used for sorting.
string name = 1;

// The value type of the sorting key (e.g., INT64, FLOAT, STRING).
feast.types.ValueType.Enum value_type = 2;

// The default sorting order for this key.
SortOrder.Enum default_sort_order = 3;

// Tags for user defined metadata on a feature
map<string,string> tags = 4;

// Description of the feature.
string description = 5;
}

// Specifies the possible sorting orders for a feature view.
message SortOrder {
enum Enum {
// Invalid sorting order (default value).
INVALID = 0;

// Ascending sorting order.
ASC = 1;

// Descending sorting order.
DESC = 2;
}
}
41 changes: 33 additions & 8 deletions protos/feast/registry/RegistryServer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ package feast.registry;

import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "feast/core/Registry.proto";
import "feast/core/Entity.proto";
import "feast/core/DataSource.proto";
import "feast/core/FeatureView.proto";
import "feast/core/StreamFeatureView.proto";
import "feast/core/OnDemandFeatureView.proto";
import "feast/core/Entity.proto";
import "feast/core/FeatureService.proto";
import "feast/core/SavedDataset.proto";
import "feast/core/ValidationProfile.proto";
import "feast/core/FeatureView.proto";
import "feast/core/InfraObject.proto";
import "feast/core/OnDemandFeatureView.proto";
import "feast/core/Permission.proto";
import "feast/core/Project.proto";
import "feast/core/Registry.proto";
import "feast/core/SavedDataset.proto";
import "feast/core/SortedFeatureView.proto";
import "feast/core/StreamFeatureView.proto";
import "feast/core/ValidationProfile.proto";

service RegistryServer{
// Entity RPCs
Expand All @@ -40,6 +41,10 @@ service RegistryServer{
rpc GetFeatureView (GetFeatureViewRequest) returns (feast.core.FeatureView) {}
rpc ListFeatureViews (ListFeatureViewsRequest) returns (ListFeatureViewsResponse) {}

// SortedFeatureView RPCs
rpc GetSortedFeatureView (GetSortedFeatureViewRequest) returns (feast.core.SortedFeatureView) {}
rpc ListSortedFeatureViews (ListSortedFeatureViewsRequest) returns (ListSortedFeatureViewsResponse) {}

// StreamFeatureView RPCs
rpc GetStreamFeatureView (GetStreamFeatureViewRequest) returns (feast.core.StreamFeatureView) {}
rpc ListStreamFeatureViews (ListStreamFeatureViewsRequest) returns (ListStreamFeatureViewsResponse) {}
Expand Down Expand Up @@ -185,6 +190,7 @@ message ApplyFeatureViewRequest {
feast.core.FeatureView feature_view = 1;
feast.core.OnDemandFeatureView on_demand_feature_view = 2;
feast.core.StreamFeatureView stream_feature_view = 3;
feast.core.SortedFeatureView sorted_feature_view = 30;
}
string project = 4;
bool commit = 5;
Expand Down Expand Up @@ -217,6 +223,7 @@ message AnyFeatureView {
feast.core.FeatureView feature_view = 1;
feast.core.OnDemandFeatureView on_demand_feature_view = 2;
feast.core.StreamFeatureView stream_feature_view = 3;
feast.core.SortedFeatureView sorted_feature_view = 30;
}
}

Expand Down Expand Up @@ -277,6 +284,24 @@ message ListOnDemandFeatureViewsResponse {
repeated feast.core.OnDemandFeatureView on_demand_feature_views = 1;
}

// SortedFeatureView for range queries

message GetSortedFeatureViewRequest {
string name = 1;
string project = 2;
bool allow_cache = 3;
}

message ListSortedFeatureViewsRequest {
string project = 1;
bool allow_cache = 2;
map<string,string> tags = 3;
}

message ListSortedFeatureViewsResponse {
repeated feast.core.SortedFeatureView sorted_feature_views = 1;
}

// FeatureServices

message ApplyFeatureServiceRequest {
Expand Down Expand Up @@ -421,4 +446,4 @@ message ListProjectsResponse {
message DeleteProjectRequest {
string name = 1;
bool commit = 2;
}
}

0 comments on commit 38be3e4

Please sign in to comment.