From 149d5ff822da3d7fda18dbed4814e0406708cf07 Mon Sep 17 00:00:00 2001 From: Huan Chen <142538604+Genesis929@users.noreply.github.com> Date: Thu, 22 Aug 2024 15:03:56 -0700 Subject: [PATCH] fix: struct field non-nullable type issue. (#914) * fix: struct field non-nullable type issue. * update logic --- bigframes/core/compile/scalar_op_compiler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bigframes/core/compile/scalar_op_compiler.py b/bigframes/core/compile/scalar_op_compiler.py index e70c49e337..4818d3ca76 100644 --- a/bigframes/core/compile/scalar_op_compiler.py +++ b/bigframes/core/compile/scalar_op_compiler.py @@ -754,7 +754,9 @@ def struct_field_op_impl(x: ibis_types.Value, op: ops.StructFieldOp): name = op.name_or_index else: name = struct_value.names[op.name_or_index] - return struct_value[name].name(name) + + result = struct_value[name] + return result.cast(result.type()(nullable=True)).name(name) def numeric_to_datetime(x: ibis_types.Value, unit: str) -> ibis_types.TimestampValue: