GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: Keep the BatchFeatureView type and settings when copying it by LuisFigueroaG · Pull Request #6989 · feast-dev/feast

fix: Keep the BatchFeatureView type and settings when copying it #6989

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.

Sign up for GitHub

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

Merged
ntkathole merged 2 commits into feast-dev:master from LuisFigueroaG:fix/batch-feature-view-copy
Oct 13, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

fix: Keep the BatchFeatureView type and settings when copying it #6989

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
2 commits
Select commit Hold shift + click to select a range
cc1b588
fix: Keep the BatchFeatureView type and settings when copying it
LuisFigueroaG Oct 9, 2026
822bdc5
fix: Add type hints to BatchFeatureView.__copy__ and its test
LuisFigueroaG Oct 9, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

36 changes: 35 additions & 1 deletion 36 sdk/python/feast/batch_feature_view.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import copy
import functools
import warnings
from datetime import datetime, timedelta
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from typing import Any, Callable, Dict, List, Optional, Tuple, Union, cast

import dill

Expand Down Expand Up @@ -161,6 +162,39 @@ def __init__(
version=version,
)

def __copy__(self) -> "BatchFeatureView":
fv = BatchFeatureView(
name=self.name,
mode=cast(Union[TransformationMode, str], self.mode),
source=cast(List["BatchFeatureView"], self.source_views)
if self.source_views
else self.batch_source,
sink_source=self.batch_source if self.source_views else None,
schema=self.schema,
ttl=self.ttl,
tags=self.tags,
online=self.online,
offline=self.offline,
description=self.description,
owner=self.owner,
org=self.org,
udf=self.udf,
udf_string=self.udf_string,
feature_transformation=self.feature_transformation,
batch_engine=self.batch_engine,
aggregations=self.aggregations,
enable_validation=self.enable_validation,
version=self.version,
)
fv.enabled = self.enabled
fv.state = self.state
fv.entities = self.entities
fv.features = copy.copy(self.features)
fv.entity_columns = copy.copy(self.entity_columns)
fv.projection = copy.copy(self.projection)
fv._raw_feature_transformation_proto = self._raw_feature_transformation_proto
return fv

def get_feature_transformation(self) -> Optional[Transformation]:
if not self.udf:
return None
Expand Down
42 changes: 42 additions & 0 deletions 42 sdk/python/tests/unit/test_feature_views.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import copy
from datetime import timedelta

import pandas as pd
import pytest
from typeguard import TypeCheckError

from feast.aggregation import Aggregation
from feast.batch_feature_view import BatchFeatureView
from feast.data_format import AvroFormat
from feast.data_source import KafkaSource
Expand Down Expand Up @@ -404,6 +406,46 @@ def transform_udf(df: pd.DataFrame) -> pd.DataFrame:
assert second_deserialized.feature_transformation is not None


def test_batch_feature_view_copy() -> None:
def transform_udf(df: pd.DataFrame) -> pd.DataFrame:
return df

bfv = BatchFeatureView(
name="test_batch_feature_view",
entities=[Entity(name="test_entity", join_keys=["entity_id"])],
schema=[
Field(name="entity_id", dtype=String),
Field(name="input_feature", dtype=Int64),
],
source=FileSource(
name="test-source",
path="test_data.parquet",
timestamp_field="event_timestamp",
),
udf=transform_udf,
mode="pandas",
batch_engine={"spark.sql.shuffle.partitions": "4"},
aggregations=[
Aggregation(
column="input_feature", function="sum", time_window=timedelta(days=1)
)
],
)

bfv_copy = copy.copy(bfv)
assert isinstance(bfv_copy, BatchFeatureView)
assert bfv_copy == bfv
assert bfv_copy.mode == "pandas"
assert bfv_copy.udf is transform_udf
assert bfv_copy.feature_transformation is bfv.feature_transformation
assert bfv_copy.batch_engine == {"spark.sql.shuffle.partitions": "4"}
assert bfv_copy.aggregations == bfv.aggregations

projected = bfv[["input_feature"]]
assert isinstance(projected, BatchFeatureView)
assert projected.to_proto().spec.HasField("feature_transformation")


def test_transformation_mode_serialization():
"""
Test that transformation mode is properly serialized to proto and deserialized back.
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.