Title: `__eq__` raises TypeError on cross-type comparison instead of returning NotImplemented · Issue #6636 · feast-dev/feast · GitHub
Open Graph Title: `__eq__` raises TypeError on cross-type comparison instead of returning NotImplemented · Issue #6636 · feast-dev/feast
X Title: `__eq__` raises TypeError on cross-type comparison instead of returning NotImplemented · Issue #6636 · feast-dev/feast
Description: Expected Behavior Comparing two Feast objects of different concrete types (e.g. FileSource vs SnowflakeSource) returns False, per Python's data model. In particular, changing a feature view's data source type and re-running feast apply o...
Open Graph Description: Expected Behavior Comparing two Feast objects of different concrete types (e.g. FileSource vs SnowflakeSource) returns False, per Python's data model. In particular, changing a feature view's data ...
X Description: Expected Behavior Comparing two Feast objects of different concrete types (e.g. FileSource vs SnowflakeSource) returns False, per Python's data model. In particular, changing a feature view'...
Opengraph URL: https://github.com/feast-dev/feast/issues/6636
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`__eq__` raises TypeError on cross-type comparison instead of returning NotImplemented","articleBody":"## Expected Behavior\n\nComparing two Feast objects of different concrete types (e.g. `FileSource` vs `SnowflakeSource`)\nreturns `False`, per Python's data model. In particular, changing a feature view's data source\ntype and re-running `feast apply` over an existing registry succeeds.\n\n## Current Behavior\n\n`__eq__` raises `TypeError` on a cross-type comparison instead of returning `False`. Because the\napply/diff path compares registered objects against incoming ones, changing a source type and\nre-applying crashes:\n\n```\nTypeError: Comparisons should only involve FileSource class objects.\n```\n\nMinimal repro:\n\n```python\nfrom feast import FileSource\nfrom feast.infra.offline_stores.snowflake_source import SnowflakeSource\na = FileSource(name=\"x\", path=\"/tmp/x.parquet\", timestamp_field=\"ts\")\nb = SnowflakeSource(name=\"x\", database=\"D\", schema=\"S\", table=\"T\", timestamp_field=\"ts\")\na == b # TypeError — should be False\n```\n\nRoot cause: the affected `__eq__` methods do\n`if not isinstance(other, X): raise TypeError(\"Comparisons should only involve X class objects.\")`.\nPython's data model requires `__eq__` to return `NotImplemented` for an unrecognized operand (so\nthe interpreter can try the reflected op and fall back to identity → `False`), never raise.\n\nThis is **systemic** — the pattern appears in ~35 `__eq__` methods across the object model:\n`DataSource` and its `Kafka`/`Request`/`Kinesis` subclasses; all offline sources (`file`,\n`snowflake`, `bigquery`, `redshift`, and the `ray`/`couchbase`/`trino`/`oracle`/`athena`/`mssql`/\n`postgres` contrib sources); plus `Entity`, `FeatureView`, `BaseFeatureView`, `OnDemandFeatureView`,\n`StreamFeatureView`, `FeatureService`, `SavedDataset`, `Project`, `ProjectMetadata`, the four\n`transformation/*` classes, `Aggregation`, `LabelView`, `Permission`, and the `RoleBasedPolicy` /\n`GroupBasedPolicy` / `NamespaceBasedPolicy` / `CombinedGroupNamespacePolicy` policies.\n`PushSource.__eq__` already does the right thing (`return False`), so the correct pattern is\nalready in-tree.\n\n## Steps to reproduce\n\nRun the snippet above, or: define a feature view on a `FileSource` and `feast apply`; change that\nfeature view's source to a `SnowflakeSource` (same name) and `feast apply` again → crash.\n\n### Specifications\n\n- Version: 0.64.0 and 0.65.0 / master (verified; pattern unchanged)\n- Subsystem: core object model (`sdk/python/feast`)\n\n## Possible Solution\n\nReplace each `raise TypeError(\"Comparisons should only involve …\")` in these `__eq__` methods with\n`return False`, matching `PushSource.__eq__`, which already handles a cross-type comparison this\nway. `PushSource` is the one `__eq__` that does this correctly today, and there is no\n`return NotImplemented` anywhere in the codebase, so `return False` keeps a single consistent\nconvention rather than introducing a new one. (`NotImplemented` would be the stricter data-model\nanswer and would also let a reflected/matcher `__eq__` participate, but the codebase already\nforgoes that everywhere.)\n\nAdd a unit test asserting cross-type equality returns `False` (not a raise). This can be one sweep\nacross all 35 sites (uniform and mechanical) or scoped to the `DataSource` hierarchy (where the\ncrash reproduces) with a follow-up for the rest — happy to do whichever the maintainers prefer.\nPR incoming.\n","author":{"url":"https://github.com/larrysingleton007","@type":"Person","name":"larrysingleton007"},"datePublished":"2026-07-23T14:31:03Z","url":"https://github.com/feast-dev/feast/issues/6636"}
| 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:26f5c2c4-4f35-67af-1d55-0ff9ab5cf9a5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D702:288779:2D439A:3E7C99:6AFE981C |
| html-safe-nonce | 4b7f45fcfd38f273c4a0aa80ac929fb6bca8331bfbb9076fa3e1d7db0794ac95 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzAyOjI4ODc3OToyRDQzOUE6M0U3Qzk5OjZBRkU5ODFDIiwidmlzaXRvcl9pZCI6IjE5ODI1MDE4NjEzMjc4MDQ0NDQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0da625bd538e5804a47cadcf89a9a3df44a2be69fe718e500f37ae23d3823b29 |
| hovercard-subject-tag | issue:4959857523 |
| 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/6636/issue_layout |
| twitter:image | https://opengraph.githubassets.com/543c1227f5d7e81270cdda896b1240cdb18c343517d70b9885fc8c5820ac4dd2/feast-dev/feast/issues/6636 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/543c1227f5d7e81270cdda896b1240cdb18c343517d70b9885fc8c5820ac4dd2/feast-dev/feast/issues/6636 |
| og:image:alt | Expected Behavior Comparing two Feast objects of different concrete types (e.g. FileSource vs SnowflakeSource) returns False, per Python's data model. In particular, changing a feature view's data ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | larrysingleton007 |
| 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