code: def combine_reference_row(row, globals):
      merge_function = _merge_function_map.get((row.dtype, globals))
      if (
          merge_function is None
          or not hl.current_backend()._is_registered_ir_function_name(
              merge_function._name
          )
      ):
          merge_function = hl.experimental.define_function(
              lambda row, gbl: hl.struct(
                  locus=row.locus,
                  __entries=hl.range(0, hl.len(row.data)).flatmap(
                      lambda i: hl.if_else(
                          hl.is_missing(row.data[i]),
                          hl.range(0, hl.len(gbl.g[i].__cols)).map(
                              lambda _: hl.missing(
                                  row.data[
                                      i
                                  ].__entries.dtype.element_type
                              )
                          ),
                          row.data[i].__entries,
                      )
                  ),
              ),
              row.dtype,
              globals.dtype,
          )
          _merge_function_map[
              (row.dtype, globals.dtype)
          ] = merge_function
      apply_ir = Apply(
          merge_function._name,
          merge_function._ret_type,
          row._ir,
          globals._ir,
      )
      indices, aggs = unify_all(row, globals)
      return construct_expr(apply_ir, apply_ir.typ, indices, aggs)
  
imports: import math
  from typing import Collection, Optional, Set, Union, List, Tuple, Dict
  import hail
  from hail import MatrixTable, Table
  from hail.experimental.function import Function
  from hail.expr import StructExpression, unify_all, construct_expr
  from hail.expr.expressions import expr_bool, expr_str
  from hail.genetics.reference_genome import reference_genome_type
  from hail.ir import Apply, TableMapRows
  from hail.typecheck import oneof, sequenceof, typecheck
  from ..variant_dataset import VariantDataset
label_desc: Use image node_id 8 for calling a global function with example usage: combine_reference_row(row, globals) and returns: construct_expr