Skip to content

Conversation

@jkbradley
Copy link
Member

What changes were proposed in this pull request?

PySpark Param constructors need to pass the TypeConverter argument by name, partly to make sure it is not mistaken for the expectedType arg and partly because we will remove the expectedType arg in 2.1. In several places, this is not being done correctly.

This PR changes all usages in pyspark/ml/ to keyword args.

How was this patch tested?

Existing unit tests. I will not test type conversion for every Param unless we really think it necessary.

Also, if you start the PySpark shell and import classes (e.g., pyspark.ml.feature.StandardScaler), then you no longer get this warning:

/Users/josephkb/spark/python/pyspark/ml/param/__init__.py:58: UserWarning: expectedType is deprecated and will be removed in 2.1. Use typeConverter instead, as a keyword argument.
  "Use typeConverter instead, as a keyword argument.")

That warning came from the typeConverter argument being passes as the expectedType arg by mistake.

@jkbradley
Copy link
Member Author

CC: @sethah This fixes some items I missed while reviewing your PR for type conversion. I just found them when using the pyspark shell.

CC: @mengxr CCing you since a few lines from this PR are fixing code you touched previously. By the way, we could go ahead and removed the expectedType in 2.0. The only reason to keep it is to avoid breaking 3rd party implementations of PipelineStages in Python which happen to be using the expectedType arg, and I'm not sure how many there are.

@SparkQA
Copy link

SparkQA commented Apr 18, 2016

Test build #56127 has finished for PR 12480 at commit 9411098.

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

@sethah
Copy link
Contributor

sethah commented Apr 18, 2016

LGTM. Thanks for catching those!

@jkbradley
Copy link
Member Author

Np, thanks for reviewing! I'll merge this with master

@asfgit asfgit closed this in d29e429 Apr 19, 2016
@jkbradley jkbradley deleted the typeconverter-fix branch April 19, 2016 02:14
lw-lin pushed a commit to lw-lin/spark that referenced this pull request Apr 20, 2016
…rg for Param constructor

## What changes were proposed in this pull request?

PySpark Param constructors need to pass the TypeConverter argument by name, partly to make sure it is not mistaken for the expectedType arg and partly because we will remove the expectedType arg in 2.1. In several places, this is not being done correctly.

This PR changes all usages in pyspark/ml/ to keyword args.

## How was this patch tested?

Existing unit tests.  I will not test type conversion for every Param unless we really think it necessary.

Also, if you start the PySpark shell and import classes (e.g., pyspark.ml.feature.StandardScaler), then you no longer get this warning:
```
/Users/josephkb/spark/python/pyspark/ml/param/__init__.py:58: UserWarning: expectedType is deprecated and will be removed in 2.1. Use typeConverter instead, as a keyword argument.
  "Use typeConverter instead, as a keyword argument.")
```
That warning came from the typeConverter argument being passes as the expectedType arg by mistake.

Author: Joseph K. Bradley <[email protected]>

Closes apache#12480 from jkbradley/typeconverter-fix.
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.

3 participants