From 9f190ebe0ceb3fc222ed17740d417d5c7efc9eab Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Sat, 17 Feb 2024 07:30:44 -0500 Subject: [PATCH] fix(flink): avoid non-existent sge.NULL --- ibis/backends/flink/compiler.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ibis/backends/flink/compiler.py b/ibis/backends/flink/compiler.py index 00aed9c73e27..167ddf3cefb5 100644 --- a/ibis/backends/flink/compiler.py +++ b/ibis/backends/flink/compiler.py @@ -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 ( @@ -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) @@ -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) ), )