Skip to content

Writing to redis fails when one of the entities is a timestamp. #5634

Closed

Description

@BigyaPradhan

Expected Behavior

Successfully write data into Redis Online Store.

Current Behavior

Fails with exception

Traceback (most recent call last):
  File "/home/user/source_code/feast_exp/b.py", line 38, in <module>
    STORE.write_to_online_store(
  File "/home/user/source_code/feast_exp/.venv/lib/python3.11/site-packages/feast/feature_store.py", line 1736, in write_to_online_store
    provider.ingest_df(feature_view, df)
  File "/home/user/source_code/feast_exp/.venv/lib/python3.11/site-packages/feast/infra/passthrough_provider.py", line 393, in ingest_df
    self.online_write_batch(
  File "/home/user/source_code/feast_exp/.venv/lib/python3.11/site-packages/feast/infra/passthrough_provider.py", line 197, in online_write_batch
    self.online_store.online_write_batch(config, table, data, progress)
  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
    val_bytes, value_type = _serialize_val(
                            ^^^^^^^^^^^^^^^
  File "/home/user/source_code/feast_exp/.venv/lib/python3.11/site-packages/feast/infra/key_encoding_utils.py", line 25, in _serialize_val
    raise ValueError(f"Value type not supported for feast feature store: {v}")
ValueError: Value type not supported for feast feature store: unix_timestamp_val: 1758823656

Steps to reproduce

Python file:

import datetime

import pandas as pd

from feast import FeatureView, Field, Entity
from feast.types import Int32
from feast.infra.offline_stores.contrib.postgres_offline_store.postgres_source import PostgreSQLSource
from feast import ValueType

from utils.feast_utils import STORE

e2 = Entity(name="e2", value_type=ValueType.UNIX_TIMESTAMP,description="e2")

source_one_ts=PostgreSQLSource(
        name=f"one_ts",
        table="one_ts",
        timestamp_field="event_timestamp",
        created_timestamp_column="created_at",
    )
one_ts = FeatureView(
    description="Description",
    entities=[
        e2
    ],
    schema=[
        Field(name="f1", dtype=Int32)
    ],
    name="one_ts",
    source=source_one_ts
)


if __name__ == "__main__":
    STORE.delete_feature_view(one_ts.name)
    items_to_apply = [e2, one_ts, source_one_ts]
    STORE.apply(items_to_apply)

    STORE.write_to_online_store(
                feature_view_name=one_ts.name,
                inputs=pd.DataFrame(
                    [
                        {
                            "event_timestamp": datetime.datetime.now(),
                            "created_at": datetime.datetime.now(),
                            "f1": 12,
                            "e2": datetime.datetime.now(),
                        }
                    ]
                ),
            )

Make sure offline source is properly defined with the correct schema.

Specifications

  • Version: feast = {version = "^0.53.0", extras = ["redis"]}
    Current version is 0.53.0
  • Platform: Linux
  • Subsystem: Ubuntu 24.04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions