Repository: modin-project/modin

Issue:
read_csv with Ray engine fails with some 'escapechar' parameters
### System information
- **OS Platform and Distribution (e.g., Linux Ubuntu 16.04)**: Ubuntu 18.04
- **Modin version**:  ce2bea8867739ea792cdda0dce8ad50e366ebae1
- **Python version**: 3.8.6
- **Code we can use to reproduce**:
```
import os

os.environ["MODIN_ENGINE"] = "ray"

import pandas
import modin.pandas as pd
from modin.pandas.test.utils import df_equals

test_filename = "test.csv"
kwargs = {
    "filepath_or_buffer": test_filename,
    'escapechar': 'x',
    
}
test_data = """col1,col2,col3,col4,col5,col6
240,2000-01-02,240,00:00:00,"wxaxcqgjsx",3_964.085033
250,2000-01-02,250,01:00:00,iXoWvqsiLs,9_097.697571
260,2000-01-02,260,02:00:00,hfWLSuCHlM,6_897.854510
410,2000-01-02,410,17:00:00,"BqwLxveyZg",6_123.584172
420,2000-01-02,420,18:00:00,vRKHJWNtKq,460.136928
"""

try:
    with open(test_filename, "w") as f:
        f.write(test_data)

    df_pandas = pandas.read_csv(**kwargs)
    print("pandas.read_csv output:\n", df_pandas)
    df_pd = pd.read_csv(**kwargs)
    print("pd.read_csv output:\n", df_pd)
    df_equals(df_pandas, df_pd)
finally:
    os.remove(test_filename)
```

<!--
You can obtain the Modin version with

python -c "import modin; print(modin.__version__)"
-->

### Describe the problem
<!-- Describe the problem clearly here. -->

### Source code / logs
<!-- Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. Try to provide a reproducible test case that is the bare minimum necessary to generate the problem. -->
```
pandas.read_csv output:
    col1        col2  col3      col4                                               col5         col6
0   240  2000-01-02   240  00:00:00  wacqgjs",3964.085033\n250,2000-01-02,250,01:00...  6123.584172
1   420  2000-01-02   420  18:00:00                                         vRKHJWNtKq   460.136928
Traceback (most recent call last):
  File "test.py", line 167, in <module>
    df_pd = pd.read_csv(**kwargs)
  File "/modin/modin/pandas/io.py", line 109, in parser_func
    return _read(**kwargs)
  File "/modin/modin/pandas/io.py", line 127, in _read
    pd_obj = EngineDispatcher.read_csv(**kwargs)
  File "/modin/modin/data_management/factories/dispatcher.py", line 104, in read_csv
    return cls.__engine._read_csv(**kwargs)
  File "/modin/modin/data_management/factories/factories.py", line 87, in _read_csv
    return cls.io_cls.read_csv(**kwargs)
  File "/modin/modin/engines/base/io/file_reader.py", line 29, in read
    query_compiler = cls._read(*args, **kwargs)
  File "/modin/modin/engines/base/io/text/csv_reader.py", line 176, in _read
    row_lengths = cls.materialize(index_ids)
  File "/modin/modin/engines/ray/task_wrapper.py", line 29, in materialize
    return ray.get(obj_id)
  File "/miniconda3/envs/modin_new/lib/python3.8/site-packages/ray/worker.py", line 1452, in get
    raise value.as_instanceof_cause()
ray.exceptions.RayTaskError(ParserError): ray::deploy_ray_func() (pid=44127, ip=10.241.129.69)
  File "python/ray/_raylet.pyx", line 482, in ray._raylet.execute_task
  File "/modin3/modin/engines/ray/task_wrapper.py", line 19, in deploy_ray_func
    return func(**args)
  File "/modin3/modin/backends/pandas/parsers.py", line 110, in parse
    pandas_df = pandas.read_csv(BytesIO(to_read), **kwargs)
  File "/miniconda3/envs/modin_new/lib/python3.8/site-packages/pandas/io/parsers.py", line 688, in read_csv
    return _read(filepath_or_buffer, kwds)
  File "/miniconda3/envs/modin_new/lib/python3.8/site-packages/pandas/io/parsers.py", line 454, in _read
    parser = TextFileReader(fp_or_buf, **kwds)
  File "/miniconda3/envs/modin_new/lib/python3.8/site-packages/pandas/io/parsers.py", line 948, in __init__
    self._make_engine(self.engine)
  File "/miniconda3/envs/modin_new/lib/python3.8/site-packages/pandas/io/parsers.py", line 1180, in _make_engine
    self._engine = CParserWrapper(self.f, **self.options)
  File "/miniconda3/envs/modin_new/lib/python3.8/site-packages/pandas/io/parsers.py", line 2010, in __init__
    self._reader = parsers.TextReader(src, **kwds)
  File "pandas/_libs/parsers.pyx", line 537, in pandas._libs.parsers.TextReader.__cinit__
  File "pandas/_libs/parsers.pyx", line 797, in pandas._libs.parsers.TextReader._get_header
  File "pandas/_libs/parsers.pyx", line 905, in pandas._libs.parsers.TextReader._tokenize_rows
  File "pandas/_libs/parsers.pyx", line 2042, in pandas._libs.parsers.raise_parser_error
pandas.errors.ParserError: Error tokenizing data. C error: EOF inside string starting at row 0
```


Discussion:
I am able to reproduce this error on the latest master.

Resolving patch:
diff --git a/modin/core/io/text/text_file_dispatcher.py b/modin/core/io/text/text_file_dispatcher.py
--- a/modin/core/io/text/text_file_dispatcher.py
+++ b/modin/core/io/text/text_file_dispatcher.py
@@ -661,6 +661,9 @@ def check_parameters_support(
         if read_kwargs["lineterminator"] is not None:
             return (False, "`lineterminator` parameter is not supported")
 
+        if read_kwargs["escapechar"] is not None:
+            return (False, "`escapechar` parameter is not supported")
+
         skiprows_supported = True
         if is_list_like(skiprows_md) and skiprows_md[0] < header_size:
             skiprows_supported = False


Test patch:
diff --git a/modin/pandas/test/test_io.py b/modin/pandas/test/test_io.py
--- a/modin/pandas/test/test_io.py
+++ b/modin/pandas/test/test_io.py
@@ -715,11 +715,6 @@ def test_read_csv_file_format(
         escapechar,
         dialect,
     ):
-        if Engine.get() != "Python" and escapechar:
-            pytest.xfail(
-                "read_csv with Ray engine fails with some 'escapechar' parameters - issue #2494"
-            )
-
         with ensure_clean(".csv") as unique_filename:
             if dialect:
                 test_csv_dialect_params = {