Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX-#2737: fix handling of dates for read_csv with OmniSci backend #2738

Merged
merged 2 commits into from
Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions modin/experimental/engines/omnisci_on_ray/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ def read_csv(
null_values=None,
true_values=None,
false_values=None,
# timestamp fields should be handled as strings if parse_dates
# didn't passed explicitly as an array or a dict
timestamp_parsers=[""] if isinstance(parse_dates, bool) else None,
strings_can_be_null=None,
include_columns=None,
include_missing_columns=None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
test_data_keys,
generate_multiindex,
eval_general,
eval_io,
)


Expand Down Expand Up @@ -116,6 +117,7 @@ def run_modin(
df_equals(ref_res, exp_res)


@pytest.mark.usefixtures("TestReadCSVFixture")
class TestCSV:
root = os.path.abspath(__file__ + "/.." * 6) # root of modin repo

Expand Down Expand Up @@ -302,6 +304,30 @@ def test_float32(self):

df_equals(modin_df, pandas_df)

# Datetime Handling tests
@pytest.mark.parametrize("engine", [None, "arrow"])
@pytest.mark.parametrize(
"parse_dates",
[
True,
False,
["col2"],
],
)
def test_read_csv_datetime(
self,
engine,
parse_dates,
):

eval_io(
fn_name="read_csv",
md_extra_kwargs={"engine": engine},
# read_csv kwargs
filepath_or_buffer=pytest.csvs_names["test_read_csv_regular"],
parse_dates=parse_dates,
)


class TestMasks:
data = {
Expand Down
12 changes: 11 additions & 1 deletion modin/pandas/test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ def eval_general(
check_exception_type=True,
raising_exceptions=None,
check_kwargs_callable=True,
md_extra_kwargs=None,
anmyachev marked this conversation as resolved.
Show resolved Hide resolved
**kwargs,
):
if raising_exceptions:
Expand Down Expand Up @@ -689,6 +690,10 @@ def execute_callable(fn, inplace=False, md_kwargs={}, pd_kwargs={}):
md_kwargs[key] = md_value
pd_kwargs[key] = pd_value

if md_extra_kwargs:
assert isinstance(md_extra_kwargs, dict)
md_kwargs.update(md_extra_kwargs)

values = execute_callable(
operation, md_kwargs=md_kwargs, pd_kwargs=pd_kwargs, inplace=__inplace__
)
Expand All @@ -704,6 +709,7 @@ def eval_io(
raising_exceptions=io_ops_bad_exc,
check_kwargs_callable=True,
modin_warning=None,
md_extra_kwargs=None,
*args,
**kwargs,
):
Expand All @@ -726,7 +732,10 @@ def eval_io(
Exceptions that should be raised even if they are raised
both by Pandas and Modin (check evaluated only if
`check_exception_type` passed as `True`).
modin_warning: Warning that should be raised by Modin.
modin_warning: obj
Warning that should be raised by Modin.
md_extra_kwargs: dict
Modin operation specific kwargs.
"""

def applyier(module, *args, **kwargs):
Expand All @@ -743,6 +752,7 @@ def call_eval_general():
check_exception_type=check_exception_type,
raising_exceptions=raising_exceptions,
check_kwargs_callable=check_kwargs_callable,
md_extra_kwargs=md_extra_kwargs,
*args,
**kwargs,
)
Expand Down