Skip to content
Closed
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
22 changes: 19 additions & 3 deletions python/pyspark/sql/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,34 @@ def require_test_compiled() -> None:

def require_minimum_plotly_version() -> None:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, don't we also support plot in the plain DataFrame.plot too? Then it should stay here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

@zhengruifeng zhengruifeng Dec 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this require_minimum_plotly_version is only used for plain DF.plot

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sense, let me keep it in the file

"""Raise ImportError if plotly is not installed"""
from pyspark.loose_version import LooseVersion

minimum_plotly_version = "4.8"

try:
import plotly # noqa: F401
import plotly

have_plotly = True
except ImportError as error:
have_plotly = False
raised_error = error
if not have_plotly:
raise PySparkImportError(
errorClass="PACKAGE_NOT_INSTALLED",
messageParameters={
"package_name": "plotly",
"package_name": "Plotly",
"minimum_version": str(minimum_plotly_version),
},
) from error
) from raised_error
if LooseVersion(plotly.__version__) < LooseVersion(minimum_plotly_version):
raise PySparkImportError(
errorClass="UNSUPPORTED_PACKAGE_VERSION",
messageParameters={
"package_name": "Plotly",
"minimum_version": str(minimum_plotly_version),
"current_version": str(plotly.__version__),
},
)


class ForeachBatchFunction:
Expand Down