Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ object ImageSchema {
* @return DataFrame with a single column "image" of images;
* see ImageSchema for the details
*/
@deprecated("use `spark.read.format(\"image\").load(path)` and this `readImages` will be " +
"removed in 3.0.0.", "2.4.0")
def readImages(path: String): DataFrame = readImages(path, null, false, -1, false, 1.0, 0)

/**
Expand All @@ -218,6 +220,8 @@ object ImageSchema {
* @return DataFrame with a single column "image" of images;
* see ImageSchema for the details
*/
@deprecated("use `spark.read.format(\"image\").load(path)` and this `readImages` will be " +
"removed in 3.0.0.", "2.4.0")
def readImages(
path: String,
sparkSession: SparkSession,
Expand Down
8 changes: 7 additions & 1 deletion python/pyspark/ml/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
"""

import sys
import warnings

import numpy as np

from pyspark import SparkContext
from pyspark.sql.types import Row, _create_row, _parse_datatype_json_string
from pyspark.sql import DataFrame, SparkSession
Expand Down Expand Up @@ -207,6 +209,9 @@ def readImages(self, path, recursive=False, numPartitions=-1,
.. note:: If sample ratio is less than 1, sampling uses a PathFilter that is efficient but
potentially non-deterministic.

.. note:: Deprecated in 2.4.0. Use `spark.read.format("image").load(path)` instead and
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to issue a warning when people call this code path (e.g. warnings.warn)? We do it in some of the other Python deprecated APIs but not all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added.

this `readImages` will be removed in 3.0.0.

:param str path: Path to the image directory.
:param bool recursive: Recursive search flag.
:param int numPartitions: Number of DataFrame partitions.
Expand All @@ -222,7 +227,8 @@ def readImages(self, path, recursive=False, numPartitions=-1,

.. versionadded:: 2.3.0
"""

warnings.warn("`ImageSchema.readImage` is deprecated. " +
"Use `spark.read.format(\"image\").load(path)` instead.", DeprecationWarning)
spark = SparkSession.builder.getOrCreate()
image_schema = spark._jvm.org.apache.spark.ml.image.ImageSchema
jsession = spark._jsparkSession
Expand Down