Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update doc
Signed-off-by: hao-xu5 <hxu44@apple.com>
  • Loading branch information
hao-xu5 committed Oct 22, 2025
commit 41d20bc276f4c0fcf321c0ca268952979737e756
34 changes: 32 additions & 2 deletions docs/reference/beta-on-demand-feature-view.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,40 @@ When defining an ODFV, you can specify the transformation mode using the `mode`

### Singleton Transformations in Native Python Mode

Native Python mode supports transformations on singleton dictionaries by setting `singleton=True`. This allows you to
write transformation functions that operate on a single row at a time, making the code more intuitive and aligning with
Native Python mode supports transformations on singleton dictionaries by setting `singleton=True`. This allows you to
write transformation functions that operate on a single row at a time, making the code more intuitive and aligning with
how data scientists typically think about data transformations.

## Aggregations

On Demand Feature Views support aggregations that compute aggregate statistics over groups of rows. When using aggregations, data is grouped by entity columns (e.g., `driver_id`) and aggregated before being passed to the transformation function.

**Important**: Aggregations and transformations are mutually exclusive. When aggregations are specified, they replace the transformation function.
Comment thread
ntkathole marked this conversation as resolved.

### Usage

```python
from feast import Aggregation
from datetime import timedelta

@on_demand_feature_view(
sources=[driver_hourly_stats_view],
schema=[
Field(name="total_trips", dtype=Int64),
Field(name="avg_rating", dtype=Float64),
],
aggregations=[
Aggregation(column="trips", function="sum"),
Aggregation(column="rating", function="mean"),
],
)
def driver_aggregated_stats(inputs):
# No transformation function needed when using aggregations
pass
```

Aggregated columns are automatically named using the pattern `{function}_{column}` (e.g., `sum_trips`, `mean_rating`).

## Example
See [https://github.com/feast-dev/on-demand-feature-views-demo](https://github.com/feast-dev/on-demand-feature-views-demo) for an example on how to use on demand feature views.

Expand Down
Loading