Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 00dbe35

Browse files
committed
fix: flatten untyped recursive NULL casts in bq compiler
1 parent 27ed0f2 commit 00dbe35

File tree

1 file changed

+9
-0
lines changed
  • third_party/bigframes_vendored/ibis/backends/sql/compilers/bigquery

1 file changed

+9
-0
lines changed

third_party/bigframes_vendored/ibis/backends/sql/compilers/bigquery/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,15 @@ def visit_TimestampFromUNIX(self, op, *, arg, unit):
540540

541541
def visit_Cast(self, op, *, arg, to):
542542
from_ = op.arg.dtype
543+
if to.is_null():
544+
return sge.Null()
545+
if arg is NULL or (
546+
isinstance(arg, sge.Cast)
547+
and getattr(arg, "to", None) is not None
548+
and str(arg.to).upper() == "NULL"
549+
):
550+
if to.is_struct() or to.is_array():
551+
return sge.Cast(this=NULL, to=self.type_mapper.from_ibis(to))
543552
if from_.is_timestamp() and to.is_integer():
544553
return self.f.unix_micros(arg)
545554
elif from_.is_integer() and to.is_timestamp():

0 commit comments

Comments
 (0)