-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-25345][ML] Deprecate public APIs from ImageSchema #22349
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
Conversation
|
Test build #95749 has finished for PR 22349 at commit
|
|
Test build #95751 has finished for PR 22349 at commit
|
python/pyspark/ml/image.py
Outdated
| An attribute of this module that contains the instance of :class:`_ImageSchema`. | ||
| .. note:: Deprecated in 2.4.0. Use `spark.read.format("image").load(path)` instead and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, that datasource wouldn't be able to replace toNDArray and toImage which require numpy. Might be better leave a note that it needs manual conversion with NumPy API for both.
| */ | ||
| @Experimental | ||
| @Since("2.3.0") | ||
| @deprecated("use `spark.read.format(\"image\").load(path)` and this `ImageSchema` will be " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are other methods defined under ImageSchema that are not covered by the image data source. So we shall only deprecate readImages and leave other public methods as experimental. Same for Python.
|
Test build #95796 has finished for PR 22349 at commit
|
| .. 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added.
|
Test build #95817 has finished for PR 22349 at commit
|
python/pyspark/ml/image.py
Outdated
| from pyspark import SparkContext | ||
| from pyspark.sql.types import Row, _create_row, _parse_datatype_json_string | ||
| from pyspark.sql import DataFrame, SparkSession | ||
| import warnings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically builtin package should be ordered above per PEP 8. I wonder why this is not caught.
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
python/pyspark/ml/image.py
Outdated
| """ | ||
|
|
||
| warnings.warn("`ImageSchema.readImage` is deprecated. " + | ||
| "Use `spark.read.format(\"image\").load(path)` instead.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warnings.warn(..., DeprecationWarning)
|
@WeichenXu123 Could you address the comments? |
|
Test build #95831 has finished for PR 22349 at commit
|
## What changes were proposed in this pull request? Deprecate public APIs from ImageSchema. ## How was this patch tested? N/A Closes #22349 from WeichenXu123/image_api_deprecate. Authored-by: WeichenXu <[email protected]> Signed-off-by: Xiangrui Meng <[email protected]> (cherry picked from commit 08c02e6) Signed-off-by: Xiangrui Meng <[email protected]>
|
LGTM. Merged into master and branch-2.4. Thanks! |
What changes were proposed in this pull request?
Deprecate public APIs from ImageSchema.
How was this patch tested?
N/A