code: def _arrow_table_ipc_reduce(table: "pyarrow.Table"):
      """Custom reducer for Arrow Table that works around a zero-copy slicing pickling
      bug by using the Arrow IPC format for the underlying serialization.
  
      This is currently used as a fallback for unsupported types (or unknown bugs) for
      the manual buffer truncation workaround, e.g. for dense unions.
      """
      from pyarrow.ipc import RecordBatchStreamWriter
      from pyarrow.lib import BufferOutputStream
  
      output_stream = BufferOutputStream()
      with RecordBatchStreamWriter(
          output_stream, schema=table.schema
      ) as wr:
          wr.write_table(table)
      # NOTE: output_stream.getvalue() materializes the serialized table to a single
      # contiguous bytestring, resulting in a few copy. This adds 1-2 extra copies on the
      # serialization side, and 1 extra copy on the deserialization side.
      return _restore_table_from_ipc, (output_stream.getvalue(),)
  
imports: from dataclasses import dataclass
  import logging
  import os
  import sys
  from typing import List, Tuple, Optional, TYPE_CHECKING
label_desc: Use image node_id 30 for calling a global function with example usage: _arrow_table_ipc_reduce(table) and returns: _restore_table_from_ipc,  output_stream