Skip to content

Commit

Permalink
fix(flink): avoid non-existent sge.NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Feb 18, 2024
1 parent 8f47c69 commit 9f190eb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ibis/backends/flink/compiler.py
Expand Up @@ -8,7 +8,7 @@
import ibis.common.exceptions as com
import ibis.expr.datatypes as dt
import ibis.expr.operations as ops
from ibis.backends.base.sqlglot.compiler import STAR, SQLGlotCompiler, paren
from ibis.backends.base.sqlglot.compiler import NULL, STAR, SQLGlotCompiler, paren
from ibis.backends.base.sqlglot.datatypes import FlinkType
from ibis.backends.base.sqlglot.dialects import Flink
from ibis.backends.base.sqlglot.rewrites import (
Expand Down Expand Up @@ -292,12 +292,12 @@ def visit_Literal(self, op, *, value, dtype):
if value is None:
assert dtype.nullable, "dtype is not nullable but value is None"
if not dtype.is_null():
return self.cast(sge.NULL, dtype)
return sge.NULL
return self.cast(NULL, dtype)
return NULL
return super().visit_Literal(op, value=value, dtype=dtype)

def visit_MapGet(self, op, *, arg, key, default):
if default is sge.NULL:
if default is NULL:
default = self.cast(default, op.dtype)
return self.f.coalesce(arg[key], default)

Expand Down Expand Up @@ -422,10 +422,10 @@ def visit_Cast(self, op, *, arg, to):
def visit_IfElse(self, op, *, bool_expr, true_expr, false_null_expr):
return self.if_(
bool_expr,
true_expr if true_expr != sge.NULL else self.cast(true_expr, op.dtype),
true_expr if true_expr != NULL else self.cast(true_expr, op.dtype),
(
false_null_expr
if false_null_expr != sge.NULL
if false_null_expr != NULL
else self.cast(false_null_expr, op.dtype)
),
)
Expand Down

0 comments on commit 9f190eb

Please sign in to comment.