Title: fix: Serialize UUID and TimeUuid entity keys by MohammadHijjawi97 · Pull Request #7032 · feast-dev/feast · GitHub
Open Graph Title: fix: Serialize UUID and TimeUuid entity keys by MohammadHijjawi97 · Pull Request #7032 · feast-dev/feast
X Title: fix: Serialize UUID and TimeUuid entity keys by MohammadHijjawi97 · Pull Request #7032 · feast-dev/feast
Description: What this PR does / why we need it: An entity whose join key is a Uuid or TimeUuid can be applied, but materializing its feature view fails, because _serialize_val in key_encoding_utils.py only handles string, bytes, int32, int64 and unix timestamp values. The features never reach the online store, so they cannot be served. This affects every online store that builds its keys with serialize_entity_key (SQLite, Redis, DynamoDB, ...). Reproduction (local provider, FileSource, SQLite online store): session = Entity(name="session", join_keys=["session_id"], value_type=ValueType.UUID) fv = FeatureView( name="fv", entities=[session], schema=[Field(name="session_id", dtype=Uuid), Field(name="score", dtype=Float32)], source=FileSource(path="s.parquet", timestamp_field="event_timestamp"), ttl=timedelta(days=1), ) store.apply([session, fv]) store.materialize(now - timedelta(days=1), now) store.get_online_features( features=["fv:score"], entity_rows=[{"session_id": u1}, {"session_id": str(u2)}] ).to_dict() Before: File ".../feast/infra/online_stores/sqlite.py", line 332, in online_write_batch entity_key_bin = serialize_entity_key( File ".../feast/infra/key_encoding_utils.py", line 181, in serialize_entity_key val_bytes, value_type = _serialize_val( ValueError: Value type not supported for feast feature store: uuid_val: "8b97f8f4-af3b-40e2-9b57-d2c02d0a6687" After: {'session_id': [UUID('0d41a235-...'), UUID('e1f8e126-...')], 'score': [1.0, 2.0]} (same result with a TimeUuid entity) The fix encodes uuid_val and time_uuid_val as their UTF-8 string with the UUID / TIME_UUID value type tags, the same way string keys are encoded, and _deserialize_value decodes them back so deserialize_entity_key round-trips. Existing key types are encoded exactly as before. This covers the Python serialization path. Which issue(s) this PR fixes: No existing issue; found while using a UUID join key. Checks I've made sure the tests are passing. My commits are signed off (git commit -s) My PR title follows conventional commits format Testing Strategy Unit tests Integration tests Manual tests Testing is not required for this change Added test_serialize_deserialize_uuid_entity (Uuid and TimeUuid) to sdk/python/tests/unit/infra/test_key_encoding_utils.py; both cases fail without the change and pass with it (16/16 in that file). ruff check, ruff format --check and mypy on the changed module pass. Misc
Open Graph Description: What this PR does / why we need it: An entity whose join key is a Uuid or TimeUuid can be applied, but materializing its feature view fails, because _serialize_val in key_encoding_utils.py only han...
X Description: What this PR does / why we need it: An entity whose join key is a Uuid or TimeUuid can be applied, but materializing its feature view fails, because _serialize_val in key_encoding_utils.py only han...
Opengraph URL: https://github.com/feast-dev/feast/pull/7032
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:764f2396-4099-40c6-20b1-2b3d5369f78b |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 977A:19DC88:DE52F2:130C12C:6AFE925F |
| html-safe-nonce | 06ca19d667309d303aac86c69c33cb79c442d9b72197ff9c4715e0ce9c07b99e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NzdBOjE5REM4ODpERTUyRjI6MTMwQzEyQzo2QUZFOTI1RiIsInZpc2l0b3JfaWQiOiIxMzE1OTA2MjI4NTQxNTY4OTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 47a3e62ebec40a74553e05a98155351e7632ee81418cdb091620f9c33d44fe90 |
| hovercard-subject-tag | pull_request:4904974292 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/feast-dev/feast/pull/7032/files |
| twitter:image | https://avatars.githubusercontent.com/u/51020382?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/51020382?s=400&v=4 |
| og:image:alt | What this PR does / why we need it: An entity whose join key is a Uuid or TimeUuid can be applied, but materializing its feature view fails, because _serialize_val in key_encoding_utils.py only han... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/feast-dev/feast git https://github.com/feast-dev/feast.git |
| octolytics-dimension-user_id | 57027613 |
| octolytics-dimension-user_login | feast-dev |
| octolytics-dimension-repository_id | 161133770 |
| octolytics-dimension-repository_nwo | feast-dev/feast |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 161133770 |
| octolytics-dimension-repository_network_root_nwo | feast-dev/feast |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4a10310af51a1bfffbedc4fd81cb582acf0cb0ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width