Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion datacompy/spark/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,14 @@ def decimal_comparator():
"""

class DecimalComparator(str):
__slots__ = () # Disables instance __dict__ to reduce overhead

def __eq__(self, other):
return len(other) >= 7 and other[0:7] == "decimal"
# Minimize repeated computation for performance
# Faster than slicing and string comparison for this case
if isinstance(other, str):
return other.startswith("decimal")
return False

return DecimalComparator("decimal")

Expand Down