code: def duckdb_type_name_to_pyarrow_type(duckdb_type: str) -> pa.DataType:
      duckdb_type = str(duckdb_type).upper()
      if duckdb_type in ("VARCHAR", "JSON", "CHAR", "CATEGORICAL"):
          return pa.string()
      elif duckdb_type in ("REAL", "FLOAT4", "FLOAT"):
          return pa.float32()
      elif duckdb_type in ("DOUBLE", "FLOAT8"):
          return pa.float64()
      elif duckdb_type in ("TINYINT", "INT1"):
          return pa.int8()
      elif duckdb_type in ("SMALLINT", "INT2", "SHORT"):
          return pa.int16()
      elif duckdb_type in ("INTEGER", "INT4", "INT", "SIGNED"):
          return pa.int32()
      elif duckdb_type in ("BIGINT", "INT8", "LONG"):
          return pa.int64()
      elif duckdb_type.startswith("DECIMAL"):
          matches = re.findall(r"\d+", duckdb_type)
          precision = int(matches[0])
          scale = int(matches[1])
          return pa.decimal128(precision, scale)
      elif duckdb_type == "UTINYINT":
          return pa.uint8()
      elif duckdb_type == "USMALLINT":
          return pa.uint16()
      elif duckdb_type == "UINTEGER":
          return pa.uint32()
      elif duckdb_type == "UBIGINT":
          return pa.uint64()
      elif duckdb_type == "BOOLEAN":
          return pa.bool_()
      elif duckdb_type == "DATE":
          return pa.date32()
      elif duckdb_type in ("TIMESTAMP", "TIMESTAMP_MS"):
          return pa.timestamp("ms")
      elif duckdb_type == "TIMESTAMP_NS":
          return pa.timestamp("ns")
      elif duckdb_type == "TIMESTAMP WITH TIME ZONE":
          return pa.timestamp("ms", tz="UTC")
      else:
          raise ValueError(f"Unexpected DuckDB type: {duckdb_type}")
  
imports: import re
  import warnings
  from .None import SqlConnection, CsvReadOptions
  from typing import Dict, Optional
  from distutils.version import LooseVersion
  import duckdb
  import pyarrow
  import pyarrow.feather
  import pandas
  import logging
  import uuid
label_desc: Use image node_id 1 for calling a global function with example usage: duckdb_type_name_to_pyarrow_type(duckdb_type) and returns: pa, pa, pa, pa, pa, pa, pa, pa, pa, pa, pa, pa, pa, pa, pa, pa, pa