Repository navigation
Conversation
The precedence list grouped `NOT` with the unary `+` and `-` at rank 2, above
comparison at rank 5, which describes `NOT a = b` as `(NOT a) = b`.
sqlglot, the parser `validation/validate.py` uses to check every expression in a
document, reads it the other way:
NOT a = b -> Not(EQ(a, b))
- a = b -> EQ(Neg(a), b)
NOT a AND b -> And(Not(a), b)
The contrast with `-` is the point: a genuine unary operator does bind tighter
than comparison, and `NOT` does not. It binds looser than comparison and tighter
than `AND`, so it belongs on its own rank between them. The same holds for the
comparison forms `NOT a IS NULL`, `NOT a LIKE`, `NOT a IN` and `NOT a BETWEEN`,
each of which negates the whole comparison.
`NOT` is listed only here; the other two mentions in this file give its syntax
rather than its binding.
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
1 open issue
What changed in this PR
Updates the expression language spec to document NOT operator precedence consistent with how the parser interprets SQL predicates, placing NOT below comparison operators and above AND/OR.
Changes:
- Remove
NOTfrom the “Unary operators” precedence rank. - Introduce a dedicated precedence rank for logical
NOTbetween comparison andAND.
| File | Description |
|---|---|
| core-spec/expression_language.md | Adjusts the documented operator precedence list so NOT binds looser than comparisons and tighter than AND/OR. |
Review effort: Lite
| 6. Logical NOT: `NOT` | ||
| 7. Logical AND: `AND` | ||
| 8. Logical OR: `OR` | ||
|
|
Copilot stopped reviewing on behalf of
ayushtkn due to an error
October 19, 2026 17:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
The precedence list grouped
NOTwith the unary+and-at rank 2, above comparisonat rank 5, which describes
NOT a = bas(NOT a) = b.sqlglot — the parser
validation/validate.pyalready runs over every expression in adocument — reads it the other way:
NOT a = b -> Not(EQ(a, b)) NOT binds looser than comparison
NOT a AND b -> And(Not(a), b) NOT binds tighter than AND
The contrast with
-is the point: a genuine unary operator does bind tighter thancomparison, and
NOTdoes not. It sits between comparison andAND, so it gets its ownrank:
NOT a IS NULL, NOT a LIKE 'x', NOT a IN (1) and NOT a BETWEEN 1 AND 2 each parse
as a negation of the whole comparison, which is consistent with rank 6.
NOT is ranked only here. relational_semantics.md, added by #354, has no precedence
section, and the other two mentions in this file give NOT's syntax rather than its
binding.
Related Issues
Checklist
Specification
core-spec/and follow the existing structureOntology
ontology/are consistent with spec changesConverters
converters/is updated to reflect spec or ontology changes.github/labeler.ymlis updated with the new pathValidation
validation/are updated if the spec changedDocumentation
docs/is updated to reflect any user-facing changesCONTRIBUTING.mdis updated if the contribution process changedExamples
examples/are added or updated for any new spec constructs or converter supportTests
pytest/ CI green)Compliance
NOTICEand/orLICENSEhave been updated per ASF policy