def equals(self, other, cache=None): if cache is None: cache = {} if self is other: cache[self, other] = True return True if not isinstance(other, Window): cache[self, other] = False return False try: return cache[self, other] except KeyError: pass if len(self._group_by) != len(other._group_by) or not ops.all_equal( self._group_by, other._group_by, cache=cache): cache[self, other] = False return False if len(self._order_by) != len(other._order_by) or not ops.all_equal( self._order_by, other._order_by, cache=cache): cache[self, other] = False return False equal = ops.all_equal( self.preceding, other.preceding, cache=cache) and ops.all_equal( self.following, other.following, cache=cache) and ops.all_equal( self.max_lookback, other.max_lookback, cache=cache) cache[self, other] = equal return equal
def equals(self, other, cache=None): if cache is None: cache = {} key = self, other try: return cache[key] except KeyError: cache[key] = result = self is other or ( isinstance(other, Select) and self.limit == other.limit and ops.all_equal(self._all_exprs(), other._all_exprs())) return result