Skip to content

Commit 0735908

Browse files
committed
fix annotation call
1 parent 0d9b648 commit 0735908

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

sqlglot/optimizer/annotate_types.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,10 +477,12 @@ def _annotate_unary(self, expression: E) -> E:
477477
else:
478478
self._set_type(expression, expression.this.type)
479479

480-
if this_type := expression.this.type:
481-
nonnull = this_type.args.get("nonnull")
482-
if nonnull and (expr_type := expression.type):
483-
expr_type.set("nonnull", nonnull)
480+
if (
481+
(this_type := expression.this.type)
482+
and this_type.args.get("nonnull")
483+
and (expr_type := expression.type)
484+
):
485+
expr_type.set("nonnull", True)
484486

485487
return expression
486488

0 commit comments

Comments
 (0)