Skip to content

Commit b7a060d

Browse files
fix: Add __eq__, __hash__ to SparkSource for comparision
Signed-off-by: tanlocnguyen <tanlocnguyen296@gmail.com>
1 parent 8eb0c59 commit b7a060d

File tree

1 file changed

+30
-0
lines changed
  • sdk/python/feast/infra/offline_stores/contrib/spark_offline_store

1 file changed

+30
-0
lines changed

sdk/python/feast/infra/offline_stores/contrib/spark_offline_store/spark_source.py

+30
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,36 @@ def get_table_query_string(self) -> str:
184184
df.createOrReplaceTempView(tmp_table_name)
185185

186186
return f"`{tmp_table_name}`"
187+
188+
def __eq__(self, other):
189+
if other is None:
190+
return False
191+
192+
if not isinstance(other, SparkSource):
193+
raise TypeError("Comparisons should only involve SparkSource class objects.")
194+
195+
if (
196+
self.name != other.name
197+
or self.timestamp_field != other.timestamp_field
198+
or self.created_timestamp_column != other.created_timestamp_column
199+
or self.field_mapping != other.field_mapping
200+
or self.date_partition_column != other.date_partition_column
201+
or self.description != other.description
202+
or self.tags != other.tags
203+
or self.owner != other.owner
204+
):
205+
return False
206+
if self.table != other.table:
207+
return False
208+
if self.query != other.query:
209+
return False
210+
if self.path != other.path:
211+
return False
212+
213+
return True
214+
215+
def __hash__(self):
216+
return super().__hash__()
187217

188218

189219
class SparkOptions:

0 commit comments

Comments
 (0)