Skip to content

Conversation

@WeichenXu123
Copy link
Contributor

What changes were proposed in this pull request?

Deprecate public APIs from ImageSchema.

How was this patch tested?

N/A

@SparkQA
Copy link

SparkQA commented Sep 6, 2018

Test build #95749 has finished for PR 22349 at commit 2397321.

  • This patch fails Python style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Sep 6, 2018

Test build #95751 has finished for PR 22349 at commit 38c33da.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

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
Copy link
Member

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 " +
Copy link
Contributor

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.

@SparkQA
Copy link

SparkQA commented Sep 7, 2018

Test build #95796 has finished for PR 22349 at commit f5a13a5.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

.. 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.

@SparkQA
Copy link

SparkQA commented Sep 8, 2018

Test build #95817 has finished for PR 22349 at commit 5cefd23.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

from pyspark import SparkContext
from pyspark.sql.types import Row, _create_row, _parse_datatype_json_string
from pyspark.sql import DataFrame, SparkSession
import warnings
Copy link
Member

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

"""

warnings.warn("`ImageSchema.readImage` is deprecated. " +
"Use `spark.read.format(\"image\").load(path)` instead.")
Copy link
Member

Choose a reason for hiding this comment

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

warnings.warn(..., DeprecationWarning)

@mengxr
Copy link
Contributor

mengxr commented Sep 8, 2018

@WeichenXu123 Could you address the comments?

@SparkQA
Copy link

SparkQA commented Sep 8, 2018

Test build #95831 has finished for PR 22349 at commit 576b7d8.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

asfgit pushed a commit that referenced this pull request Sep 8, 2018
## 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]>
@mengxr
Copy link
Contributor

mengxr commented Sep 8, 2018

LGTM. Merged into master and branch-2.4. Thanks!

@asfgit asfgit closed this in 08c02e6 Sep 8, 2018
@WeichenXu123 WeichenXu123 deleted the image_api_deprecate branch September 9, 2018 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants