prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  JSON dispatcher data file split correction
  Originated from https://github.com/modin-project/modin/pull/2607#discussion_r571989125.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `modin/engines/base/io/text/json_dispatcher.py`
  Content:
  ```
  1 # Licensed to Modin Development Team under one or more contributor license agreements.
  2 # See the NOTICE file distributed with this work for additional information regarding
  3 # copyright ownership.  The Modin Development Team licenses this file to you under the
  4 # Apache License, Version 2.0 (the "License"); you may not use this file except in
  5 # compliance with the License.  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 distributed under
  10 # the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
  11 # ANY KIND, either express or implied. See the License for the specific language
  12 # governing permissions and limitations under the License.
  13 
  14 """Module houses `JSONDispatcher` class, that is used for reading `.json` files."""
  15 
  16 from modin.engines.base.io.text.text_file_dispatcher import TextFileDispatcher
  17 from io import BytesIO
  18 import pandas
  19 import numpy as np
  20 from csv import QUOTE_NONE
  21 
  22 from modin.config import NPartitions
  23 
  24 
  25 class JSONDispatcher(TextFileDispatcher):
  26     """
  27     Class handles utils for reading `.json` files.
  28 
  29     Inherits some common for text files util functions from `TextFileDispatcher` class.
  30     """
  31 
  32     @classmethod
  33     def _read(cls, path_or_buf, **kwargs):
  34         """
  35         Read data from `path_or_buf` according to the passed `read_json` `kwargs` parameters.
  36 
  37         Parameters
  38         ----------
  39         path_or_buf : str, path object or file-like object
  40             `path_or_buf` parameter of `read_json` function.
  41         **kwargs : dict
  42             Parameters of `read_json` function.
  43 
  44         Returns
  45         -------
  46         BaseQueryCompiler
  47             Query compiler with imported data for further processing.
  48         """
  49         path_or_buf = cls.get_path_or_buffer(path_or_buf)
  50         if isinstance(path_or_buf, str):
  51             if not cls.file_exists(path_or_buf):
  52                 return cls.single_worker_read(path_or_buf, **kwargs)
  53             path_or_buf = cls.get_path(path_or_buf)
  54         elif not cls.pathlib_or_pypath(path_or_buf):
  55             return cls.single_worker_read(path_or_buf, **kwargs)
  56         if not kwargs.get("lines", False):
  57             return cls.single_worker_read(path_or_buf, **kwargs)
  58         columns = pandas.read_json(
  59             BytesIO(b"" + open(path_or_buf, "rb").readline()), lines=True
  60         ).columns
  61         kwargs["columns"] = columns
  62         empty_pd_df = pandas.DataFrame(columns=columns)
  63 
  64         with cls.file_open(path_or_buf, "rb", kwargs.get("compression", "infer")) as f:
  65             partition_ids = []
  66             index_ids = []
  67             dtypes_ids = []
  68 
  69             column_widths, num_splits = cls._define_metadata(empty_pd_df, columns)
  70 
  71             args = {"fname": path_or_buf, "num_splits": num_splits, **kwargs}
  72 
  73             splits = cls.partitioned_file(
  74                 f,
  75                 num_partitions=NPartitions.get(),
  76                 is_quoting=(args.get("quoting", "") != QUOTE_NONE),
  77             )
  78             for start, end in splits:
  79                 args.update({"start": start, "end": end})
  80                 partition_id = cls.deploy(cls.parse, num_splits + 3, args)
  81                 partition_ids.append(partition_id[:-3])
  82                 index_ids.append(partition_id[-3])
  83                 dtypes_ids.append(partition_id[-2])
  84 
  85         # partition_id[-1] contains the columns for each partition, which will be useful
  86         # for implementing when `lines=False`.
  87         row_lengths = cls.materialize(index_ids)
  88         new_index = pandas.RangeIndex(sum(row_lengths))
  89 
  90         dtypes = cls.get_dtypes(dtypes_ids)
  91         partition_ids = cls.build_partition(partition_ids, row_lengths, column_widths)
  92 
  93         if isinstance(dtypes, pandas.Series):
  94             dtypes.index = columns
  95         else:
  96             dtypes = pandas.Series(dtypes, index=columns)
  97 
  98         new_frame = cls.frame_cls(
  99             np.array(partition_ids),
  100             new_index,
  101             columns,
  102             row_lengths,
  103             column_widths,
  104             dtypes=dtypes,
  105         )
  106         new_frame.synchronize_labels(axis=0)
  107         return cls.query_compiler_cls(new_frame)
  108
  ```
  --- 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/modin/engines/base/io/text/json_dispatcher.py b/modin/engines/base/io/text/json_dispatcher.py
  --- a/modin/engines/base/io/text/json_dispatcher.py
  +++ b/modin/engines/base/io/text/json_dispatcher.py
  @@ -17,7 +17,6 @@
   from io import BytesIO
   import pandas
   import numpy as np
  -from csv import QUOTE_NONE
   
   from modin.config import NPartitions
   
  @@ -73,7 +72,6 @@
               splits = cls.partitioned_file(
                   f,
                   num_partitions=NPartitions.get(),
  -                is_quoting=(args.get("quoting", "") != QUOTE_NONE),
               )
               for start, end in splits:
                   args.update({"start": start, "end": end})
  
verification_info: {"golden_diff": "diff --git a/modin/engines/base/io/text/json_dispatcher.py b/modin/engines/base/io/text/json_dispatcher.py\n--- a/modin/engines/base/io/text/json_dispatcher.py\n+++ b/modin/engines/base/io/text/json_dispatcher.py\n@@ -17,7 +17,6 @@\n from io import BytesIO\n import pandas\n import numpy as np\n-from csv import QUOTE_NONE\n \n from modin.config import NPartitions\n \n@@ -73,7 +72,6 @@\n             splits = cls.partitioned_file(\n                 f,\n                 num_partitions=NPartitions.get(),\n-                is_quoting=(args.get(\"quoting\", \"\") != QUOTE_NONE),\n             )\n             for start, end in splits:\n                 args.update({\"start\": start, \"end\": end})\n", "issue": "JSON dispatcher data file split correction\nOriginated from https://github.com/modin-project/modin/pull/2607#discussion_r571989125.\n", "before_files": [{"content": "# Licensed to Modin Development Team under one or more contributor license agreements.\n# See the NOTICE file distributed with this work for additional information regarding\n# copyright ownership.  The Modin Development Team licenses this file to you under the\n# Apache License, Version 2.0 (the \"License\"); you may not use this file except in\n# compliance with the License.  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 distributed under\n# the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n# ANY KIND, either express or implied. See the License for the specific language\n# governing permissions and limitations under the License.\n\n\"\"\"Module houses `JSONDispatcher` class, that is used for reading `.json` files.\"\"\"\n\nfrom modin.engines.base.io.text.text_file_dispatcher import TextFileDispatcher\nfrom io import BytesIO\nimport pandas\nimport numpy as np\nfrom csv import QUOTE_NONE\n\nfrom modin.config import NPartitions\n\n\nclass JSONDispatcher(TextFileDispatcher):\n    \"\"\"\n    Class handles utils for reading `.json` files.\n\n    Inherits some common for text files util functions from `TextFileDispatcher` class.\n    \"\"\"\n\n    @classmethod\n    def _read(cls, path_or_buf, **kwargs):\n        \"\"\"\n        Read data from `path_or_buf` according to the passed `read_json` `kwargs` parameters.\n\n        Parameters\n        ----------\n        path_or_buf : str, path object or file-like object\n            `path_or_buf` parameter of `read_json` function.\n        **kwargs : dict\n            Parameters of `read_json` function.\n\n        Returns\n        -------\n        BaseQueryCompiler\n            Query compiler with imported data for further processing.\n        \"\"\"\n        path_or_buf = cls.get_path_or_buffer(path_or_buf)\n        if isinstance(path_or_buf, str):\n            if not cls.file_exists(path_or_buf):\n                return cls.single_worker_read(path_or_buf, **kwargs)\n            path_or_buf = cls.get_path(path_or_buf)\n        elif not cls.pathlib_or_pypath(path_or_buf):\n            return cls.single_worker_read(path_or_buf, **kwargs)\n        if not kwargs.get(\"lines\", False):\n            return cls.single_worker_read(path_or_buf, **kwargs)\n        columns = pandas.read_json(\n            BytesIO(b\"\" + open(path_or_buf, \"rb\").readline()), lines=True\n        ).columns\n        kwargs[\"columns\"] = columns\n        empty_pd_df = pandas.DataFrame(columns=columns)\n\n        with cls.file_open(path_or_buf, \"rb\", kwargs.get(\"compression\", \"infer\")) as f:\n            partition_ids = []\n            index_ids = []\n            dtypes_ids = []\n\n            column_widths, num_splits = cls._define_metadata(empty_pd_df, columns)\n\n            args = {\"fname\": path_or_buf, \"num_splits\": num_splits, **kwargs}\n\n            splits = cls.partitioned_file(\n                f,\n                num_partitions=NPartitions.get(),\n                is_quoting=(args.get(\"quoting\", \"\") != QUOTE_NONE),\n            )\n            for start, end in splits:\n                args.update({\"start\": start, \"end\": end})\n                partition_id = cls.deploy(cls.parse, num_splits + 3, args)\n                partition_ids.append(partition_id[:-3])\n                index_ids.append(partition_id[-3])\n                dtypes_ids.append(partition_id[-2])\n\n        # partition_id[-1] contains the columns for each partition, which will be useful\n        # for implementing when `lines=False`.\n        row_lengths = cls.materialize(index_ids)\n        new_index = pandas.RangeIndex(sum(row_lengths))\n\n        dtypes = cls.get_dtypes(dtypes_ids)\n        partition_ids = cls.build_partition(partition_ids, row_lengths, column_widths)\n\n        if isinstance(dtypes, pandas.Series):\n            dtypes.index = columns\n        else:\n            dtypes = pandas.Series(dtypes, index=columns)\n\n        new_frame = cls.frame_cls(\n            np.array(partition_ids),\n            new_index,\n            columns,\n            row_lengths,\n            column_widths,\n            dtypes=dtypes,\n        )\n        new_frame.synchronize_labels(axis=0)\n        return cls.query_compiler_cls(new_frame)\n", "path": "modin/engines/base/io/text/json_dispatcher.py"}], "after_files": [{"content": "# Licensed to Modin Development Team under one or more contributor license agreements.\n# See the NOTICE file distributed with this work for additional information regarding\n# copyright ownership.  The Modin Development Team licenses this file to you under the\n# Apache License, Version 2.0 (the \"License\"); you may not use this file except in\n# compliance with the License.  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 distributed under\n# the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n# ANY KIND, either express or implied. See the License for the specific language\n# governing permissions and limitations under the License.\n\n\"\"\"Module houses `JSONDispatcher` class, that is used for reading `.json` files.\"\"\"\n\nfrom modin.engines.base.io.text.text_file_dispatcher import TextFileDispatcher\nfrom io import BytesIO\nimport pandas\nimport numpy as np\n\nfrom modin.config import NPartitions\n\n\nclass JSONDispatcher(TextFileDispatcher):\n    \"\"\"\n    Class handles utils for reading `.json` files.\n\n    Inherits some common for text files util functions from `TextFileDispatcher` class.\n    \"\"\"\n\n    @classmethod\n    def _read(cls, path_or_buf, **kwargs):\n        \"\"\"\n        Read data from `path_or_buf` according to the passed `read_json` `kwargs` parameters.\n\n        Parameters\n        ----------\n        path_or_buf : str, path object or file-like object\n            `path_or_buf` parameter of `read_json` function.\n        **kwargs : dict\n            Parameters of `read_json` function.\n\n        Returns\n        -------\n        BaseQueryCompiler\n            Query compiler with imported data for further processing.\n        \"\"\"\n        path_or_buf = cls.get_path_or_buffer(path_or_buf)\n        if isinstance(path_or_buf, str):\n            if not cls.file_exists(path_or_buf):\n                return cls.single_worker_read(path_or_buf, **kwargs)\n            path_or_buf = cls.get_path(path_or_buf)\n        elif not cls.pathlib_or_pypath(path_or_buf):\n            return cls.single_worker_read(path_or_buf, **kwargs)\n        if not kwargs.get(\"lines\", False):\n            return cls.single_worker_read(path_or_buf, **kwargs)\n        columns = pandas.read_json(\n            BytesIO(b\"\" + open(path_or_buf, \"rb\").readline()), lines=True\n        ).columns\n        kwargs[\"columns\"] = columns\n        empty_pd_df = pandas.DataFrame(columns=columns)\n\n        with cls.file_open(path_or_buf, \"rb\", kwargs.get(\"compression\", \"infer\")) as f:\n            partition_ids = []\n            index_ids = []\n            dtypes_ids = []\n\n            column_widths, num_splits = cls._define_metadata(empty_pd_df, columns)\n\n            args = {\"fname\": path_or_buf, \"num_splits\": num_splits, **kwargs}\n\n            splits = cls.partitioned_file(\n                f,\n                num_partitions=NPartitions.get(),\n            )\n            for start, end in splits:\n                args.update({\"start\": start, \"end\": end})\n                partition_id = cls.deploy(cls.parse, num_splits + 3, args)\n                partition_ids.append(partition_id[:-3])\n                index_ids.append(partition_id[-3])\n                dtypes_ids.append(partition_id[-2])\n\n        # partition_id[-1] contains the columns for each partition, which will be useful\n        # for implementing when `lines=False`.\n        row_lengths = cls.materialize(index_ids)\n        new_index = pandas.RangeIndex(sum(row_lengths))\n\n        dtypes = cls.get_dtypes(dtypes_ids)\n        partition_ids = cls.build_partition(partition_ids, row_lengths, column_widths)\n\n        if isinstance(dtypes, pandas.Series):\n            dtypes.index = columns\n        else:\n            dtypes = pandas.Series(dtypes, index=columns)\n\n        new_frame = cls.frame_cls(\n            np.array(partition_ids),\n            new_index,\n            columns,\n            row_lengths,\n            column_widths,\n            dtypes=dtypes,\n        )\n        new_frame.synchronize_labels(axis=0)\n        return cls.query_compiler_cls(new_frame)\n", "path": "modin/engines/base/io/text/json_dispatcher.py"}]}