Skip to content

Commit

Permalink
chore: remove de morgan transformation
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Dec 26, 2023
1 parent 9b4c739 commit 9656fc1
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions ibis/backends/base/sqlglot/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,19 +427,9 @@ def visit_Negate(self, op, *, arg):
@visit_node.register(ops.Not)
def visit_Not(self, op, *, arg):
if isinstance(arg, sge.Filter):
return sge.Filter(
this=self._de_morgan_law(arg.this), expression=arg.expression
) # transform the not expression using _de_morgan_law
return sge.Filter(this=sg.not_(arg.this), expression=arg.expression)
return sg.not_(paren(arg))

@staticmethod
def _de_morgan_law(logical_op: sge.Expression):
if isinstance(logical_op, sge.LogicalAnd):
return sge.LogicalOr(this=sg.not_(paren(logical_op.this)))
if isinstance(logical_op, sge.LogicalOr):
return sge.LogicalAnd(this=sg.not_(paren(logical_op.this)))
return None

### Timey McTimeFace

@visit_node.register(ops.Date)
Expand Down

0 comments on commit 9656fc1

Please sign in to comment.