Repository navigation
Commit 0f149a9
authored
fix: Return False from __eq__ on cross-type comparison (#6637)
* fix: Return False from __eq__ on cross-type comparison
Every registry object's __eq__ did
`if not isinstance(other, X): raise TypeError("Comparisons should only involve X class objects.")`.
Raising from __eq__ on an operand of a different type is wrong: comparing
objects of different types should be False, not an error. As a result, changing
a feature view's data source type and re-applying over an existing registry
crashed with `TypeError: Comparisons should only involve <X> class objects.`
Replace the raise with `return False` across all 35 affected __eq__ methods,
matching PushSource.__eq__ which already handles a cross-type comparison this
way. Update the LabelView equality test (it asserted the removed TypeError) and
add cross-type regression tests for DataSource, Entity, and policy objects, all
asserting False rather than a raise.
Signed-off-by: Larry Singleton <[email protected]>
* test: Add parametrized cross-type __eq__ coverage across the object model
Assert that cross-type comparison returns False (never raises) for the
importable core types touched by the sweep: Entity, Project, Aggregation,
Permission, all four policies, the Kafka/Kinesis/Request and
File/BigQuery/Redshift/Snowflake sources, FeatureView, and FeatureService.
Complements the existing per-type tests (DataSource, Entity, LabelView,
RoleBasedPolicy) and raises patch coverage on the sweep. Contrib sources and
optional-dependency transformations are omitted since the unit env can't
import them.
Signed-off-by: Larry Singleton <[email protected]>
* fix: Guard SparkSource, Feature, and data format __eq__ against cross-type comparison
SparkSource.__eq__ passed the shared DataSource base check for any
DataSource subclass and then accessed spark-only attributes, so comparing
against a FileSource with a matching name raised AttributeError instead
of returning False (reported on #6636 when swapping a FeatureView's
source from FileSource to SparkSource). Feature.__eq__ and the
FileFormat/StreamFormat __eq__ accessed attributes of the other operand
unguarded and failed the same way; they raised AttributeError rather
than the TypeError pattern, which is why the original sweep missed them.
Signed-off-by: Larry Singleton <[email protected]>
---------
Signed-off-by: Larry Singleton <[email protected]>1 parent abffebc commit 0f149a9
37 files changed
Lines changed: 214 additions & 91 deletions
File tree
- sdk/python
- feast
- aggregation
- infra/offline_stores
- contrib
- athena_offline_store
- couchbase_offline_store
- mssql_offline_store
- oracle_offline_store
- postgres_offline_store
- ray_offline_store
- spark_offline_store
- trino_offline_store
- labeling
- permissions
- transformation
- tests/unit
- permissions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
176 | | - | |
177 | | - | |
| 175 | + | |
178 | 176 | | |
179 | 177 | | |
180 | 178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| |||
95 | 97 | | |
96 | 98 | | |
97 | 99 | | |
| 100 | + | |
| 101 | + | |
98 | 102 | | |
99 | 103 | | |
100 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
282 | | - | |
| 282 | + | |
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
| |||
499 | 499 | | |
500 | 500 | | |
501 | 501 | | |
502 | | - | |
503 | | - | |
504 | | - | |
| 502 | + | |
505 | 503 | | |
506 | 504 | | |
507 | 505 | | |
| |||
639 | 637 | | |
640 | 638 | | |
641 | 639 | | |
642 | | - | |
643 | | - | |
644 | | - | |
| 640 | + | |
645 | 641 | | |
646 | 642 | | |
647 | 643 | | |
| |||
801 | 797 | | |
802 | 798 | | |
803 | 799 | | |
804 | | - | |
805 | | - | |
806 | | - | |
| 800 | + | |
807 | 801 | | |
808 | 802 | | |
809 | 803 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
296 | | - | |
297 | | - | |
298 | | - | |
| 296 | + | |
299 | 297 | | |
300 | 298 | | |
301 | 299 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
398 | | - | |
399 | | - | |
400 | | - | |
| 398 | + | |
401 | 399 | | |
402 | 400 | | |
403 | 401 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
101 | | - | |
102 | | - | |
| 100 | + | |
103 | 101 | | |
104 | 102 | | |
105 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
119 | | - | |
120 | | - | |
| 118 | + | |
121 | 119 | | |
122 | 120 | | |
123 | 121 | | |
| |||
0 commit comments