Title: fix: Ambiguous truth value of array during materialization by alan-gauthier-jt · Pull Request #6259 · feast-dev/feast · GitHub
Open Graph Title: fix: Ambiguous truth value of array during materialization by alan-gauthier-jt · Pull Request #6259 · feast-dev/feast
X Title: fix: Ambiguous truth value of array during materialization by alan-gauthier-jt · Pull Request #6259 · feast-dev/feast
Description: What this PR does / why we need it: feast materialize crashes with ValueError: The truth value of an empty array is ambiguous when a scalar feature column contains an empty numpy array (e.g. np.array([])). This is a real-world scenario when a DataFrame row has a missing value represented as an empty array rather than None or np.nan. Root cause: In _convert_scalar_values_to_proto (sdk/python/feast/type_map.py), the null check uses not pd.isnull(value) for every value in the loop. pd.isnull() is vectorised — when value is a numpy array, it returns a boolean array instead of a scalar. Applying Python's not operator to that array raises ValueError. The same issue exists in: the BOOL scalar path (not pd.isnull(value) in a list comprehension) the UNIX_TIMESTAMP early-return path (_python_datetime_to_int_timestamp(values) called with the raw values list, including any array-like values) the sample type-validation check (sample == 0) Fix: Before calling pd.isnull(), guard both scalar conversion loops (generic and BOOL) and the sample type-validation with an explicit isinstance(value, np.ndarray) check. Any array-like value in a scalar feature column is unmappable to a protobuf scalar field anyway, so it is safely treated as null → ProtoValue(). Input value Behaviour before Behaviour after np.array([]) (empty) ValueError crash ProtoValue() (null) np.array([np.nan, 1.0]) ValueError crash ProtoValue() (null) np.array([1.0, 2.0]) ValueError crash ProtoValue() (null) None ProtoValue() (null) unchanged scalar non-null ProtoValue(field=value) unchanged Which issue(s) this PR fixes: Fixes #6255 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 Misc
Open Graph Description: What this PR does / why we need it: feast materialize crashes with ValueError: The truth value of an empty array is ambiguous when a scalar feature column contains an empty numpy array (e.g. np.arr...
X Description: What this PR does / why we need it: feast materialize crashes with ValueError: The truth value of an empty array is ambiguous when a scalar feature column contains an empty numpy array (e.g. np.arr...
Opengraph URL: https://github.com/feast-dev/feast/pull/6259
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:6c6f5739-a0a5-c6a3-969e-50140e6c363d |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8AE2:18EF1B:59D45A0:7DDCB47:6A4FB2D3 |
| html-safe-nonce | f3baca789ba276dc2d869a7d5b9e816160f0f1e17b31c12df1c2c9bf04e54189 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QUUyOjE4RUYxQjo1OUQ0NUEwOjdERENCNDc6NkE0RkIyRDMiLCJ2aXNpdG9yX2lkIjoiMjUzOTEyODA5Mzg2OTU4NTEwNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5979472b8463f56babbdb25856f4725e40f4966b62e2b8873963f2bfbd961434 |
| hovercard-subject-tag | pull_request:3514157751 |
| 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/6259/files |
| twitter:image | https://avatars.githubusercontent.com/u/106987123?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/106987123?s=400&v=4 |
| og:image:alt | What this PR does / why we need it: feast materialize crashes with ValueError: The truth value of an empty array is ambiguous when a scalar feature column contains an empty numpy array (e.g. np.arr... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9 |
| 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 | 4b249b445842943ed31549e027f57a8ade9881ed |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width