diff options
author | Davies Liu <davies@databricks.com> | 2015-12-16 15:48:11 -0800 |
---|---|---|
committer | Davies Liu <davies.liu@gmail.com> | 2015-12-16 15:48:11 -0800 |
commit | 27b98e99d21a0cc34955337f82a71a18f9220ab2 (patch) | |
tree | 4eb3a116264543d9fc0e1121bc93ccaa5b3113f7 /python/pyspark/mllib/feature.py | |
parent | 3a44aebd0c5331f6ff00734fa44ef63f8d18cfbb (diff) | |
download | spark-27b98e99d21a0cc34955337f82a71a18f9220ab2.tar.gz spark-27b98e99d21a0cc34955337f82a71a18f9220ab2.tar.bz2 spark-27b98e99d21a0cc34955337f82a71a18f9220ab2.zip |
[SPARK-12380] [PYSPARK] use SQLContext.getOrCreate in mllib
MLlib should use SQLContext.getOrCreate() instead of creating new SQLContext.
Author: Davies Liu <davies@databricks.com>
Closes #10338 from davies/create_context.
Diffstat (limited to 'python/pyspark/mllib/feature.py')
-rw-r--r-- | python/pyspark/mllib/feature.py | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/python/pyspark/mllib/feature.py b/python/pyspark/mllib/feature.py index 7254679ebb..acd7ec57d6 100644 --- a/python/pyspark/mllib/feature.py +++ b/python/pyspark/mllib/feature.py @@ -30,7 +30,7 @@ if sys.version >= '3': from py4j.protocol import Py4JJavaError -from pyspark import SparkContext, since +from pyspark import since from pyspark.rdd import RDD, ignore_unicode_prefix from pyspark.mllib.common import callMLlibFunc, JavaModelWrapper from pyspark.mllib.linalg import ( @@ -100,8 +100,6 @@ class Normalizer(VectorTransformer): :return: normalized vector. If the norm of the input is zero, it will return the input vector. """ - sc = SparkContext._active_spark_context - assert sc is not None, "SparkContext should be initialized first" if isinstance(vector, RDD): vector = vector.map(_convert_to_vector) else: |