Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengruifeng committed Jun 7, 2024
1 parent 835a173 commit 63ef2d8
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 23 deletions.
6 changes: 5 additions & 1 deletion python/pyspark/pandas/plot/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,10 +572,14 @@ def _get_plot_backend(backend=None):
return module

def __call__(self, kind="line", backend=None, **kwargs):
kind = {"density": "kde"}.get(kind, kind)

if is_remote() and kind in ["hist", "kde"]:
return unsupported_function(class_name="pd.DataFrame", method_name=kind)()

plot_backend = PandasOnSparkPlotAccessor._get_plot_backend(backend)
plot_data = self.data

kind = {"density": "kde"}.get(kind, kind)
if hasattr(plot_backend, "plot_pandas_on_spark"):
# use if there's pandas-on-Spark specific method.
return plot_backend.plot_pandas_on_spark(plot_data, kind=kind, **kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,22 @@

from pyspark.pandas.tests.plot.test_frame_plot_matplotlib import DataFramePlotMatplotlibTestsMixin
from pyspark.testing.connectutils import ReusedConnectTestCase
from pyspark.pandas.exceptions import PandasNotImplementedError
from pyspark.testing.pandasutils import PandasOnSparkTestUtils, TestUtils


class DataFramePlotMatplotlibParityTests(
DataFramePlotMatplotlibTestsMixin, PandasOnSparkTestUtils, TestUtils, ReusedConnectTestCase
):
@unittest.skip("Test depends on Spark ML which is not supported from Spark Connect.")
def test_hist_plot(self):
super().test_hist_plot()
# "Test depends on Spark ML which is not supported from Spark Connect."
with self.assertRaises(PandasNotImplementedError) as pe:
super().test_hist_plot()

@unittest.skip("Test depends on Spark ML which is not supported from Spark Connect.")
def test_kde_plot(self):
super().test_kde_plot()
# "Test depends on Spark ML which is not supported from Spark Connect."
with self.assertRaises(PandasNotImplementedError) as pe:
super().test_kde_plot()


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,27 @@

from pyspark.pandas.tests.plot.test_frame_plot_plotly import DataFramePlotPlotlyTestsMixin
from pyspark.testing.connectutils import ReusedConnectTestCase
from pyspark.pandas.exceptions import PandasNotImplementedError
from pyspark.testing.pandasutils import PandasOnSparkTestUtils, TestUtils


class DataFramePlotPlotlyParityTests(
DataFramePlotPlotlyTestsMixin, PandasOnSparkTestUtils, TestUtils, ReusedConnectTestCase
):
@unittest.skip("Test depends on Spark ML which is not supported from Spark Connect.")
def test_hist_layout_kwargs(self):
super().test_hist_layout_kwargs()
# "Test depends on Spark ML which is not supported from Spark Connect."
with self.assertRaises(PandasNotImplementedError) as pe:
super().test_hist_layout_kwargs()

@unittest.skip("Test depends on Spark ML which is not supported from Spark Connect.")
def test_hist_plot(self):
super().test_hist_plot()
# "Test depends on Spark ML which is not supported from Spark Connect."
with self.assertRaises(PandasNotImplementedError) as pe:
super().test_hist_plot()

@unittest.skip("Test depends on Spark ML which is not supported from Spark Connect.")
def test_kde_plot(self):
super().test_kde_plot()
# "Test depends on Spark ML which is not supported from Spark Connect."
with self.assertRaises(PandasNotImplementedError) as pe:
super().test_kde_plot()


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,37 @@

from pyspark.pandas.tests.plot.test_series_plot_matplotlib import SeriesPlotMatplotlibTestsMixin
from pyspark.testing.connectutils import ReusedConnectTestCase
from pyspark.pandas.exceptions import PandasNotImplementedError
from pyspark.testing.pandasutils import PandasOnSparkTestUtils, TestUtils


class SeriesPlotMatplotlibParityTests(
SeriesPlotMatplotlibTestsMixin, PandasOnSparkTestUtils, TestUtils, ReusedConnectTestCase
):
@unittest.skip("Test depends on Spark ML which is not supported from Spark Connect.")
def test_empty_hist(self):
# "Test depends on Spark ML which is not supported from Spark Connect."
with self.assertRaises(PandasNotImplementedError) as pe:
super().test_empty_hist()

def test_hist(self):
super().test_hist()
# "Test depends on Spark ML which is not supported from Spark Connect."
with self.assertRaises(PandasNotImplementedError) as pe:
super().test_hist()

@unittest.skip("Test depends on Spark ML which is not supported from Spark Connect.")
def test_hist_plot(self):
super().test_hist_plot()
# "Test depends on Spark ML which is not supported from Spark Connect."
with self.assertRaises(PandasNotImplementedError) as pe:
super().test_hist_plot()

@unittest.skip("Test depends on Spark ML which is not supported from Spark Connect.")
def test_kde_plot(self):
super().test_kde_plot()
# "Test depends on Spark ML which is not supported from Spark Connect."
with self.assertRaises(PandasNotImplementedError) as pe:
super().test_kde_plot()

@unittest.skip("Test depends on Spark ML which is not supported from Spark Connect.")
def test_single_value_hist(self):
super().test_single_value_hist()
# "Test depends on Spark ML which is not supported from Spark Connect."
with self.assertRaises(PandasNotImplementedError) as pe:
super().test_single_value_hist()


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,22 @@

from pyspark.pandas.tests.plot.test_series_plot_plotly import SeriesPlotPlotlyTestsMixin
from pyspark.testing.connectutils import ReusedConnectTestCase
from pyspark.pandas.exceptions import PandasNotImplementedError
from pyspark.testing.pandasutils import PandasOnSparkTestUtils, TestUtils


class SeriesPlotPlotlyParityTests(
SeriesPlotPlotlyTestsMixin, PandasOnSparkTestUtils, TestUtils, ReusedConnectTestCase
):
@unittest.skip("Test depends on Spark ML which is not supported from Spark Connect.")
def test_hist_plot(self):
super().test_hist_plot()
# "Test depends on Spark ML which is not supported from Spark Connect."
with self.assertRaises(PandasNotImplementedError) as pe:
super().test_hist_plot()

@unittest.skip("Test depends on Spark ML which is not supported from Spark Connect.")
def test_kde_plot(self):
super().test_kde_plot()
# "Test depends on Spark ML which is not supported from Spark Connect."
with self.assertRaises(PandasNotImplementedError) as pe:
super().test_kde_plot()


if __name__ == "__main__":
Expand Down

0 comments on commit 63ef2d8

Please sign in to comment.