Skip to content

Commit

Permalink
fix: is distinct from parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
tobymao committed Mar 1, 2024
1 parent c9bde44 commit e2becea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sqlglot/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3597,7 +3597,7 @@ def _parse_is(self, this: t.Optional[exp.Expression]) -> t.Optional[exp.Expressi

if self._match_text_seq("DISTINCT", "FROM"):
klass = exp.NullSafeEQ if negate else exp.NullSafeNEQ
return self.expression(klass, this=this, expression=self._parse_conjunction())
return self.expression(klass, this=this, expression=self._parse_bitwise())

expression = self._parse_null() or self._parse_boolean()
if not expression:
Expand Down
3 changes: 3 additions & 0 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,3 +852,6 @@ def test_values_as_identifier(self):
):
with self.subTest(dialect):
self.assertEqual(parse_one(sql, dialect=dialect).sql(dialect=dialect), sql)

def test_distinct_from(self):
self.assertIsInstance(parse_one("a IS DISTINCT FROM b OR c IS DISTINCT FROM d"), exp.Or)

0 comments on commit e2becea

Please sign in to comment.