Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Anatoly Myachev <[email protected]>
  • Loading branch information
anmyachev committed Dec 5, 2023
1 parent 41e4cc9 commit 33818d3
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ def __make_write(*classes, build_args=build_args):
read_custom_text = __make_read(

Check warning on line 92 in modin/core/execution/dask/implementations/pandas_on_dask/io/io.py

View check run for this annotation

Codecov / codecov/patch

modin/core/execution/dask/implementations/pandas_on_dask/io/io.py#L91-L92

Added lines #L91 - L92 were not covered by tests
ExperimentalCustomTextParser, ExperimentalCustomTextDispatcher
)
read_sql_distributed = __make_read(ExperimentalSQLDispatcher)
read_sql_distributed = __make_read(

Check warning on line 95 in modin/core/execution/dask/implementations/pandas_on_dask/io/io.py

View check run for this annotation

Codecov / codecov/patch

modin/core/execution/dask/implementations/pandas_on_dask/io/io.py#L95

Added line #L95 was not covered by tests
ExperimentalSQLDispatcher, build_args={**build_args, "base_read": read_sql}
)

del __make_read # to not pollute class namespace
del __make_write # to not pollute class namespace
58 changes: 26 additions & 32 deletions modin/core/execution/dispatching/factories/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,33 +329,6 @@ def _read_pickle(cls, **kwargs):
method="read_sql",
)
def _read_sql(cls, **kwargs):
if IsExperimental.get():
supported_engines = ("Ray", "Unidist", "Dask")
if Engine.get() not in supported_engines:
if "partition_column" in kwargs:
if kwargs["partition_column"] is not None:
warnings.warn(
f"Distributed read_sql() was only implemented for {', '.join(supported_engines)} engines."
)
del kwargs["partition_column"]
if "lower_bound" in kwargs:
if kwargs["lower_bound"] is not None:
warnings.warn(
f"Distributed read_sql() was only implemented for {', '.join(supported_engines)} engines."
)
del kwargs["lower_bound"]
if "upper_bound" in kwargs:
if kwargs["upper_bound"] is not None:
warnings.warn(
f"Distributed read_sql() was only implemented for {', '.join(supported_engines)} engines."
)
del kwargs["upper_bound"]
if "max_sessions" in kwargs:
if kwargs["max_sessions"] is not None:
warnings.warn(
f"Distributed read_sql() was only implemented for {', '.join(supported_engines)} engines."
)
del kwargs["max_sessions"]
return cls.io_cls.read_sql(**kwargs)

@classmethod
Expand Down Expand Up @@ -490,11 +463,32 @@ def _read_pickle_distributed(cls, **kwargs):
params=_doc_io_method_kwargs_params,
)
def _read_sql_distributed(cls, **kwargs):
current_execution = get_current_execution()
if current_execution not in supported_execution:
raise NotImplementedError(
f"`_read_sql_distributed()` is not implemented for {current_execution} execution."
)
supported_engines = ("Ray", "Unidist", "Dask")
if Engine.get() not in supported_engines:
if "partition_column" in kwargs:
if kwargs["partition_column"] is not None:
warnings.warn(
f"Distributed read_sql() was only implemented for {', '.join(supported_engines)} engines."
)
del kwargs["partition_column"]
if "lower_bound" in kwargs:
if kwargs["lower_bound"] is not None:
warnings.warn(
f"Distributed read_sql() was only implemented for {', '.join(supported_engines)} engines."
)
del kwargs["lower_bound"]
if "upper_bound" in kwargs:
if kwargs["upper_bound"] is not None:
warnings.warn(
f"Distributed read_sql() was only implemented for {', '.join(supported_engines)} engines."
)
del kwargs["upper_bound"]
if "max_sessions" in kwargs:
if kwargs["max_sessions"] is not None:
warnings.warn(
f"Distributed read_sql() was only implemented for {', '.join(supported_engines)} engines."
)
del kwargs["max_sessions"]
return cls.io_cls.read_sql_distributed(**kwargs)

Check warning on line 492 in modin/core/execution/dispatching/factories/factories.py

View check run for this annotation

Codecov / codecov/patch

modin/core/execution/dispatching/factories/factories.py#L492

Added line #L492 was not covered by tests

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ def __make_write(*classes, build_args=build_args):
read_custom_text = __make_read(

Check warning on line 94 in modin/core/execution/ray/implementations/pandas_on_ray/io/io.py

View check run for this annotation

Codecov / codecov/patch

modin/core/execution/ray/implementations/pandas_on_ray/io/io.py#L93-L94

Added lines #L93 - L94 were not covered by tests
ExperimentalCustomTextParser, ExperimentalCustomTextDispatcher
)
read_sql_distributed = __make_read(ExperimentalSQLDispatcher)
read_sql_distributed = __make_read(

Check warning on line 97 in modin/core/execution/ray/implementations/pandas_on_ray/io/io.py

View check run for this annotation

Codecov / codecov/patch

modin/core/execution/ray/implementations/pandas_on_ray/io/io.py#L97

Added line #L97 was not covered by tests
ExperimentalSQLDispatcher, build_args={**build_args, "base_read": read_sql}
)

del __make_read # to not pollute class namespace
del __make_write # to not pollute class namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ def __make_write(*classes, build_args=build_args):
read_custom_text = __make_read(

Check warning on line 93 in modin/core/execution/unidist/implementations/pandas_on_unidist/io/io.py

View check run for this annotation

Codecov / codecov/patch

modin/core/execution/unidist/implementations/pandas_on_unidist/io/io.py#L92-L93

Added lines #L92 - L93 were not covered by tests
ExperimentalCustomTextParser, ExperimentalCustomTextDispatcher
)
read_sql_distributed = __make_read(ExperimentalSQLDispatcher)
read_sql_distributed = __make_read(

Check warning on line 96 in modin/core/execution/unidist/implementations/pandas_on_unidist/io/io.py

View check run for this annotation

Codecov / codecov/patch

modin/core/execution/unidist/implementations/pandas_on_unidist/io/io.py#L96

Added line #L96 was not covered by tests
ExperimentalSQLDispatcher, build_args={**build_args, "base_read": read_sql}
)

del __make_read # to not pollute class namespace
del __make_write # to not pollute class namespace
Expand Down
2 changes: 1 addition & 1 deletion modin/experimental/core/io/sql/sql_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def _read(
message = "Defaulting to Modin core implementation; \
'partition_column', 'lower_bound', 'upper_bound' must be different from None"
warnings.warn(message)
return cls.base_io.read_sql(
return cls.base_read(

Check warning on line 75 in modin/experimental/core/io/sql/sql_dispatcher.py

View check run for this annotation

Codecov / codecov/patch

modin/experimental/core/io/sql/sql_dispatcher.py#L75

Added line #L75 was not covered by tests
sql,
con,
index_col,
Expand Down

0 comments on commit 33818d3

Please sign in to comment.