def comparer(left, right): for func, sort_ in funcs: try: result = value_compare(func(left), func(right), sort_) if result != 0: return result except Exception as e: Log.error("problem with compare", e) return 0
def partial_eval(self): lhs = self.lang[self.lhs].partial_eval() rhs = self.lang[self.rhs].partial_eval() if is_literal(lhs) and is_literal(rhs): return FALSE if value_compare(lhs.value, rhs.value) else TRUE else: return self.lang[self.lang[CaseOp([ WhenOp(lhs.missing(), **{"then": rhs.missing()}), WhenOp(rhs.missing(), **{"then": FALSE}), BasicEqOp([lhs, rhs]), ])]].partial_eval()
def partial_eval(self, lang): lhs = (self.lhs).partial_eval(lang) rhs = (self.rhs).partial_eval(lang) if is_literal(lhs) and is_literal(rhs): return FALSE if value_compare(lhs.value, rhs.value) else TRUE else: return CaseOp([ WhenOp(lhs.missing(lang), **{"then": rhs.missing(lang)}), WhenOp(rhs.missing(lang), **{"then": FALSE}), BasicEqOp([lhs, rhs]), ]).partial_eval(lang)