Repository navigation
feat: Add online sequence configuration foundation #6848
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 all commits
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 |
|---|---|---|
|
|
@@ -27,6 +27,7 @@ | |
| from feast.entity import Entity | ||
| from feast.feature_view_projection import FeatureViewProjection | ||
| from feast.field import Field | ||
| from feast.online_config import OnlineConfig | ||
| from feast.proto_utils import ( | ||
| mode_to_string, | ||
| serialize_data_source, | ||
|
|
@@ -129,6 +130,8 @@ class FeatureView(BaseFeatureView): | |
| can be inferred from the underlying data source. | ||
| online: A boolean indicating whether online retrieval is enabled for this feature | ||
| view. | ||
| online_config: Optional online retention and write semantics. Sequence mode is | ||
| declarative until implemented by an online store. | ||
| description: A human-readable description. | ||
| tags: A dictionary of key-value pairs to store arbitrary metadata. | ||
| owner: The owner of the feature view, typically the email of the primary | ||
|
|
@@ -149,6 +152,7 @@ class FeatureView(BaseFeatureView): | |
| entity_columns: List[Field] | ||
| features: List[Field] | ||
| online: bool | ||
| online_config: Optional[OnlineConfig] | ||
| offline: bool | ||
| description: str | ||
| tags: Dict[str, str] | ||
|
|
@@ -171,6 +175,7 @@ def __init__( | |
| entities: Optional[List[Entity]] = None, | ||
| ttl: Optional[timedelta] = timedelta(days=0), | ||
| online: bool = True, | ||
| online_config: Optional[OnlineConfig] = None, | ||
| offline: bool = False, | ||
| description: str = "", | ||
| tags: Optional[Dict[str, str]] = None, | ||
|
|
@@ -198,6 +203,8 @@ def __init__( | |
| can result in extremely computationally intensive queries. | ||
| online (optional): A boolean indicating whether online retrieval is enabled for | ||
| this feature view. | ||
| online_config (optional): Online retention and write semantics for this feature | ||
| view. Defaults to the current latest-value behavior when omitted. | ||
| offline (optional): A boolean indicating whether write to offline store is enabled for | ||
| this feature view. | ||
| description (optional): A human-readable description. | ||
|
|
@@ -223,6 +230,7 @@ def __init__( | |
| self.enable_validation = enable_validation | ||
| self.entities = [e.name for e in entities] if entities else [DUMMY_ENTITY_NAME] | ||
| self.ttl = ttl | ||
| self.online_config = online_config | ||
| schema = schema or [] | ||
| self.mode = mode | ||
|
|
||
|
|
@@ -353,6 +361,7 @@ def __copy__(self): | |
| schema=self.schema, | ||
| tags=self.tags, | ||
| online=self.online, | ||
| online_config=self.online_config, | ||
| offline=self.offline, | ||
| sink_source=self.batch_source if self.source_views else None, | ||
| enable_validation=self.enable_validation, | ||
|
|
@@ -389,7 +398,7 @@ def _schema_or_udf_changed(self, other: "BaseFeatureView") -> bool: | |
|
|
||
| # Skip UDF-related data source fields: batch_source, stream_source | ||
| # (treat as deployment configuration, not schema changes) | ||
| # Skip configuration: ttl, online, offline, enable_validation | ||
| # Skip configuration: ttl, online, online_config, offline, enable_validation | ||
| # Skip metadata: materialization_intervals (excluded in current equality) | ||
| return False | ||
|
|
||
|
|
@@ -404,6 +413,7 @@ def __eq__(self, other): | |
| sorted(self.entities) != sorted(other.entities) | ||
| or self.ttl != other.ttl | ||
| or self.online != other.online | ||
| or self.online_config != other.online_config | ||
| or self.offline != other.offline | ||
| or self.batch_source != other.batch_source | ||
| or self.stream_source != other.stream_source | ||
|
|
@@ -437,6 +447,9 @@ def ensure_valid(self): | |
| """ | ||
| super().ensure_valid() | ||
|
|
||
| if self.online_config is not None: | ||
| self.online_config.validate() | ||
|
|
||
| if not self.entities: | ||
| raise ValueError("Feature view has no entities.") | ||
|
|
||
|
|
@@ -549,6 +562,11 @@ def to_proto_spec( | |
| org=self.org, | ||
| ttl=(ttl_duration if ttl_duration is not None else None), | ||
| online=self.online, | ||
| online_config=( | ||
| self.online_config.to_proto() | ||
| if self.online_config is not None | ||
| else None | ||
| ), | ||
|
Comment on lines
+565
to
+569
Contributor
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. 🟡 Default online configuration changes are ignored With local SQLite, Learn moreAn omitted message and a present message containing only default-valued fields differ in protobuf presence, but their child messages compare equal. Example: Register a view with Recommended fix: Make registry diffing presence-aware for message fields, including Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| offline=self.offline, | ||
| batch_source=batch_source_proto, | ||
| stream_source=stream_source_proto, | ||
|
|
@@ -633,6 +651,11 @@ def _from_proto_internal( | |
| ) | ||
| for view_spec in feature_view_proto.spec.source_views | ||
| ] | ||
| online_config = ( | ||
| OnlineConfig.from_proto(feature_view_proto.spec.online_config) | ||
| if feature_view_proto.spec.HasField("online_config") | ||
| else None | ||
| ) | ||
|
|
||
| from feast.batch_feature_view import BatchFeatureView | ||
|
|
||
|
|
@@ -685,6 +708,7 @@ def _from_proto_internal( | |
| owner=feature_view_proto.spec.owner, | ||
| org=feature_view_proto.spec.org, | ||
| online=feature_view_proto.spec.online, | ||
| online_config=online_config, | ||
| offline=feature_view_proto.spec.offline, | ||
| ttl=( | ||
| timedelta(days=0) | ||
|
|
@@ -714,6 +738,7 @@ def _from_proto_internal( | |
| owner=feature_view_proto.spec.owner, | ||
| org=feature_view_proto.spec.org, | ||
| online=feature_view_proto.spec.online, | ||
| online_config=online_config, | ||
| offline=feature_view_proto.spec.offline, | ||
| ttl=( | ||
| timedelta(days=0) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Batch view copies lose online configuration
Copying a configured batch view drops
online_configbecauseBatchFeatureView.__copy__omits it. Registry.apply_feature_view uses that copy for version pinning and unpromoted snapshots. Pinning raises a false conflict, while unpromoted versions silently lose their configuration.Learn more
The new constructor argument is not preserved by BatchFeatureView.copy. That method reconstructs the batch view without
online_config, resetting it toNone. Registry.apply_feature_view compares the copy against the active view during version pinning, so an otherwise matching configured view fails the comparison. The same method copies unpromoted versions before serializing their snapshots, permanently omitting the configuration. SqlRegistry.apply_feature_view also uses the copy for pin comparisons.Example: Register a batch view with sequence mode,
max_length=50, and append writes. Add a feature and apply withno_promote=True. The new version snapshot contains no online configuration, although the submitted definition does.Recommended fix: Pass
online_config=self.online_configinBatchFeatureView.__copy__. Add regression tests for copied batch views, pinning a configured batch view, and preserving configuration in unpromoted version snapshots.Was this helpful? React with 👍 or 👎 to provide feedback.