Repository navigation
fix: Resolve SortedFeatureView lookups and materialization in SqlRegistry - #386
Merged
Merged
Conversation
…stry - _get_any_feature_view raised FeatureViewNotFoundException at the stream_feature_views lookup, so sorted_feature_views was never checked. Breaks get_any_feature_view for every SortedFeatureView on a cold or bypassed cache, including the GetAnyFeatureView and GetMaterializationIntervalHistory gRPC handlers. - _infer_fv_classes checked FeatureView before its SortedFeatureView subclass, so apply_materialization decoded sorted rows with FeatureViewProto (UnpicklingError, or sort_keys silently dropped). - SqlFallbackRegistry.get_any_feature_view cached SortedFeatureViews in cached_feature_views, so get_feature_view(allow_cache=True) could return one and the plain cache refresh evicted it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: piket <timonpike@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What this PR does / why we need it:
Fixes three bugs in
SqlRegistry/SqlFallbackRegistrythat break SortedFeatureViews. These are the registries behindeg-feature-store-registryandmlpfs-remote-registry.1.
get_any_feature_viewnever finds a SortedFeatureViewSqlRegistry._get_any_feature_viewchecksfeature_views, thenon_demand_feature_views, thenstream_feature_views, thensorted_feature_views. The stream lookup passednot_found_exception=FeatureViewNotFoundException, so it raised before the sorted table was ever checked. Everyget_any_feature_viewcall for a SortedFeatureView fails whenever the cache is cold or bypassed, including:GetAnyFeatureView(used byRemoteRegistry.get_any_feature_view)GetMaterializationIntervalHistory, which resolves the view for its permission checkutils._get_feature_views_to_use, the retrieval path, on a cache missReproduced against the test
mlpfs-remote-registry(read-only):GetAnyFeatureViewfor a sorted view returnsNotFoundwithallow_cache=false. It only succeeds withallow_cache=truewhen the cache is already warm.Fix:
not_found_exception=Noneon the stream lookup. The final sorted lookup still raisesFeatureViewNotFoundExceptionfor unknown names, so behaviour for missing views is unchanged.2.
apply_materializationcorrupts SortedFeatureViews_infer_fv_classescheckedisinstance(fv, FeatureView)beforeSortedFeatureView, which is aFeatureViewsubclass. Soapply_materializationread the row fromsorted_feature_views(_infer_fv_tablealready had the right order) but decoded it withFeatureViewProto.SortedFeatureViewSpec.original_entitiesandFeatureViewSpec.feature_transformationare both field 15, so this either raisesUnpicklingError/EOFErrorfromdill, or, for a view with no entities, silently writes the row back withoutsort_keys. This is why eg-feature-store-registry#199 currently returns 501 for sorted-view materialization.Fix: check
SortedFeatureViewbeforeFeatureView, matching_infer_fv_table.3.
SqlFallbackRegistry.get_any_feature_viewcaches SortedFeatureViews in the wrong cacheIt stored SortedFeatureViews in
cached_feature_views. As a result,get_feature_view(name, allow_cache=True)could return a SortedFeatureView, and the plain-view cache refresh (which re-reads via_get_feature_view) evicted it as not found.Fix: cache SortedFeatureViews in
cached_sorted_feature_views.Tests
9 new unit tests. The new tests fail without the fix (5 failures, 2 fixture errors) and pass with it.
test_sql_registry.pyget_any_feature_viewreturns a SortedFeatureView (withsort_keys), returns a plain FeatureView, and raises for an unknown name.apply_materializationon a SortedFeatureView keepssort_keysand sort order, caps intervals, archives history, and doesn't create afeature_viewsrow.SqlFallbackRegistry: a sorted view is cached in the sorted cache,get_feature_view(allow_cache=True)doesn't return it, and cachedget_any_feature_viewstill does.test_materialization_interval_history_rpc.pyGetMaterializationIntervalHistoryandGetAnyFeatureView(allow_cache=false)handlers work for a SortedFeatureView.Run locally:
tests/unit/infra/registry+ feature view / sorted feature view unit tests: 96 passedregistry_server/sql_fallback/sorted: 73 passedtest_universal_registry.py(sqlite / local variants): 7 passed. Postgres/MySQL variants need Docker and are left to CI.ruff check,ruff format --check,mypyon changed files: cleanWhich issue(s) this PR fixes:
Misc
Follow-ups once released:
GetAnyFeatureView/GetMaterializationIntervalHistoryfor sorted views.apply_materialization_interval, with its test.Not in scope: gRPC
ApplyFeatureView's permission check looks the view up withget_feature_view, which only searches plain views. It's skipped underwrite_auth_only, but would matter under full RBAC.🤖 Generated with Claude Code