feast icon indicating copy to clipboard operation
feast copied to clipboard

Writing to redis fails when the feature view has no entities.

Open OptimeeringBigya opened this issue 5 months ago • 1 comments

Expected Behavior

Successfully write data into Redis Online Store.

Current Behavior

Fails with exception raised.

File "/home/user/source_code/feast_exp/.venv/lib/python3.11/site-packages/feast/infra/online_stores/redis.py", line 293, in online_write_batch
redis_key_bin = _redis_key(
                ^^^^^^^^^^^
File "/home/user/source_code/feast_exp/.venv/lib/python3.11/site-packages/feast/infra/online_stores/helpers.py", line 29, in _redis_key
serialize_entity_key(
File "/home/user/source_code/feast_exp/.venv/lib/python3.11/site-packages/feast/infra/key_encoding_utils.py", line 140, in serialize_entity_key
sorted_keys, sorted_values = zip(
^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected 2, got 0)

Steps to reproduce

Python Code

import datetime
import pandas as pd
from feast import FeatureView, Field
from feast.types import Int32
from feast.infra.offline_stores.contrib.postgres_offline_store.postgres_source import PostgreSQLSource

from utils.feast_utils import STORE

source=PostgreSQLSource( # the source doesnt impact the issue
                timestamp_field="event_timestamp", # but i have included the schema here
                created_timestamp_column="created_at",
                table="test_table",
                name=f"test_source",
            )
a=FeatureView(
    description="Description",
    entities=[],
    schema=[Field(name="f1",dtype=Int32)],
    name="fv1",
    source=source
)
STORE.apply([source,a]) # STORE here is feature store with config below
STORE.refresh_registry()
STORE.write_to_online_store(
    feature_view_name="fv1",
    df=pd.DataFrame(
        [
            {
                "event_timestamp":datetime.datetime.now(),
                "created_at":datetime.datetime.now(),
                "f1":12,
             }
        ]
    )
)

Config

project: feast_experiment
registry:
    registry_type: sql
    path: postgresql+psycopg://USER:[email protected]:PORT/DATABASE
    cache_ttl_seconds: 60
    sqlalchemy_config_kwargs:
        echo: false
        pool_pre_ping: true
provider: local
online_store:
    type: redis
    connection_string: 127.0.0.1:6375
offline_store:
    type: postgres
    host: 127.0.0.1
    port: ANOTHER_PORT
    user: ANOTHER_USER
    password: ANOTHER_PASSWORD
    database: feast_offline
entity_key_serialization_version: 3
auth:
    type: no_auth

SQL # Create table just in case

create table test_table
(
event_timestamp timestamp with time zone,
created_at timestamp with time zone,
f1 int
);

Specifications

  • Version: feast = {version = "^0.53.0", extras = ["redis"]} Current version is 0.53.0
  • Platform: Linux
  • Subsystem: Ubuntu 24.04

OptimeeringBigya avatar Sep 24 '25 16:09 OptimeeringBigya

Also tried changing df in write_to_online_store to inputs ; fails with same error. It is unclear what the difference between the two are.

OptimeeringBigya avatar Sep 24 '25 16:09 OptimeeringBigya