René's URL Explorer Experiment


Title: OnDemandFeatureView.feature_transformation.infer_features does pass UDF outputs to python_type_to_feast_value_type · Issue #4308 · feast-dev/feast · GitHub

Open Graph Title: OnDemandFeatureView.feature_transformation.infer_features does pass UDF outputs to python_type_to_feast_value_type · Issue #4308 · feast-dev/feast

X Title: OnDemandFeatureView.feature_transformation.infer_features does pass UDF outputs to python_type_to_feast_value_type · Issue #4308 · feast-dev/feast

Description: Expected Behavior OnDemandFeatureView.feature_transformation.infer_features should be able to infer features from primitive python types for all supported feast data types, for all transformation backends. Current Behavior All on demand ...

Open Graph Description: Expected Behavior OnDemandFeatureView.feature_transformation.infer_features should be able to infer features from primitive python types for all supported feast data types, for all transformation b...

X Description: Expected Behavior OnDemandFeatureView.feature_transformation.infer_features should be able to infer features from primitive python types for all supported feast data types, for all transformation b...

Opengraph URL: https://github.com/feast-dev/feast/issues/4308

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"OnDemandFeatureView.feature_transformation.infer_features does pass UDF outputs to python_type_to_feast_value_type","articleBody":"## Expected Behavior \r\n\r\n`OnDemandFeatureView.feature_transformation.infer_features` should be able to infer features from primitive python types for all supported feast data types, for all transformation backends.\r\n\r\n## Current Behavior\r\n\r\nAll on demand feature views are currently broken for list types, as there is no way to bypass schema inference.\r\n\r\n### Details\r\n\r\n`OnDemandFeatureView.feature_transformation.infer_features` can only infer features in the type map inside `python_type_to_feast_value_type`, _i.e._\r\n\r\n```Python\r\ntype_map = {\r\n    \"int\": ValueType.INT64,\r\n    \"str\": ValueType.STRING,\r\n    \"string\": ValueType.STRING,  # pandas.StringDtype\r\n    \"float\": ValueType.DOUBLE,\r\n    \"bytes\": ValueType.BYTES,\r\n    \"float64\": ValueType.DOUBLE,\r\n    \"float32\": ValueType.FLOAT,\r\n    \"int64\": ValueType.INT64,\r\n    \"uint64\": ValueType.INT64,\r\n    \"int32\": ValueType.INT32,\r\n    \"uint32\": ValueType.INT32,\r\n    \"int16\": ValueType.INT32,\r\n    \"uint16\": ValueType.INT32,\r\n    \"uint8\": ValueType.INT32,\r\n    \"int8\": ValueType.INT32,\r\n    \"bool\": ValueType.BOOL,\r\n    \"boolean\": ValueType.BOOL,\r\n    \"timedelta\": ValueType.UNIX_TIMESTAMP,\r\n    \"timestamp\": ValueType.UNIX_TIMESTAMP,\r\n    \"datetime\": ValueType.UNIX_TIMESTAMP,\r\n    \"datetime64[ns]\": ValueType.UNIX_TIMESTAMP,\r\n    \"datetime64[ns, tz]\": ValueType.UNIX_TIMESTAMP,\r\n    \"category\": ValueType.STRING,\r\n}\r\n```\r\n\r\nThis is because if the type _e.g._ `ValueType.FLOAT_LIST` doesn't have a mapping in the dictionary above, and `value is None`, then `isinstance(value, dtype)` checks will fall through to the `ValueError` in `python_type_to_feast_value_type`.\r\n\r\n## Steps to reproduce\r\n\r\nInitialize a new repository:\r\n\r\n```bash\r\nfeast init\r\n```\r\n\r\nModify the sample `on_demand_feature_view` to return an array of floats instead of just floats, _e.g._\r\n\r\n```diff\r\ndiff --git a/true_garfish/feature_repo/example_repo.py b/true_garfish/feature_repo/example_repo.py\r\nindex 1f5b946..59d4501 100644\r\n--- a/true_garfish/feature_repo/example_repo.py\r\n+++ b/true_garfish/feature_repo/example_repo.py\r\n@@ -16,7 +16,7 @@ from feast import (\r\n from feast.feature_logging import LoggingConfig\r\n from feast.infra.offline_stores.file_source import FileLoggingDestination\r\n from feast.on_demand_feature_view import on_demand_feature_view\r\n-from feast.types import Float32, Float64, Int64\r\n+from feast.types import Float32, Float64, Int64, Array\r\n \r\n # Define an entity for the driver. You can think of an entity as a primary key used to\r\n # fetch features.\r\n@@ -72,15 +72,16 @@ input_request = RequestSource(\r\n @on_demand_feature_view(\r\n     sources=[driver_stats_fv, input_request],\r\n     schema=[\r\n-        Field(name=\"conv_rate_plus_val1\", dtype=Float64),\r\n-        Field(name=\"conv_rate_plus_val2\", dtype=Float64),\r\n+        Field(name=\"conv_rate_plus_vals\", dtype=Array(Float64)),\r\n     ],\r\n )\r\n def transformed_conv_rate(inputs: pd.DataFrame) -\u003e pd.DataFrame:\r\n-    df = pd.DataFrame()\r\n-    df[\"conv_rate_plus_val1\"] = inputs[\"conv_rate\"] + inputs[\"val_to_add\"]\r\n-    df[\"conv_rate_plus_val2\"] = inputs[\"conv_rate\"] + inputs[\"val_to_add_2\"]\r\n-    return df\r\n+    result = {\"conv_rate_plus_vals\": []}\r\n+    for _, row in inputs.iterrows():\r\n+        result[\"conv_rate_plus_vals\"].append(\r\n+            [row[\"conv_rate\"] + row[\"val_to_add\"], row[\"conv_rate\"] + row[\"val_to_add_2\"]]\r\n+        )\r\n+    return pd.DataFrame(data=result)\r\n```\r\n\r\n3. Run `feast apply`, and you should get the following error:\r\n\r\n```bash\r\nTraceback (most recent call last):\r\n  File \"~/.../.venv/bin/feast\", line 8, in \u003cmodule\u003e\r\n    sys.exit(cli())\r\n             ^^^^^\r\n  File \"~/.../.venv/lib/python3.12/site-packages/click/core.py\", line 1157, in __call__\r\n    return self.main(*args, **kwargs)\r\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n  File \"~/.../.venv/lib/python3.12/site-packages/click/core.py\", line 1078, in main\r\n    rv = self.invoke(ctx)\r\n         ^^^^^^^^^^^^^^^^\r\n  File \"~/.../.venv/lib/python3.12/site-packages/click/core.py\", line 1688, in invoke\r\n    return _process_result(sub_ctx.command.invoke(sub_ctx))\r\n                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n  File \"~/.../.venv/lib/python3.12/site-packages/click/core.py\", line 1434, in invoke\r\n    return ctx.invoke(self.callback, **ctx.params)\r\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n  File \"~/.../.venv/lib/python3.12/site-packages/click/core.py\", line 783, in invoke\r\n    return __callback(*args, **kwargs)\r\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n  File \"~/.../.venv/lib/python3.12/site-packages/click/decorators.py\", line 33, in new_func\r\n    return f(get_current_context(), *args, **kwargs)\r\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n  File \"~/.../.venv/lib/python3.12/site-packages/feast/cli.py\", line 506, in apply_total_command\r\n    apply_total(repo_config, repo, skip_source_validation)\r\n  File \"~/.../.venv/lib/python3.12/site-packages/feast/repo_operations.py\", line 347, in apply_total\r\n    apply_total_with_repo_instance(\r\n  File \"~/.../.venv/lib/python3.12/site-packages/feast/repo_operations.py\", line 299, in apply_total_with_repo_instance\r\n    registry_diff, infra_diff, new_infra = store.plan(repo)\r\n                                           ^^^^^^^^^^^^^^^^\r\n  File \"~/.../.venv/lib/python3.12/site-packages/feast/feature_store.py\", line 745, in plan\r\n    self._make_inferences(\r\n  File \"~/.../.venv/lib/python3.12/site-packages/feast/feature_store.py\", line 640, in _make_inferences\r\n    odfv.infer_features()\r\n  File \"~/.../.venv/lib/python3.12/site-packages/feast/on_demand_feature_view.py\", line 521, in infer_features\r\n    inferred_features = self.feature_transformation.infer_features(\r\n                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n  File \"~/....venv/lib/python3.12/site-packages/feast/transformation/pandas_transformation.py\", line 47, in infer_features\r\n    python_type_to_feast_value_type(f, type_name=str(dt))\r\n  File \"~/.../.venv/lib/python3.12/site-packages/feast/type_map.py\", line 215, in python_type_to_feast_value_type\r\n    raise ValueError(\r\nValueError: Value with native type object cannot be converted into Feast value type\r\n```\r\n\r\nAdding some debug statements inside `python_type_to_feast_value_type`, we get the following locals before the error was raised:\r\n\r\n```\r\nname='conv_rate_plus_vals'\r\nvalue=None\r\nrecurse=True\r\ntype_name='object'\r\ntype(value)=\u003cclass 'NoneType'\u003e\r\n``` \r\n\r\nAs mentioned before this is because all transformation backends don't pass values to the type mapper, _e.g._ the [pandas backend in this case](https://github.com/feast-dev/feast/blob/master/sdk/python/feast/transformation/pandas_transformation.py#L47) \r\n\r\n### Specifications\r\n\r\n- Version: 0.39.0\r\n- Platform: arm64\r\n- Subsystem: MacOS\r\n\r\n## Possible Solution\r\n\r\n- Pass the sample values generated for type inference through to the type mapper\r\n- Update the type mapper to handle lists that are two levels deep. This is because primitive UDF outputs are wrapped in either a `np.array` or `list` of length 1, so therefore lists should be two levels deep with the inner list being the list of feature values.\r\n","author":{"url":"https://github.com/alexmirrington","@type":"Person","name":"alexmirrington"},"datePublished":"2024-06-24T08:49:49.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/4308/feast/issues/4308"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:c8a5b44a-e9a8-3186-386e-557bf074bab4
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9998:337619:1F8F43D:2C4A84A:696F6308
html-safe-nonce875e41d3fda8ef2e66f3c73a842cd63d2384341970dadfc960dddbeee7c016b2
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OTk4OjMzNzYxOToxRjhGNDNEOjJDNEE4NEE6Njk2RjYzMDgiLCJ2aXNpdG9yX2lkIjoiNzgzODU5OTIzMTQ4NzA0MjMxMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac7ebb1a0a515ec324a419a358eb9c3c25e88a4bdef843649041450fbfd7dc5308
hovercard-subject-tagissue:2369631868
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/feast-dev/feast/4308/issue_layout
twitter:imagehttps://opengraph.githubassets.com/921bf562874d42dbdbba7b00868b25008f9eeec52b9c24e20b087a53b26ad4fd/feast-dev/feast/issues/4308
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/921bf562874d42dbdbba7b00868b25008f9eeec52b9c24e20b087a53b26ad4fd/feast-dev/feast/issues/4308
og:image:altExpected Behavior OnDemandFeatureView.feature_transformation.infer_features should be able to infer features from primitive python types for all supported feast data types, for all transformation b...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamealexmirrington
hostnamegithub.com
expected-hostnamegithub.com
None774d0922d2c4577043d2dab90427344eb4c6ce1d5579acb1dd504cff1a7e46f8
turbo-cache-controlno-preview
go-importgithub.com/feast-dev/feast git https://github.com/feast-dev/feast.git
octolytics-dimension-user_id57027613
octolytics-dimension-user_loginfeast-dev
octolytics-dimension-repository_id161133770
octolytics-dimension-repository_nwofeast-dev/feast
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id161133770
octolytics-dimension-repository_network_root_nwofeast-dev/feast
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release650acea592f12d1bd8931d44546c209e0b06ed6e
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/feast-dev/feast/issues/4308#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ffeast-dev%2Ffeast%2Fissues%2F4308
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ffeast-dev%2Ffeast%2Fissues%2F4308
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=feast-dev%2Ffeast
Reloadhttps://github.com/feast-dev/feast/issues/4308
Reloadhttps://github.com/feast-dev/feast/issues/4308
Reloadhttps://github.com/feast-dev/feast/issues/4308
feast-dev https://github.com/feast-dev
feasthttps://github.com/feast-dev/feast
Notifications https://github.com/login?return_to=%2Ffeast-dev%2Ffeast
Fork 1.2k https://github.com/login?return_to=%2Ffeast-dev%2Ffeast
Star 6.6k https://github.com/login?return_to=%2Ffeast-dev%2Ffeast
Code https://github.com/feast-dev/feast
Issues 176 https://github.com/feast-dev/feast/issues
Pull requests 58 https://github.com/feast-dev/feast/pulls
Discussions https://github.com/feast-dev/feast/discussions
Actions https://github.com/feast-dev/feast/actions
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/feast-dev/feast/security
Please reload this pagehttps://github.com/feast-dev/feast/issues/4308
Insights https://github.com/feast-dev/feast/pulse
Code https://github.com/feast-dev/feast
Issues https://github.com/feast-dev/feast/issues
Pull requests https://github.com/feast-dev/feast/pulls
Discussions https://github.com/feast-dev/feast/discussions
Actions https://github.com/feast-dev/feast/actions
Security https://github.com/feast-dev/feast/security
Insights https://github.com/feast-dev/feast/pulse
New issuehttps://github.com/login?return_to=https://github.com/feast-dev/feast/issues/4308
New issuehttps://github.com/login?return_to=https://github.com/feast-dev/feast/issues/4308
#4310https://github.com/feast-dev/feast/pull/4310
OnDemandFeatureView.feature_transformation.infer_features does pass UDF outputs to python_type_to_feast_value_typehttps://github.com/feast-dev/feast/issues/4308#top
#4310https://github.com/feast-dev/feast/pull/4310
kind/bughttps://github.com/feast-dev/feast/issues?q=state%3Aopen%20label%3A%22kind%2Fbug%22
priority/p2https://github.com/feast-dev/feast/issues?q=state%3Aopen%20label%3A%22priority%2Fp2%22
https://github.com/alexmirrington
https://github.com/alexmirrington
alexmirringtonhttps://github.com/alexmirrington
on Jun 24, 2024https://github.com/feast-dev/feast/issues/4308#issue-2369631868
pandas backend in this casehttps://github.com/feast-dev/feast/blob/master/sdk/python/feast/transformation/pandas_transformation.py#L47
kind/bughttps://github.com/feast-dev/feast/issues?q=state%3Aopen%20label%3A%22kind%2Fbug%22
priority/p2https://github.com/feast-dev/feast/issues?q=state%3Aopen%20label%3A%22priority%2Fp2%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.