prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  The _ARROW_SCALAR_IDS_TO_BQ mapping misses LargeStringArray type
  #### Environment details
  
    - OS type and version: Linux
    - Python version: 3.11.7
    - pip version: 23.3.1
    - `google-cloud-bigquery` version: 3.16.0
  
  #### Steps to reproduce
  
  Call `bqclient.load_table_from_dataframe` with a dataframe containing a string type. Before pandas 2.2.0, the `pyarrow.array` would detect the type as `pyarrow.lib.StringArray`. After switching to pandas `2.2.0`, the `pyarrow.lib.LargeStringArray` would be returned. But it misses the BQ type mapping.
  
  
  #### Stack trace
  
  <img width="1470" alt="callstack" src="https://github.com/googleapis/python-bigquery/assets/124939984/fe0c326f-8875-41b5-abff-e91dc3e574da">
  
  The left results are in `pandas 2.2.0` and the right result are from `pandas 2.1.3`
  
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `google/cloud/bigquery/_pyarrow_helpers.py`
  Content:
  ```
  1 # Copyright 2023 Google LLC
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 #     http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 
  15 """Shared helper functions for connecting BigQuery and pyarrow."""
  16 
  17 from typing import Any
  18 
  19 from packaging import version
  20 
  21 try:
  22     import pyarrow  # type: ignore
  23 except ImportError:  # pragma: NO COVER
  24     pyarrow = None
  25 
  26 
  27 def pyarrow_datetime():
  28     return pyarrow.timestamp("us", tz=None)
  29 
  30 
  31 def pyarrow_numeric():
  32     return pyarrow.decimal128(38, 9)
  33 
  34 
  35 def pyarrow_bignumeric():
  36     # 77th digit is partial.
  37     # https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#decimal_types
  38     return pyarrow.decimal256(76, 38)
  39 
  40 
  41 def pyarrow_time():
  42     return pyarrow.time64("us")
  43 
  44 
  45 def pyarrow_timestamp():
  46     return pyarrow.timestamp("us", tz="UTC")
  47 
  48 
  49 _BQ_TO_ARROW_SCALARS = {}
  50 _ARROW_SCALAR_IDS_TO_BQ = {}
  51 
  52 if pyarrow:
  53     # This dictionary is duplicated in bigquery_storage/test/unite/test_reader.py
  54     # When modifying it be sure to update it there as well.
  55     # Note(todo!!): type "BIGNUMERIC"'s matching pyarrow type is added in _pandas_helpers.py
  56     _BQ_TO_ARROW_SCALARS = {
  57         "BOOL": pyarrow.bool_,
  58         "BOOLEAN": pyarrow.bool_,
  59         "BYTES": pyarrow.binary,
  60         "DATE": pyarrow.date32,
  61         "DATETIME": pyarrow_datetime,
  62         "FLOAT": pyarrow.float64,
  63         "FLOAT64": pyarrow.float64,
  64         "GEOGRAPHY": pyarrow.string,
  65         "INT64": pyarrow.int64,
  66         "INTEGER": pyarrow.int64,
  67         "NUMERIC": pyarrow_numeric,
  68         "STRING": pyarrow.string,
  69         "TIME": pyarrow_time,
  70         "TIMESTAMP": pyarrow_timestamp,
  71     }
  72 
  73     _ARROW_SCALAR_IDS_TO_BQ = {
  74         # https://arrow.apache.org/docs/python/api/datatypes.html#type-classes
  75         pyarrow.bool_().id: "BOOL",
  76         pyarrow.int8().id: "INT64",
  77         pyarrow.int16().id: "INT64",
  78         pyarrow.int32().id: "INT64",
  79         pyarrow.int64().id: "INT64",
  80         pyarrow.uint8().id: "INT64",
  81         pyarrow.uint16().id: "INT64",
  82         pyarrow.uint32().id: "INT64",
  83         pyarrow.uint64().id: "INT64",
  84         pyarrow.float16().id: "FLOAT64",
  85         pyarrow.float32().id: "FLOAT64",
  86         pyarrow.float64().id: "FLOAT64",
  87         pyarrow.time32("ms").id: "TIME",
  88         pyarrow.time64("ns").id: "TIME",
  89         pyarrow.timestamp("ns").id: "TIMESTAMP",
  90         pyarrow.date32().id: "DATE",
  91         pyarrow.date64().id: "DATETIME",  # because millisecond resolution
  92         pyarrow.binary().id: "BYTES",
  93         pyarrow.string().id: "STRING",  # also alias for pyarrow.utf8()
  94         # The exact scale and precision don't matter, see below.
  95         pyarrow.decimal128(38, scale=9).id: "NUMERIC",
  96     }
  97 
  98     # Adds bignumeric support only if pyarrow version >= 3.0.0
  99     # Decimal256 support was added to arrow 3.0.0
  100     # https://arrow.apache.org/blog/2021/01/25/3.0.0-release/
  101     if version.parse(pyarrow.__version__) >= version.parse("3.0.0"):
  102         _BQ_TO_ARROW_SCALARS["BIGNUMERIC"] = pyarrow_bignumeric
  103         # The exact decimal's scale and precision are not important, as only
  104         # the type ID matters, and it's the same for all decimal256 instances.
  105         _ARROW_SCALAR_IDS_TO_BQ[pyarrow.decimal256(76, scale=38).id] = "BIGNUMERIC"
  106 
  107 
  108 def bq_to_arrow_scalars(bq_scalar: str):
  109     """
  110     Returns:
  111         The Arrow scalar type that the input BigQuery scalar type maps to.
  112         If it cannot find the BigQuery scalar, return None.
  113     """
  114     return _BQ_TO_ARROW_SCALARS.get(bq_scalar)
  115 
  116 
  117 def arrow_scalar_ids_to_bq(arrow_scalar: Any):
  118     """
  119     Returns:
  120         The BigQuery scalar type that the input arrow scalar type maps to.
  121         If it cannot find the arrow scalar, return None.
  122     """
  123     return _ARROW_SCALAR_IDS_TO_BQ.get(arrow_scalar)
  124
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/google/cloud/bigquery/_pyarrow_helpers.py b/google/cloud/bigquery/_pyarrow_helpers.py
  --- a/google/cloud/bigquery/_pyarrow_helpers.py
  +++ b/google/cloud/bigquery/_pyarrow_helpers.py
  @@ -91,6 +91,7 @@
           pyarrow.date64().id: "DATETIME",  # because millisecond resolution
           pyarrow.binary().id: "BYTES",
           pyarrow.string().id: "STRING",  # also alias for pyarrow.utf8()
  +        pyarrow.large_string().id: "STRING",
           # The exact scale and precision don't matter, see below.
           pyarrow.decimal128(38, scale=9).id: "NUMERIC",
       }
  
verification_info: {"golden_diff": "diff --git a/google/cloud/bigquery/_pyarrow_helpers.py b/google/cloud/bigquery/_pyarrow_helpers.py\n--- a/google/cloud/bigquery/_pyarrow_helpers.py\n+++ b/google/cloud/bigquery/_pyarrow_helpers.py\n@@ -91,6 +91,7 @@\n         pyarrow.date64().id: \"DATETIME\",  # because millisecond resolution\n         pyarrow.binary().id: \"BYTES\",\n         pyarrow.string().id: \"STRING\",  # also alias for pyarrow.utf8()\n+        pyarrow.large_string().id: \"STRING\",\n         # The exact scale and precision don't matter, see below.\n         pyarrow.decimal128(38, scale=9).id: \"NUMERIC\",\n     }\n", "issue": "The _ARROW_SCALAR_IDS_TO_BQ mapping misses LargeStringArray type\n#### Environment details\r\n\r\n  - OS type and version: Linux\r\n  - Python version: 3.11.7\r\n  - pip version: 23.3.1\r\n  - `google-cloud-bigquery` version: 3.16.0\r\n\r\n#### Steps to reproduce\r\n\r\nCall `bqclient.load_table_from_dataframe` with a dataframe containing a string type. Before pandas 2.2.0, the `pyarrow.array` would detect the type as `pyarrow.lib.StringArray`. After switching to pandas `2.2.0`, the `pyarrow.lib.LargeStringArray` would be returned. But it misses the BQ type mapping.\r\n\r\n\r\n#### Stack trace\r\n\r\n<img width=\"1470\" alt=\"callstack\" src=\"https://github.com/googleapis/python-bigquery/assets/124939984/fe0c326f-8875-41b5-abff-e91dc3e574da\">\r\n\r\nThe left results are in `pandas 2.2.0` and the right result are from `pandas 2.1.3`\r\n\r\n\n", "before_files": [{"content": "# Copyright 2023 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"Shared helper functions for connecting BigQuery and pyarrow.\"\"\"\n\nfrom typing import Any\n\nfrom packaging import version\n\ntry:\n    import pyarrow  # type: ignore\nexcept ImportError:  # pragma: NO COVER\n    pyarrow = None\n\n\ndef pyarrow_datetime():\n    return pyarrow.timestamp(\"us\", tz=None)\n\n\ndef pyarrow_numeric():\n    return pyarrow.decimal128(38, 9)\n\n\ndef pyarrow_bignumeric():\n    # 77th digit is partial.\n    # https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#decimal_types\n    return pyarrow.decimal256(76, 38)\n\n\ndef pyarrow_time():\n    return pyarrow.time64(\"us\")\n\n\ndef pyarrow_timestamp():\n    return pyarrow.timestamp(\"us\", tz=\"UTC\")\n\n\n_BQ_TO_ARROW_SCALARS = {}\n_ARROW_SCALAR_IDS_TO_BQ = {}\n\nif pyarrow:\n    # This dictionary is duplicated in bigquery_storage/test/unite/test_reader.py\n    # When modifying it be sure to update it there as well.\n    # Note(todo!!): type \"BIGNUMERIC\"'s matching pyarrow type is added in _pandas_helpers.py\n    _BQ_TO_ARROW_SCALARS = {\n        \"BOOL\": pyarrow.bool_,\n        \"BOOLEAN\": pyarrow.bool_,\n        \"BYTES\": pyarrow.binary,\n        \"DATE\": pyarrow.date32,\n        \"DATETIME\": pyarrow_datetime,\n        \"FLOAT\": pyarrow.float64,\n        \"FLOAT64\": pyarrow.float64,\n        \"GEOGRAPHY\": pyarrow.string,\n        \"INT64\": pyarrow.int64,\n        \"INTEGER\": pyarrow.int64,\n        \"NUMERIC\": pyarrow_numeric,\n        \"STRING\": pyarrow.string,\n        \"TIME\": pyarrow_time,\n        \"TIMESTAMP\": pyarrow_timestamp,\n    }\n\n    _ARROW_SCALAR_IDS_TO_BQ = {\n        # https://arrow.apache.org/docs/python/api/datatypes.html#type-classes\n        pyarrow.bool_().id: \"BOOL\",\n        pyarrow.int8().id: \"INT64\",\n        pyarrow.int16().id: \"INT64\",\n        pyarrow.int32().id: \"INT64\",\n        pyarrow.int64().id: \"INT64\",\n        pyarrow.uint8().id: \"INT64\",\n        pyarrow.uint16().id: \"INT64\",\n        pyarrow.uint32().id: \"INT64\",\n        pyarrow.uint64().id: \"INT64\",\n        pyarrow.float16().id: \"FLOAT64\",\n        pyarrow.float32().id: \"FLOAT64\",\n        pyarrow.float64().id: \"FLOAT64\",\n        pyarrow.time32(\"ms\").id: \"TIME\",\n        pyarrow.time64(\"ns\").id: \"TIME\",\n        pyarrow.timestamp(\"ns\").id: \"TIMESTAMP\",\n        pyarrow.date32().id: \"DATE\",\n        pyarrow.date64().id: \"DATETIME\",  # because millisecond resolution\n        pyarrow.binary().id: \"BYTES\",\n        pyarrow.string().id: \"STRING\",  # also alias for pyarrow.utf8()\n        # The exact scale and precision don't matter, see below.\n        pyarrow.decimal128(38, scale=9).id: \"NUMERIC\",\n    }\n\n    # Adds bignumeric support only if pyarrow version >= 3.0.0\n    # Decimal256 support was added to arrow 3.0.0\n    # https://arrow.apache.org/blog/2021/01/25/3.0.0-release/\n    if version.parse(pyarrow.__version__) >= version.parse(\"3.0.0\"):\n        _BQ_TO_ARROW_SCALARS[\"BIGNUMERIC\"] = pyarrow_bignumeric\n        # The exact decimal's scale and precision are not important, as only\n        # the type ID matters, and it's the same for all decimal256 instances.\n        _ARROW_SCALAR_IDS_TO_BQ[pyarrow.decimal256(76, scale=38).id] = \"BIGNUMERIC\"\n\n\ndef bq_to_arrow_scalars(bq_scalar: str):\n    \"\"\"\n    Returns:\n        The Arrow scalar type that the input BigQuery scalar type maps to.\n        If it cannot find the BigQuery scalar, return None.\n    \"\"\"\n    return _BQ_TO_ARROW_SCALARS.get(bq_scalar)\n\n\ndef arrow_scalar_ids_to_bq(arrow_scalar: Any):\n    \"\"\"\n    Returns:\n        The BigQuery scalar type that the input arrow scalar type maps to.\n        If it cannot find the arrow scalar, return None.\n    \"\"\"\n    return _ARROW_SCALAR_IDS_TO_BQ.get(arrow_scalar)\n", "path": "google/cloud/bigquery/_pyarrow_helpers.py"}], "after_files": [{"content": "# Copyright 2023 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"Shared helper functions for connecting BigQuery and pyarrow.\"\"\"\n\nfrom typing import Any\n\nfrom packaging import version\n\ntry:\n    import pyarrow  # type: ignore\nexcept ImportError:  # pragma: NO COVER\n    pyarrow = None\n\n\ndef pyarrow_datetime():\n    return pyarrow.timestamp(\"us\", tz=None)\n\n\ndef pyarrow_numeric():\n    return pyarrow.decimal128(38, 9)\n\n\ndef pyarrow_bignumeric():\n    # 77th digit is partial.\n    # https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#decimal_types\n    return pyarrow.decimal256(76, 38)\n\n\ndef pyarrow_time():\n    return pyarrow.time64(\"us\")\n\n\ndef pyarrow_timestamp():\n    return pyarrow.timestamp(\"us\", tz=\"UTC\")\n\n\n_BQ_TO_ARROW_SCALARS = {}\n_ARROW_SCALAR_IDS_TO_BQ = {}\n\nif pyarrow:\n    # This dictionary is duplicated in bigquery_storage/test/unite/test_reader.py\n    # When modifying it be sure to update it there as well.\n    # Note(todo!!): type \"BIGNUMERIC\"'s matching pyarrow type is added in _pandas_helpers.py\n    _BQ_TO_ARROW_SCALARS = {\n        \"BOOL\": pyarrow.bool_,\n        \"BOOLEAN\": pyarrow.bool_,\n        \"BYTES\": pyarrow.binary,\n        \"DATE\": pyarrow.date32,\n        \"DATETIME\": pyarrow_datetime,\n        \"FLOAT\": pyarrow.float64,\n        \"FLOAT64\": pyarrow.float64,\n        \"GEOGRAPHY\": pyarrow.string,\n        \"INT64\": pyarrow.int64,\n        \"INTEGER\": pyarrow.int64,\n        \"NUMERIC\": pyarrow_numeric,\n        \"STRING\": pyarrow.string,\n        \"TIME\": pyarrow_time,\n        \"TIMESTAMP\": pyarrow_timestamp,\n    }\n\n    _ARROW_SCALAR_IDS_TO_BQ = {\n        # https://arrow.apache.org/docs/python/api/datatypes.html#type-classes\n        pyarrow.bool_().id: \"BOOL\",\n        pyarrow.int8().id: \"INT64\",\n        pyarrow.int16().id: \"INT64\",\n        pyarrow.int32().id: \"INT64\",\n        pyarrow.int64().id: \"INT64\",\n        pyarrow.uint8().id: \"INT64\",\n        pyarrow.uint16().id: \"INT64\",\n        pyarrow.uint32().id: \"INT64\",\n        pyarrow.uint64().id: \"INT64\",\n        pyarrow.float16().id: \"FLOAT64\",\n        pyarrow.float32().id: \"FLOAT64\",\n        pyarrow.float64().id: \"FLOAT64\",\n        pyarrow.time32(\"ms\").id: \"TIME\",\n        pyarrow.time64(\"ns\").id: \"TIME\",\n        pyarrow.timestamp(\"ns\").id: \"TIMESTAMP\",\n        pyarrow.date32().id: \"DATE\",\n        pyarrow.date64().id: \"DATETIME\",  # because millisecond resolution\n        pyarrow.binary().id: \"BYTES\",\n        pyarrow.string().id: \"STRING\",  # also alias for pyarrow.utf8()\n        pyarrow.large_string().id: \"STRING\",\n        # The exact scale and precision don't matter, see below.\n        pyarrow.decimal128(38, scale=9).id: \"NUMERIC\",\n    }\n\n    # Adds bignumeric support only if pyarrow version >= 3.0.0\n    # Decimal256 support was added to arrow 3.0.0\n    # https://arrow.apache.org/blog/2021/01/25/3.0.0-release/\n    if version.parse(pyarrow.__version__) >= version.parse(\"3.0.0\"):\n        _BQ_TO_ARROW_SCALARS[\"BIGNUMERIC\"] = pyarrow_bignumeric\n        # The exact decimal's scale and precision are not important, as only\n        # the type ID matters, and it's the same for all decimal256 instances.\n        _ARROW_SCALAR_IDS_TO_BQ[pyarrow.decimal256(76, scale=38).id] = \"BIGNUMERIC\"\n\n\ndef bq_to_arrow_scalars(bq_scalar: str):\n    \"\"\"\n    Returns:\n        The Arrow scalar type that the input BigQuery scalar type maps to.\n        If it cannot find the BigQuery scalar, return None.\n    \"\"\"\n    return _BQ_TO_ARROW_SCALARS.get(bq_scalar)\n\n\ndef arrow_scalar_ids_to_bq(arrow_scalar: Any):\n    \"\"\"\n    Returns:\n        The BigQuery scalar type that the input arrow scalar type maps to.\n        If it cannot find the arrow scalar, return None.\n    \"\"\"\n    return _ARROW_SCALAR_IDS_TO_BQ.get(arrow_scalar)\n", "path": "google/cloud/bigquery/_pyarrow_helpers.py"}]}