Title: File source `get_histroical_features` get wrong result · Issue #3360 · feast-dev/feast · GitHub
Open Graph Title: File source `get_histroical_features` get wrong result · Issue #3360 · feast-dev/feast
X Title: File source `get_histroical_features` get wrong result · Issue #3360 · feast-dev/feast
Description: Expected Behavior if Feast has data with same keys, then run get_historical_features' get latest data by created time' but it doesn't work expected way Current Behavior if duplicated data on same keys are over 3 copies (diffrent 'created...
Open Graph Description: Expected Behavior if Feast has data with same keys, then run get_historical_features' get latest data by created time' but it doesn't work expected way Current Behavior if duplicated data on same k...
X Description: Expected Behavior if Feast has data with same keys, then run get_historical_features' get latest data by created time' but it doesn't work expected way Current Behavior if duplicated da...
Opengraph URL: https://github.com/feast-dev/feast/issues/3360
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"File source `get_histroical_features` get wrong result ","articleBody":"## Expected Behavior \r\n- if Feast has data with same keys, then run `get_historical_features' get latest data by `created time' \r\n- but it doesn't work expected way\r\n\r\n## Current Behavior\r\n- if duplicated data on same keys are over 3 copies (diffrent 'created time') , feast cannot give right result\r\n\r\n## Steps to reproduce\r\n```\r\ndata = pd.read_parquet(\"data/driver_stats.parquet\")\r\n\r\nnew_data = data.copy()\r\nnew_data['avg_daily_trips'] = new_data['avg_daily_trips'] + 1000\r\nnew_data['event_timestamp'] = new_data['event_timestamp']\r\nnew_data['created'] = pd.Timestamp.now()\r\n\r\nmerged_df = pd.concat([data, new_data]).reset_index(drop=True)\r\nmerged_df.to_parquet(\"./data/driver_stats.parquet\")\r\n\r\nstore = FeatureStore(\".\")\r\nentity_df = pd.DataFrame.from_dict(\r\n {\r\n # entity's join key -> entity values\r\n \"driver_id\": [1001, 1002, 1003],\r\n # \"event_timestamp\" (reserved key) -> timestamps\r\n \"event_timestamp\": [\r\n datetime(2022, 11, 20, 23, 00, 42),\r\n datetime(2022, 11, 20, 23, 00, 42),\r\n datetime(2022, 11, 20, 23, 00, 42),\r\n ]\r\n }\r\n )\r\ntraining_df = store.get_historical_features(\r\n entity_df=entity_df,\r\n features=[\r\n \"driver_hourly_stats:conv_rate\",\r\n \"driver_hourly_stats:acc_rate\",\r\n \"driver_hourly_stats:avg_daily_trips\"\r\n ],\r\n ).to_df()\r\ntraining_df # it is right, result has (plus+1000) datas\r\n```\r\n\u003cimg width=\"742\" alt=\"스크린샷 2022-11-24 오후 12 50 40\" src=\"https://user-images.githubusercontent.com/32768535/203689933-52334d04-24ec-453c-af69-da169896541c.png\">\r\n\r\n-------\r\n```\r\nnew_data = data.copy()\r\nnew_data['avg_daily_trips'] = new_data['avg_daily_trips'] + 10000\r\nnew_data['event_timestamp'] = new_data['event_timestamp']\r\nnew_data['created'] = pd.Timestamp.now()\r\n# this \"merged_df\" which is merged by pd.concat is above one.\r\nmerged_df = pd.concat([merged_df, new_data]).reset_index(drop=True)\r\nmerged_df.to_parquet(\"./data/driver_stats.parquet\")\r\n\r\nstore = FeatureStore(\".\")\r\nentity_df = pd.DataFrame.from_dict(\r\n {\r\n # entity's join key -> entity values\r\n \"driver_id\": [1001, 1002, 1003],\r\n # \"event_timestamp\" (reserved key) -> timestamps\r\n \"event_timestamp\": [\r\n datetime(2022, 11, 20, 23, 00, 42),\r\n datetime(2022, 11, 20, 23, 00, 42),\r\n datetime(2022, 11, 20, 23, 00, 42),\r\n ]\r\n }\r\n )\r\ntraining_df = store.get_historical_features(\r\n entity_df=entity_df,\r\n features=[\r\n \"driver_hourly_stats:conv_rate\",\r\n \"driver_hourly_stats:acc_rate\",\r\n \"driver_hourly_stats:avg_daily_trips\"\r\n ],\r\n ).to_df()\r\ntraining_df \r\n```\r\nabove is wrong, in my pc result is\r\n\u003cimg width=\"746\" alt=\"스크린샷 2022-11-24 오후 12 50 26\" src=\"https://user-images.githubusercontent.com/32768535/203689907-f88aa9a4-760e-4a2f-8710-76f85428939b.png\">\r\n\r\n### Specifications\r\n\r\n- Version: Feast SDK Version: \"feast 0.26.0\"\r\n- Platform: M1 mac\r\n- Subsystem: local\r\n\r\n## Possible Solution\r\n- This problem seems to have arisen because of pandas sorting & drop_duplicates. but i'm not sure.\r\n- if it is not a but, let me know how to fix that.","author":{"url":"https://github.com/GyuminJack","@type":"Person","name":"GyuminJack"},"datePublished":"2022-11-24T03:53:40Z","url":"https://github.com/feast-dev/feast/issues/3360"}
| 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 | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:781c7829-cf70-c786-bccf-d3f94b4012ee |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DF50:1D85AC:EC9281:1427AF9:6AFE9535 |
| html-safe-nonce | a71be73a749f029a54d8fd4d587e70969c1dd75195936ada249059fc5e26fa62 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjUwOjFEODVBQzpFQzkyODE6MTQyN0FGOTo2QUZFOTUzNSIsInZpc2l0b3JfaWQiOiI1NTQ1NzU0NTE5OTE0MDU5MDYxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | caf0c97b813d118d81233240d655230e24f24d5c458ab8545034f124f97c0fcf |
| hovercard-subject-tag | issue:1462716719 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/feast-dev/feast/3360/issue_layout |
| twitter:image | https://opengraph.githubassets.com/de1144db33dbf3141929926f3772b5771181274aa9dbdf54f6996f7ae4be7ea4/feast-dev/feast/issues/3360 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/de1144db33dbf3141929926f3772b5771181274aa9dbdf54f6996f7ae4be7ea4/feast-dev/feast/issues/3360 |
| og:image:alt | Expected Behavior if Feast has data with same keys, then run get_historical_features' get latest data by created time' but it doesn't work expected way Current Behavior if duplicated data on same k... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | GyuminJack |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| turbo-cache-control | no-preview |
| 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 |
| disable-turbo | false |
| 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 |
| react-app-name | issues |
Links:
Viewport: width=device-width