-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix: Request data api update #2488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
7cea469
7b7395c
945e0f8
19158f8
b284d5f
c90a224
a362e9f
f3c9d7a
b442599
af8e98f
b28932d
9ecf9c8
61230c8
340b98a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,6 @@ | |
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
|
|
||
| import enum | ||
| import warnings | ||
| from abc import ABC, abstractmethod | ||
|
|
@@ -144,7 +143,7 @@ def to_proto(self) -> DataSourceProto.KinesisOptions: | |
| DataSourceProto.SourceType.BATCH_SNOWFLAKE: "feast.infra.offline_stores.snowflake_source.SnowflakeSource", | ||
| DataSourceProto.SourceType.STREAM_KAFKA: "feast.data_source.KafkaSource", | ||
| DataSourceProto.SourceType.STREAM_KINESIS: "feast.data_source.KinesisSource", | ||
| DataSourceProto.SourceType.REQUEST_SOURCE: "feast.data_source.RequestDataSource", | ||
| DataSourceProto.SourceType.REQUEST_SOURCE: "feast.data_source.RequestSource", | ||
| DataSourceProto.SourceType.PUSH_SOURCE: "feast.data_source.PushSource", | ||
| } | ||
|
|
||
|
|
@@ -422,9 +421,9 @@ def get_table_query_string(self) -> str: | |
| raise NotImplementedError | ||
|
|
||
|
|
||
| class RequestDataSource(DataSource): | ||
| class RequestSource(DataSource): | ||
| """ | ||
| RequestDataSource that can be used to provide input features for on demand transforms | ||
| RequestSource that can be used to provide input features for on demand transforms | ||
|
|
||
| Args: | ||
| name: Name of the request data source | ||
|
|
@@ -446,7 +445,7 @@ def __init__( | |
| tags: Optional[Dict[str, str]] = None, | ||
| owner: Optional[str] = "", | ||
| ): | ||
| """Creates a RequestDataSource object.""" | ||
| """Creates a RequestSource object.""" | ||
| super().__init__(name=name, description=description, tags=tags, owner=owner) | ||
| self.schema = schema | ||
|
|
||
|
|
@@ -464,7 +463,7 @@ def from_proto(data_source: DataSourceProto): | |
| schema = {} | ||
| for key, val in schema_pb.items(): | ||
| schema[key] = ValueType(val) | ||
| return RequestDataSource( | ||
| return RequestSource( | ||
| name=data_source.name, | ||
| schema=schema, | ||
| description=data_source.description, | ||
|
|
@@ -496,6 +495,15 @@ def source_datatype_to_feast_value_type() -> Callable[[str], ValueType]: | |
| raise NotImplementedError | ||
|
|
||
|
|
||
| class RequestDataSource(RequestSource): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you also keep a test for
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup Added. |
||
| def __init__(self, *args, **kwargs): | ||
| warnings.warn( | ||
| "The 'RequestDataSource' class is deprecated and was renamed to RequestSource. Please use RequestSource instead. This class name will be removed in Feast 0.23.", | ||
| DeprecationWarning, | ||
| ) | ||
| RequestSource.__init__(*args, **kwargs) | ||
|
|
||
|
|
||
| class KinesisSource(DataSource): | ||
| def validate(self, config: RepoConfig): | ||
| pass | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
| from typing import Dict, List, Optional, Type | ||
|
|
||
| from feast.base_feature_view import BaseFeatureView | ||
| from feast.data_source import RequestDataSource | ||
| from feast.data_source import RequestSource | ||
| from feast.feature import Feature | ||
| from feast.feature_view_projection import FeatureViewProjection | ||
| from feast.protos.feast.core.RequestFeatureView_pb2 import ( | ||
|
|
@@ -30,7 +30,7 @@ class RequestFeatureView(BaseFeatureView): | |
| """ | ||
|
|
||
| name: str | ||
| request_data_source: RequestDataSource | ||
| request_data_source: RequestSource | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. change field name?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed |
||
| features: List[Feature] | ||
| description: str | ||
| tags: Dict[str, str] | ||
|
|
@@ -40,7 +40,7 @@ class RequestFeatureView(BaseFeatureView): | |
| def __init__( | ||
| self, | ||
| name: str, | ||
| request_data_source: RequestDataSource, | ||
| request_data_source: RequestSource, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. change field name? also, change to use kwargs? Or is that a different PR?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a different PR, I am not deprecating feature view params here. |
||
| description: str = "", | ||
| tags: Optional[Dict[str, str]] = None, | ||
| owner: str = "", | ||
|
|
@@ -110,7 +110,7 @@ def from_proto(cls, request_feature_view_proto: RequestFeatureViewProto): | |
|
|
||
| request_feature_view_obj = cls( | ||
| name=request_feature_view_proto.spec.name, | ||
| request_data_source=RequestDataSource.from_proto( | ||
| request_data_source=RequestSource.from_proto( | ||
| request_feature_view_proto.spec.request_data_source | ||
| ), | ||
| description=request_feature_view_proto.spec.description, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ | |
| import pandas as pd | ||
|
|
||
| from feast import Feature, FeatureView, OnDemandFeatureView, PushSource, ValueType | ||
| from feast.data_source import DataSource, RequestDataSource | ||
| from feast.data_source import DataSource, RequestSource | ||
|
|
||
|
|
||
| def driver_feature_view( | ||
|
|
@@ -51,7 +51,7 @@ def conv_rate_plus_100(features_df: pd.DataFrame) -> pd.DataFrame: | |
|
|
||
|
|
||
| def conv_rate_plus_100_feature_view( | ||
| sources: Dict[str, Union[RequestDataSource, FeatureView]], | ||
| sources: Dict[str, Union[RequestSource, FeatureView]], | ||
| infer_features: bool = False, | ||
| features: Optional[List[Feature]] = None, | ||
| ) -> OnDemandFeatureView: | ||
|
|
@@ -86,7 +86,7 @@ def similarity(features_df: pd.DataFrame) -> pd.DataFrame: | |
|
|
||
|
|
||
| def similarity_feature_view( | ||
| sources: Dict[str, Union[RequestDataSource, FeatureView]], | ||
| sources: Dict[str, Union[RequestSource, FeatureView]], | ||
| infer_features: bool = False, | ||
| features: Optional[List[Feature]] = None, | ||
| ) -> OnDemandFeatureView: | ||
|
|
@@ -103,13 +103,11 @@ def similarity_feature_view( | |
|
|
||
|
|
||
| def create_conv_rate_request_data_source(): | ||
| return RequestDataSource( | ||
| name="conv_rate_input", schema={"val_to_add": ValueType.INT32} | ||
| ) | ||
| return RequestSource(name="conv_rate_input", schema={"val_to_add": ValueType.INT32}) | ||
|
|
||
|
|
||
| def create_similarity_request_data_source(): | ||
| return RequestDataSource( | ||
| return RequestSource( | ||
|
Comment on lines
105
to
+110
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| name="similarity_input", | ||
| schema={ | ||
| "vector_double": ValueType.DOUBLE_LIST, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.