partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
Profiler.show
Print the profile stats to stdout, id is the RDD id
python/pyspark/profiler.py
def show(self, id): """ Print the profile stats to stdout, id is the RDD id """ stats = self.stats() if stats: print("=" * 60) print("Profile of RDD<id=%d>" % id) print("=" * 60) stats.sort_stats("time", "cumulative").print_stats()
def show(self, id): """ Print the profile stats to stdout, id is the RDD id """ stats = self.stats() if stats: print("=" * 60) print("Profile of RDD<id=%d>" % id) print("=" * 60) stats.sort_stats("time", "cumulative").print_stats()
[ "Print", "the", "profile", "stats", "to", "stdout", "id", "is", "the", "RDD", "id" ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/profiler.py#L113-L120
[ "def", "show", "(", "self", ",", "id", ")", ":", "stats", "=", "self", ".", "stats", "(", ")", "if", "stats", ":", "print", "(", "\"=\"", "*", "60", ")", "print", "(", "\"Profile of RDD<id=%d>\"", "%", "id", ")", "print", "(", "\"=\"", "*", "60", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
Profiler.dump
Dump the profile into path, id is the RDD id
python/pyspark/profiler.py
def dump(self, id, path): """ Dump the profile into path, id is the RDD id """ if not os.path.exists(path): os.makedirs(path) stats = self.stats() if stats: p = os.path.join(path, "rdd_%d.pstats" % id) stats.dump_stats(p)
def dump(self, id, path): """ Dump the profile into path, id is the RDD id """ if not os.path.exists(path): os.makedirs(path) stats = self.stats() if stats: p = os.path.join(path, "rdd_%d.pstats" % id) stats.dump_stats(p)
[ "Dump", "the", "profile", "into", "path", "id", "is", "the", "RDD", "id" ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/profiler.py#L122-L129
[ "def", "dump", "(", "self", ",", "id", ",", "path", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "os", ".", "makedirs", "(", "path", ")", "stats", "=", "self", ".", "stats", "(", ")", "if", "stats", ":", "p"...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
BasicProfiler.profile
Runs and profiles the method to_profile passed in. A profile object is returned.
python/pyspark/profiler.py
def profile(self, func): """ Runs and profiles the method to_profile passed in. A profile object is returned. """ pr = cProfile.Profile() pr.runcall(func) st = pstats.Stats(pr) st.stream = None # make it picklable st.strip_dirs() # Adds a new profile to the exis...
def profile(self, func): """ Runs and profiles the method to_profile passed in. A profile object is returned. """ pr = cProfile.Profile() pr.runcall(func) st = pstats.Stats(pr) st.stream = None # make it picklable st.strip_dirs() # Adds a new profile to the exis...
[ "Runs", "and", "profiles", "the", "method", "to_profile", "passed", "in", ".", "A", "profile", "object", "is", "returned", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/profiler.py#L158-L167
[ "def", "profile", "(", "self", ",", "func", ")", ":", "pr", "=", "cProfile", ".", "Profile", "(", ")", "pr", ".", "runcall", "(", "func", ")", "st", "=", "pstats", ".", "Stats", "(", "pr", ")", "st", ".", "stream", "=", "None", "# make it picklable...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SQLContext.getOrCreate
Get the existing SQLContext or create a new one with given SparkContext. :param sc: SparkContext
python/pyspark/sql/context.py
def getOrCreate(cls, sc): """ Get the existing SQLContext or create a new one with given SparkContext. :param sc: SparkContext """ if cls._instantiatedContext is None: jsqlContext = sc._jvm.SQLContext.getOrCreate(sc._jsc.sc()) sparkSession = SparkSession(...
def getOrCreate(cls, sc): """ Get the existing SQLContext or create a new one with given SparkContext. :param sc: SparkContext """ if cls._instantiatedContext is None: jsqlContext = sc._jvm.SQLContext.getOrCreate(sc._jsc.sc()) sparkSession = SparkSession(...
[ "Get", "the", "existing", "SQLContext", "or", "create", "a", "new", "one", "with", "given", "SparkContext", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/context.py#L103-L113
[ "def", "getOrCreate", "(", "cls", ",", "sc", ")", ":", "if", "cls", ".", "_instantiatedContext", "is", "None", ":", "jsqlContext", "=", "sc", ".", "_jvm", ".", "SQLContext", ".", "getOrCreate", "(", "sc", ".", "_jsc", ".", "sc", "(", ")", ")", "spark...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SQLContext.setConf
Sets the given Spark SQL configuration property.
python/pyspark/sql/context.py
def setConf(self, key, value): """Sets the given Spark SQL configuration property. """ self.sparkSession.conf.set(key, value)
def setConf(self, key, value): """Sets the given Spark SQL configuration property. """ self.sparkSession.conf.set(key, value)
[ "Sets", "the", "given", "Spark", "SQL", "configuration", "property", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/context.py#L125-L128
[ "def", "setConf", "(", "self", ",", "key", ",", "value", ")", ":", "self", ".", "sparkSession", ".", "conf", ".", "set", "(", "key", ",", "value", ")" ]
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SQLContext.getConf
Returns the value of Spark SQL configuration property for the given key. If the key is not set and defaultValue is set, return defaultValue. If the key is not set and defaultValue is not set, return the system default value. >>> sqlContext.getConf("spark.sql.shuffle.partitions") ...
python/pyspark/sql/context.py
def getConf(self, key, defaultValue=_NoValue): """Returns the value of Spark SQL configuration property for the given key. If the key is not set and defaultValue is set, return defaultValue. If the key is not set and defaultValue is not set, return the system default value. >>>...
def getConf(self, key, defaultValue=_NoValue): """Returns the value of Spark SQL configuration property for the given key. If the key is not set and defaultValue is set, return defaultValue. If the key is not set and defaultValue is not set, return the system default value. >>>...
[ "Returns", "the", "value", "of", "Spark", "SQL", "configuration", "property", "for", "the", "given", "key", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/context.py#L132-L147
[ "def", "getConf", "(", "self", ",", "key", ",", "defaultValue", "=", "_NoValue", ")", ":", "return", "self", ".", "sparkSession", ".", "conf", ".", "get", "(", "key", ",", "defaultValue", ")" ]
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SQLContext.range
Create a :class:`DataFrame` with single :class:`pyspark.sql.types.LongType` column named ``id``, containing elements in a range from ``start`` to ``end`` (exclusive) with step value ``step``. :param start: the start value :param end: the end value (exclusive) :param step: the in...
python/pyspark/sql/context.py
def range(self, start, end=None, step=1, numPartitions=None): """ Create a :class:`DataFrame` with single :class:`pyspark.sql.types.LongType` column named ``id``, containing elements in a range from ``start`` to ``end`` (exclusive) with step value ``step``. :param start: the sta...
def range(self, start, end=None, step=1, numPartitions=None): """ Create a :class:`DataFrame` with single :class:`pyspark.sql.types.LongType` column named ``id``, containing elements in a range from ``start`` to ``end`` (exclusive) with step value ``step``. :param start: the sta...
[ "Create", "a", ":", "class", ":", "DataFrame", "with", "single", ":", "class", ":", "pyspark", ".", "sql", ".", "types", ".", "LongType", "column", "named", "id", "containing", "elements", "in", "a", "range", "from", "start", "to", "end", "(", "exclusive...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/context.py#L159-L179
[ "def", "range", "(", "self", ",", "start", ",", "end", "=", "None", ",", "step", "=", "1", ",", "numPartitions", "=", "None", ")", ":", "return", "self", ".", "sparkSession", ".", "range", "(", "start", ",", "end", ",", "step", ",", "numPartitions", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SQLContext.registerFunction
An alias for :func:`spark.udf.register`. See :meth:`pyspark.sql.UDFRegistration.register`. .. note:: Deprecated in 2.3.0. Use :func:`spark.udf.register` instead.
python/pyspark/sql/context.py
def registerFunction(self, name, f, returnType=None): """An alias for :func:`spark.udf.register`. See :meth:`pyspark.sql.UDFRegistration.register`. .. note:: Deprecated in 2.3.0. Use :func:`spark.udf.register` instead. """ warnings.warn( "Deprecated in 2.3.0. Use spa...
def registerFunction(self, name, f, returnType=None): """An alias for :func:`spark.udf.register`. See :meth:`pyspark.sql.UDFRegistration.register`. .. note:: Deprecated in 2.3.0. Use :func:`spark.udf.register` instead. """ warnings.warn( "Deprecated in 2.3.0. Use spa...
[ "An", "alias", "for", ":", "func", ":", "spark", ".", "udf", ".", "register", ".", "See", ":", "meth", ":", "pyspark", ".", "sql", ".", "UDFRegistration", ".", "register", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/context.py#L182-L191
[ "def", "registerFunction", "(", "self", ",", "name", ",", "f", ",", "returnType", "=", "None", ")", ":", "warnings", ".", "warn", "(", "\"Deprecated in 2.3.0. Use spark.udf.register instead.\"", ",", "DeprecationWarning", ")", "return", "self", ".", "sparkSession", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SQLContext.registerJavaFunction
An alias for :func:`spark.udf.registerJavaFunction`. See :meth:`pyspark.sql.UDFRegistration.registerJavaFunction`. .. note:: Deprecated in 2.3.0. Use :func:`spark.udf.registerJavaFunction` instead.
python/pyspark/sql/context.py
def registerJavaFunction(self, name, javaClassName, returnType=None): """An alias for :func:`spark.udf.registerJavaFunction`. See :meth:`pyspark.sql.UDFRegistration.registerJavaFunction`. .. note:: Deprecated in 2.3.0. Use :func:`spark.udf.registerJavaFunction` instead. """ warn...
def registerJavaFunction(self, name, javaClassName, returnType=None): """An alias for :func:`spark.udf.registerJavaFunction`. See :meth:`pyspark.sql.UDFRegistration.registerJavaFunction`. .. note:: Deprecated in 2.3.0. Use :func:`spark.udf.registerJavaFunction` instead. """ warn...
[ "An", "alias", "for", ":", "func", ":", "spark", ".", "udf", ".", "registerJavaFunction", ".", "See", ":", "meth", ":", "pyspark", ".", "sql", ".", "UDFRegistration", ".", "registerJavaFunction", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/context.py#L194-L203
[ "def", "registerJavaFunction", "(", "self", ",", "name", ",", "javaClassName", ",", "returnType", "=", "None", ")", ":", "warnings", ".", "warn", "(", "\"Deprecated in 2.3.0. Use spark.udf.registerJavaFunction instead.\"", ",", "DeprecationWarning", ")", "return", "self...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SQLContext.createDataFrame
Creates a :class:`DataFrame` from an :class:`RDD`, a list or a :class:`pandas.DataFrame`. When ``schema`` is a list of column names, the type of each column will be inferred from ``data``. When ``schema`` is ``None``, it will try to infer the schema (column names and types) from ``data...
python/pyspark/sql/context.py
def createDataFrame(self, data, schema=None, samplingRatio=None, verifySchema=True): """ Creates a :class:`DataFrame` from an :class:`RDD`, a list or a :class:`pandas.DataFrame`. When ``schema`` is a list of column names, the type of each column will be inferred from ``data``. ...
def createDataFrame(self, data, schema=None, samplingRatio=None, verifySchema=True): """ Creates a :class:`DataFrame` from an :class:`RDD`, a list or a :class:`pandas.DataFrame`. When ``schema`` is a list of column names, the type of each column will be inferred from ``data``. ...
[ "Creates", "a", ":", "class", ":", "DataFrame", "from", "an", ":", "class", ":", "RDD", "a", "list", "or", "a", ":", "class", ":", "pandas", ".", "DataFrame", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/context.py#L218-L307
[ "def", "createDataFrame", "(", "self", ",", "data", ",", "schema", "=", "None", ",", "samplingRatio", "=", "None", ",", "verifySchema", "=", "True", ")", ":", "return", "self", ".", "sparkSession", ".", "createDataFrame", "(", "data", ",", "schema", ",", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SQLContext.createExternalTable
Creates an external table based on the dataset in a data source. It returns the DataFrame associated with the external table. The data source is specified by the ``source`` and a set of ``options``. If ``source`` is not specified, the default data source configured by ``spark.sql.sourc...
python/pyspark/sql/context.py
def createExternalTable(self, tableName, path=None, source=None, schema=None, **options): """Creates an external table based on the dataset in a data source. It returns the DataFrame associated with the external table. The data source is specified by the ``source`` and a set of ``options``. ...
def createExternalTable(self, tableName, path=None, source=None, schema=None, **options): """Creates an external table based on the dataset in a data source. It returns the DataFrame associated with the external table. The data source is specified by the ``source`` and a set of ``options``. ...
[ "Creates", "an", "external", "table", "based", "on", "the", "dataset", "in", "a", "data", "source", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/context.py#L329-L344
[ "def", "createExternalTable", "(", "self", ",", "tableName", ",", "path", "=", "None", ",", "source", "=", "None", ",", "schema", "=", "None", ",", "*", "*", "options", ")", ":", "return", "self", ".", "sparkSession", ".", "catalog", ".", "createExternal...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SQLContext.tables
Returns a :class:`DataFrame` containing names of tables in the given database. If ``dbName`` is not specified, the current database will be used. The returned DataFrame has two columns: ``tableName`` and ``isTemporary`` (a column with :class:`BooleanType` indicating if a table is a temporary o...
python/pyspark/sql/context.py
def tables(self, dbName=None): """Returns a :class:`DataFrame` containing names of tables in the given database. If ``dbName`` is not specified, the current database will be used. The returned DataFrame has two columns: ``tableName`` and ``isTemporary`` (a column with :class:`BooleanTy...
def tables(self, dbName=None): """Returns a :class:`DataFrame` containing names of tables in the given database. If ``dbName`` is not specified, the current database will be used. The returned DataFrame has two columns: ``tableName`` and ``isTemporary`` (a column with :class:`BooleanTy...
[ "Returns", "a", ":", "class", ":", "DataFrame", "containing", "names", "of", "tables", "in", "the", "given", "database", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/context.py#L375-L394
[ "def", "tables", "(", "self", ",", "dbName", "=", "None", ")", ":", "if", "dbName", "is", "None", ":", "return", "DataFrame", "(", "self", ".", "_ssql_ctx", ".", "tables", "(", ")", ",", "self", ")", "else", ":", "return", "DataFrame", "(", "self", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SQLContext.tableNames
Returns a list of names of tables in the database ``dbName``. :param dbName: string, name of the database to use. Default to the current database. :return: list of table names, in string >>> sqlContext.registerDataFrameAsTable(df, "table1") >>> "table1" in sqlContext.tableNames() ...
python/pyspark/sql/context.py
def tableNames(self, dbName=None): """Returns a list of names of tables in the database ``dbName``. :param dbName: string, name of the database to use. Default to the current database. :return: list of table names, in string >>> sqlContext.registerDataFrameAsTable(df, "table1") ...
def tableNames(self, dbName=None): """Returns a list of names of tables in the database ``dbName``. :param dbName: string, name of the database to use. Default to the current database. :return: list of table names, in string >>> sqlContext.registerDataFrameAsTable(df, "table1") ...
[ "Returns", "a", "list", "of", "names", "of", "tables", "in", "the", "database", "dbName", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/context.py#L397-L412
[ "def", "tableNames", "(", "self", ",", "dbName", "=", "None", ")", ":", "if", "dbName", "is", "None", ":", "return", "[", "name", "for", "name", "in", "self", ".", "_ssql_ctx", ".", "tableNames", "(", ")", "]", "else", ":", "return", "[", "name", "...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SQLContext.streams
Returns a :class:`StreamingQueryManager` that allows managing all the :class:`StreamingQuery` StreamingQueries active on `this` context. .. note:: Evolving.
python/pyspark/sql/context.py
def streams(self): """Returns a :class:`StreamingQueryManager` that allows managing all the :class:`StreamingQuery` StreamingQueries active on `this` context. .. note:: Evolving. """ from pyspark.sql.streaming import StreamingQueryManager return StreamingQueryManager(sel...
def streams(self): """Returns a :class:`StreamingQueryManager` that allows managing all the :class:`StreamingQuery` StreamingQueries active on `this` context. .. note:: Evolving. """ from pyspark.sql.streaming import StreamingQueryManager return StreamingQueryManager(sel...
[ "Returns", "a", ":", "class", ":", "StreamingQueryManager", "that", "allows", "managing", "all", "the", ":", "class", ":", "StreamingQuery", "StreamingQueries", "active", "on", "this", "context", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/context.py#L459-L466
[ "def", "streams", "(", "self", ")", ":", "from", "pyspark", ".", "sql", ".", "streaming", "import", "StreamingQueryManager", "return", "StreamingQueryManager", "(", "self", ".", "_ssql_ctx", ".", "streams", "(", ")", ")" ]
618d6bff71073c8c93501ab7392c3cc579730f0b
train
from_avro
Converts a binary column of avro format into its corresponding catalyst value. The specified schema must match the read data, otherwise the behavior is undefined: it may fail or return arbitrary result. Note: Avro is built-in but external data source module since Spark 2.4. Please deploy the applicatio...
python/pyspark/sql/avro/functions.py
def from_avro(data, jsonFormatSchema, options={}): """ Converts a binary column of avro format into its corresponding catalyst value. The specified schema must match the read data, otherwise the behavior is undefined: it may fail or return arbitrary result. Note: Avro is built-in but external data ...
def from_avro(data, jsonFormatSchema, options={}): """ Converts a binary column of avro format into its corresponding catalyst value. The specified schema must match the read data, otherwise the behavior is undefined: it may fail or return arbitrary result. Note: Avro is built-in but external data ...
[ "Converts", "a", "binary", "column", "of", "avro", "format", "into", "its", "corresponding", "catalyst", "value", ".", "The", "specified", "schema", "must", "match", "the", "read", "data", "otherwise", "the", "behavior", "is", "undefined", ":", "it", "may", ...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/avro/functions.py#L31-L67
[ "def", "from_avro", "(", "data", ",", "jsonFormatSchema", ",", "options", "=", "{", "}", ")", ":", "sc", "=", "SparkContext", ".", "_active_spark_context", "try", ":", "jc", "=", "sc", ".", "_jvm", ".", "org", ".", "apache", ".", "spark", ".", "sql", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkFiles.get
Get the absolute path of a file added through C{SparkContext.addFile()}.
python/pyspark/files.py
def get(cls, filename): """ Get the absolute path of a file added through C{SparkContext.addFile()}. """ path = os.path.join(SparkFiles.getRootDirectory(), filename) return os.path.abspath(path)
def get(cls, filename): """ Get the absolute path of a file added through C{SparkContext.addFile()}. """ path = os.path.join(SparkFiles.getRootDirectory(), filename) return os.path.abspath(path)
[ "Get", "the", "absolute", "path", "of", "a", "file", "added", "through", "C", "{", "SparkContext", ".", "addFile", "()", "}", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/files.py#L42-L47
[ "def", "get", "(", "cls", ",", "filename", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "SparkFiles", ".", "getRootDirectory", "(", ")", ",", "filename", ")", "return", "os", ".", "path", ".", "abspath", "(", "path", ")" ]
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkFiles.getRootDirectory
Get the root directory that contains files added through C{SparkContext.addFile()}.
python/pyspark/files.py
def getRootDirectory(cls): """ Get the root directory that contains files added through C{SparkContext.addFile()}. """ if cls._is_running_on_worker: return cls._root_directory else: # This will have to change if we support multiple SparkContexts: ...
def getRootDirectory(cls): """ Get the root directory that contains files added through C{SparkContext.addFile()}. """ if cls._is_running_on_worker: return cls._root_directory else: # This will have to change if we support multiple SparkContexts: ...
[ "Get", "the", "root", "directory", "that", "contains", "files", "added", "through", "C", "{", "SparkContext", ".", "addFile", "()", "}", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/files.py#L50-L59
[ "def", "getRootDirectory", "(", "cls", ")", ":", "if", "cls", ".", "_is_running_on_worker", ":", "return", "cls", ".", "_root_directory", "else", ":", "# This will have to change if we support multiple SparkContexts:", "return", "cls", ".", "_sc", ".", "_jvm", ".", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
LogisticRegressionModel.summary
Gets summary (e.g. accuracy/precision/recall, objective history, total iterations) of model trained on the training set. An exception is thrown if `trainingSummary is None`.
python/pyspark/ml/classification.py
def summary(self): """ Gets summary (e.g. accuracy/precision/recall, objective history, total iterations) of model trained on the training set. An exception is thrown if `trainingSummary is None`. """ if self.hasSummary: if self.numClasses <= 2: return...
def summary(self): """ Gets summary (e.g. accuracy/precision/recall, objective history, total iterations) of model trained on the training set. An exception is thrown if `trainingSummary is None`. """ if self.hasSummary: if self.numClasses <= 2: return...
[ "Gets", "summary", "(", "e", ".", "g", ".", "accuracy", "/", "precision", "/", "recall", "objective", "history", "total", "iterations", ")", "of", "model", "trained", "on", "the", "training", "set", ".", "An", "exception", "is", "thrown", "if", "trainingSu...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/ml/classification.py#L531-L545
[ "def", "summary", "(", "self", ")", ":", "if", "self", ".", "hasSummary", ":", "if", "self", ".", "numClasses", "<=", "2", ":", "return", "BinaryLogisticRegressionTrainingSummary", "(", "super", "(", "LogisticRegressionModel", ",", "self", ")", ".", "summary",...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
LogisticRegressionModel.evaluate
Evaluates the model on a test dataset. :param dataset: Test dataset to evaluate model on, where dataset is an instance of :py:class:`pyspark.sql.DataFrame`
python/pyspark/ml/classification.py
def evaluate(self, dataset): """ Evaluates the model on a test dataset. :param dataset: Test dataset to evaluate model on, where dataset is an instance of :py:class:`pyspark.sql.DataFrame` """ if not isinstance(dataset, DataFrame): raise ValueErro...
def evaluate(self, dataset): """ Evaluates the model on a test dataset. :param dataset: Test dataset to evaluate model on, where dataset is an instance of :py:class:`pyspark.sql.DataFrame` """ if not isinstance(dataset, DataFrame): raise ValueErro...
[ "Evaluates", "the", "model", "on", "a", "test", "dataset", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/ml/classification.py#L548-L559
[ "def", "evaluate", "(", "self", ",", "dataset", ")", ":", "if", "not", "isinstance", "(", "dataset", ",", "DataFrame", ")", ":", "raise", "ValueError", "(", "\"dataset must be a DataFrame but got %s.\"", "%", "type", "(", "dataset", ")", ")", "java_blr_summary",...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
OneVsRestModel.copy
Creates a copy of this instance with a randomly generated uid and some extra params. This creates a deep copy of the embedded paramMap, and copies the embedded and extra parameters over. :param extra: Extra parameters to copy to the new instance :return: Copy of this instance
python/pyspark/ml/classification.py
def copy(self, extra=None): """ Creates a copy of this instance with a randomly generated uid and some extra params. This creates a deep copy of the embedded paramMap, and copies the embedded and extra parameters over. :param extra: Extra parameters to copy to the new instance ...
def copy(self, extra=None): """ Creates a copy of this instance with a randomly generated uid and some extra params. This creates a deep copy of the embedded paramMap, and copies the embedded and extra parameters over. :param extra: Extra parameters to copy to the new instance ...
[ "Creates", "a", "copy", "of", "this", "instance", "with", "a", "randomly", "generated", "uid", "and", "some", "extra", "params", ".", "This", "creates", "a", "deep", "copy", "of", "the", "embedded", "paramMap", "and", "copies", "the", "embedded", "and", "e...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/ml/classification.py#L2046-L2059
[ "def", "copy", "(", "self", ",", "extra", "=", "None", ")", ":", "if", "extra", "is", "None", ":", "extra", "=", "dict", "(", ")", "newModel", "=", "Params", ".", "copy", "(", "self", ",", "extra", ")", "newModel", ".", "models", "=", "[", "model...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
OneVsRestModel._from_java
Given a Java OneVsRestModel, create and return a Python wrapper of it. Used for ML persistence.
python/pyspark/ml/classification.py
def _from_java(cls, java_stage): """ Given a Java OneVsRestModel, create and return a Python wrapper of it. Used for ML persistence. """ featuresCol = java_stage.getFeaturesCol() labelCol = java_stage.getLabelCol() predictionCol = java_stage.getPredictionCol() ...
def _from_java(cls, java_stage): """ Given a Java OneVsRestModel, create and return a Python wrapper of it. Used for ML persistence. """ featuresCol = java_stage.getFeaturesCol() labelCol = java_stage.getLabelCol() predictionCol = java_stage.getPredictionCol() ...
[ "Given", "a", "Java", "OneVsRestModel", "create", "and", "return", "a", "Python", "wrapper", "of", "it", ".", "Used", "for", "ML", "persistence", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/ml/classification.py#L2062-L2075
[ "def", "_from_java", "(", "cls", ",", "java_stage", ")", ":", "featuresCol", "=", "java_stage", ".", "getFeaturesCol", "(", ")", "labelCol", "=", "java_stage", ".", "getLabelCol", "(", ")", "predictionCol", "=", "java_stage", ".", "getPredictionCol", "(", ")",...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
OneVsRestModel._to_java
Transfer this instance to a Java OneVsRestModel. Used for ML persistence. :return: Java object equivalent to this instance.
python/pyspark/ml/classification.py
def _to_java(self): """ Transfer this instance to a Java OneVsRestModel. Used for ML persistence. :return: Java object equivalent to this instance. """ sc = SparkContext._active_spark_context java_models = [model._to_java() for model in self.models] java_models_a...
def _to_java(self): """ Transfer this instance to a Java OneVsRestModel. Used for ML persistence. :return: Java object equivalent to this instance. """ sc = SparkContext._active_spark_context java_models = [model._to_java() for model in self.models] java_models_a...
[ "Transfer", "this", "instance", "to", "a", "Java", "OneVsRestModel", ".", "Used", "for", "ML", "persistence", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/ml/classification.py#L2077-L2094
[ "def", "_to_java", "(", "self", ")", ":", "sc", "=", "SparkContext", ".", "_active_spark_context", "java_models", "=", "[", "model", ".", "_to_java", "(", ")", "for", "model", "in", "self", ".", "models", "]", "java_models_array", "=", "JavaWrapper", ".", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
_exception_message
Return the message from an exception as either a str or unicode object. Supports both Python 2 and Python 3. >>> msg = "Exception message" >>> excp = Exception(msg) >>> msg == _exception_message(excp) True >>> msg = u"unicöde" >>> excp = Exception(msg) >>> msg == _exception_message(ex...
python/pyspark/util.py
def _exception_message(excp): """Return the message from an exception as either a str or unicode object. Supports both Python 2 and Python 3. >>> msg = "Exception message" >>> excp = Exception(msg) >>> msg == _exception_message(excp) True >>> msg = u"unicöde" >>> excp = Exception(msg)...
def _exception_message(excp): """Return the message from an exception as either a str or unicode object. Supports both Python 2 and Python 3. >>> msg = "Exception message" >>> excp = Exception(msg) >>> msg == _exception_message(excp) True >>> msg = u"unicöde" >>> excp = Exception(msg)...
[ "Return", "the", "message", "from", "an", "exception", "as", "either", "a", "str", "or", "unicode", "object", ".", "Supports", "both", "Python", "2", "and", "Python", "3", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/util.py#L27-L49
[ "def", "_exception_message", "(", "excp", ")", ":", "if", "isinstance", "(", "excp", ",", "Py4JJavaError", ")", ":", "# 'Py4JJavaError' doesn't contain the stack trace available on the Java side in 'message'", "# attribute in Python 2. We should call 'str' function on this exception in...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
_get_argspec
Get argspec of a function. Supports both Python 2 and Python 3.
python/pyspark/util.py
def _get_argspec(f): """ Get argspec of a function. Supports both Python 2 and Python 3. """ if sys.version_info[0] < 3: argspec = inspect.getargspec(f) else: # `getargspec` is deprecated since python3.0 (incompatible with function annotations). # See SPARK-23569. arg...
def _get_argspec(f): """ Get argspec of a function. Supports both Python 2 and Python 3. """ if sys.version_info[0] < 3: argspec = inspect.getargspec(f) else: # `getargspec` is deprecated since python3.0 (incompatible with function annotations). # See SPARK-23569. arg...
[ "Get", "argspec", "of", "a", "function", ".", "Supports", "both", "Python", "2", "and", "Python", "3", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/util.py#L52-L62
[ "def", "_get_argspec", "(", "f", ")", ":", "if", "sys", ".", "version_info", "[", "0", "]", "<", "3", ":", "argspec", "=", "inspect", ".", "getargspec", "(", "f", ")", "else", ":", "# `getargspec` is deprecated since python3.0 (incompatible with function annotatio...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
fail_on_stopiteration
Wraps the input function to fail on 'StopIteration' by raising a 'RuntimeError' prevents silent loss of data when 'f' is used in a for loop in Spark code
python/pyspark/util.py
def fail_on_stopiteration(f): """ Wraps the input function to fail on 'StopIteration' by raising a 'RuntimeError' prevents silent loss of data when 'f' is used in a for loop in Spark code """ def wrapper(*args, **kwargs): try: return f(*args, **kwargs) except StopIteratio...
def fail_on_stopiteration(f): """ Wraps the input function to fail on 'StopIteration' by raising a 'RuntimeError' prevents silent loss of data when 'f' is used in a for loop in Spark code """ def wrapper(*args, **kwargs): try: return f(*args, **kwargs) except StopIteratio...
[ "Wraps", "the", "input", "function", "to", "fail", "on", "StopIteration", "by", "raising", "a", "RuntimeError", "prevents", "silent", "loss", "of", "data", "when", "f", "is", "used", "in", "a", "for", "loop", "in", "Spark", "code" ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/util.py#L92-L106
[ "def", "fail_on_stopiteration", "(", "f", ")", ":", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "f", "(", "*", "args", ",", "*", "*", "kwargs", ")", "except", "StopIteration", "as", "exc", ":", "rais...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
VersionUtils.majorMinorVersion
Given a Spark version string, return the (major version number, minor version number). E.g., for 2.0.1-SNAPSHOT, return (2, 0). >>> sparkVersion = "2.4.0" >>> VersionUtils.majorMinorVersion(sparkVersion) (2, 4) >>> sparkVersion = "2.3.0-SNAPSHOT" >>> VersionUtils.majorMi...
python/pyspark/util.py
def majorMinorVersion(sparkVersion): """ Given a Spark version string, return the (major version number, minor version number). E.g., for 2.0.1-SNAPSHOT, return (2, 0). >>> sparkVersion = "2.4.0" >>> VersionUtils.majorMinorVersion(sparkVersion) (2, 4) >>> sparkVe...
def majorMinorVersion(sparkVersion): """ Given a Spark version string, return the (major version number, minor version number). E.g., for 2.0.1-SNAPSHOT, return (2, 0). >>> sparkVersion = "2.4.0" >>> VersionUtils.majorMinorVersion(sparkVersion) (2, 4) >>> sparkVe...
[ "Given", "a", "Spark", "version", "string", "return", "the", "(", "major", "version", "number", "minor", "version", "number", ")", ".", "E", ".", "g", ".", "for", "2", ".", "0", ".", "1", "-", "SNAPSHOT", "return", "(", "2", "0", ")", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/util.py#L70-L89
[ "def", "majorMinorVersion", "(", "sparkVersion", ")", ":", "m", "=", "re", ".", "search", "(", "r'^(\\d+)\\.(\\d+)(\\..*)?$'", ",", "sparkVersion", ")", "if", "m", "is", "not", "None", ":", "return", "(", "int", "(", "m", ".", "group", "(", "1", ")", "...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkContext._ensure_initialized
Checks whether a SparkContext is initialized or not. Throws error if a SparkContext is already running.
python/pyspark/context.py
def _ensure_initialized(cls, instance=None, gateway=None, conf=None): """ Checks whether a SparkContext is initialized or not. Throws error if a SparkContext is already running. """ with SparkContext._lock: if not SparkContext._gateway: SparkContext._g...
def _ensure_initialized(cls, instance=None, gateway=None, conf=None): """ Checks whether a SparkContext is initialized or not. Throws error if a SparkContext is already running. """ with SparkContext._lock: if not SparkContext._gateway: SparkContext._g...
[ "Checks", "whether", "a", "SparkContext", "is", "initialized", "or", "not", ".", "Throws", "error", "if", "a", "SparkContext", "is", "already", "running", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/context.py#L303-L328
[ "def", "_ensure_initialized", "(", "cls", ",", "instance", "=", "None", ",", "gateway", "=", "None", ",", "conf", "=", "None", ")", ":", "with", "SparkContext", ".", "_lock", ":", "if", "not", "SparkContext", ".", "_gateway", ":", "SparkContext", ".", "_...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkContext.getOrCreate
Get or instantiate a SparkContext and register it as a singleton object. :param conf: SparkConf (optional)
python/pyspark/context.py
def getOrCreate(cls, conf=None): """ Get or instantiate a SparkContext and register it as a singleton object. :param conf: SparkConf (optional) """ with SparkContext._lock: if SparkContext._active_spark_context is None: SparkContext(conf=conf or Spark...
def getOrCreate(cls, conf=None): """ Get or instantiate a SparkContext and register it as a singleton object. :param conf: SparkConf (optional) """ with SparkContext._lock: if SparkContext._active_spark_context is None: SparkContext(conf=conf or Spark...
[ "Get", "or", "instantiate", "a", "SparkContext", "and", "register", "it", "as", "a", "singleton", "object", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/context.py#L353-L362
[ "def", "getOrCreate", "(", "cls", ",", "conf", "=", "None", ")", ":", "with", "SparkContext", ".", "_lock", ":", "if", "SparkContext", ".", "_active_spark_context", "is", "None", ":", "SparkContext", "(", "conf", "=", "conf", "or", "SparkConf", "(", ")", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkContext.setSystemProperty
Set a Java system property, such as spark.executor.memory. This must must be invoked before instantiating SparkContext.
python/pyspark/context.py
def setSystemProperty(cls, key, value): """ Set a Java system property, such as spark.executor.memory. This must must be invoked before instantiating SparkContext. """ SparkContext._ensure_initialized() SparkContext._jvm.java.lang.System.setProperty(key, value)
def setSystemProperty(cls, key, value): """ Set a Java system property, such as spark.executor.memory. This must must be invoked before instantiating SparkContext. """ SparkContext._ensure_initialized() SparkContext._jvm.java.lang.System.setProperty(key, value)
[ "Set", "a", "Java", "system", "property", "such", "as", "spark", ".", "executor", ".", "memory", ".", "This", "must", "must", "be", "invoked", "before", "instantiating", "SparkContext", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/context.py#L372-L378
[ "def", "setSystemProperty", "(", "cls", ",", "key", ",", "value", ")", ":", "SparkContext", ".", "_ensure_initialized", "(", ")", "SparkContext", ".", "_jvm", ".", "java", ".", "lang", ".", "System", ".", "setProperty", "(", "key", ",", "value", ")" ]
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkContext.stop
Shut down the SparkContext.
python/pyspark/context.py
def stop(self): """ Shut down the SparkContext. """ if getattr(self, "_jsc", None): try: self._jsc.stop() except Py4JError: # Case: SPARK-18523 warnings.warn( 'Unable to cleanly shutdown Spark JVM...
def stop(self): """ Shut down the SparkContext. """ if getattr(self, "_jsc", None): try: self._jsc.stop() except Py4JError: # Case: SPARK-18523 warnings.warn( 'Unable to cleanly shutdown Spark JVM...
[ "Shut", "down", "the", "SparkContext", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/context.py#L427-L448
[ "def", "stop", "(", "self", ")", ":", "if", "getattr", "(", "self", ",", "\"_jsc\"", ",", "None", ")", ":", "try", ":", "self", ".", "_jsc", ".", "stop", "(", ")", "except", "Py4JError", ":", "# Case: SPARK-18523", "warnings", ".", "warn", "(", "'Una...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkContext.range
Create a new RDD of int containing elements from `start` to `end` (exclusive), increased by `step` every element. Can be called the same way as python's built-in range() function. If called with a single argument, the argument is interpreted as `end`, and `start` is set to 0. :param sta...
python/pyspark/context.py
def range(self, start, end=None, step=1, numSlices=None): """ Create a new RDD of int containing elements from `start` to `end` (exclusive), increased by `step` every element. Can be called the same way as python's built-in range() function. If called with a single argument, the ...
def range(self, start, end=None, step=1, numSlices=None): """ Create a new RDD of int containing elements from `start` to `end` (exclusive), increased by `step` every element. Can be called the same way as python's built-in range() function. If called with a single argument, the ...
[ "Create", "a", "new", "RDD", "of", "int", "containing", "elements", "from", "start", "to", "end", "(", "exclusive", ")", "increased", "by", "step", "every", "element", ".", "Can", "be", "called", "the", "same", "way", "as", "python", "s", "built", "-", ...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/context.py#L456-L480
[ "def", "range", "(", "self", ",", "start", ",", "end", "=", "None", ",", "step", "=", "1", ",", "numSlices", "=", "None", ")", ":", "if", "end", "is", "None", ":", "end", "=", "start", "start", "=", "0", "return", "self", ".", "parallelize", "(",...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkContext.parallelize
Distribute a local Python collection to form an RDD. Using xrange is recommended if the input represents a range for performance. >>> sc.parallelize([0, 2, 3, 4, 6], 5).glom().collect() [[0], [2], [3], [4], [6]] >>> sc.parallelize(xrange(0, 6, 2), 5).glom().collect() [[], [0], [...
python/pyspark/context.py
def parallelize(self, c, numSlices=None): """ Distribute a local Python collection to form an RDD. Using xrange is recommended if the input represents a range for performance. >>> sc.parallelize([0, 2, 3, 4, 6], 5).glom().collect() [[0], [2], [3], [4], [6]] >>> sc.parall...
def parallelize(self, c, numSlices=None): """ Distribute a local Python collection to form an RDD. Using xrange is recommended if the input represents a range for performance. >>> sc.parallelize([0, 2, 3, 4, 6], 5).glom().collect() [[0], [2], [3], [4], [6]] >>> sc.parall...
[ "Distribute", "a", "local", "Python", "collection", "to", "form", "an", "RDD", ".", "Using", "xrange", "is", "recommended", "if", "the", "input", "represents", "a", "range", "for", "performance", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/context.py#L482-L529
[ "def", "parallelize", "(", "self", ",", "c", ",", "numSlices", "=", "None", ")", ":", "numSlices", "=", "int", "(", "numSlices", ")", "if", "numSlices", "is", "not", "None", "else", "self", ".", "defaultParallelism", "if", "isinstance", "(", "c", ",", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkContext._serialize_to_jvm
Using py4j to send a large dataset to the jvm is really slow, so we use either a file or a socket if we have encryption enabled. :param data: :param serializer: :param reader_func: A function which takes a filename and reads in the data in the jvm and returns a JavaRDD. ...
python/pyspark/context.py
def _serialize_to_jvm(self, data, serializer, reader_func, createRDDServer): """ Using py4j to send a large dataset to the jvm is really slow, so we use either a file or a socket if we have encryption enabled. :param data: :param serializer: :param reader_func: A functio...
def _serialize_to_jvm(self, data, serializer, reader_func, createRDDServer): """ Using py4j to send a large dataset to the jvm is really slow, so we use either a file or a socket if we have encryption enabled. :param data: :param serializer: :param reader_func: A functio...
[ "Using", "py4j", "to", "send", "a", "large", "dataset", "to", "the", "jvm", "is", "really", "slow", "so", "we", "use", "either", "a", "file", "or", "a", "socket", "if", "we", "have", "encryption", "enabled", ".", ":", "param", "data", ":", ":", "para...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/context.py#L531-L566
[ "def", "_serialize_to_jvm", "(", "self", ",", "data", ",", "serializer", ",", "reader_func", ",", "createRDDServer", ")", ":", "if", "self", ".", "_encryption_enabled", ":", "# with encryption, we open a server in java and send the data directly", "server", "=", "createRD...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkContext.pickleFile
Load an RDD previously saved using L{RDD.saveAsPickleFile} method. >>> tmpFile = NamedTemporaryFile(delete=True) >>> tmpFile.close() >>> sc.parallelize(range(10)).saveAsPickleFile(tmpFile.name, 5) >>> sorted(sc.pickleFile(tmpFile.name, 3).collect()) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9...
python/pyspark/context.py
def pickleFile(self, name, minPartitions=None): """ Load an RDD previously saved using L{RDD.saveAsPickleFile} method. >>> tmpFile = NamedTemporaryFile(delete=True) >>> tmpFile.close() >>> sc.parallelize(range(10)).saveAsPickleFile(tmpFile.name, 5) >>> sorted(sc.pickleFi...
def pickleFile(self, name, minPartitions=None): """ Load an RDD previously saved using L{RDD.saveAsPickleFile} method. >>> tmpFile = NamedTemporaryFile(delete=True) >>> tmpFile.close() >>> sc.parallelize(range(10)).saveAsPickleFile(tmpFile.name, 5) >>> sorted(sc.pickleFi...
[ "Load", "an", "RDD", "previously", "saved", "using", "L", "{", "RDD", ".", "saveAsPickleFile", "}", "method", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/context.py#L568-L579
[ "def", "pickleFile", "(", "self", ",", "name", ",", "minPartitions", "=", "None", ")", ":", "minPartitions", "=", "minPartitions", "or", "self", ".", "defaultMinPartitions", "return", "RDD", "(", "self", ".", "_jsc", ".", "objectFile", "(", "name", ",", "m...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkContext.textFile
Read a text file from HDFS, a local file system (available on all nodes), or any Hadoop-supported file system URI, and return it as an RDD of Strings. The text files must be encoded as UTF-8. If use_unicode is False, the strings will be kept as `str` (encoding as `utf-8`), which...
python/pyspark/context.py
def textFile(self, name, minPartitions=None, use_unicode=True): """ Read a text file from HDFS, a local file system (available on all nodes), or any Hadoop-supported file system URI, and return it as an RDD of Strings. The text files must be encoded as UTF-8. If use_unic...
def textFile(self, name, minPartitions=None, use_unicode=True): """ Read a text file from HDFS, a local file system (available on all nodes), or any Hadoop-supported file system URI, and return it as an RDD of Strings. The text files must be encoded as UTF-8. If use_unic...
[ "Read", "a", "text", "file", "from", "HDFS", "a", "local", "file", "system", "(", "available", "on", "all", "nodes", ")", "or", "any", "Hadoop", "-", "supported", "file", "system", "URI", "and", "return", "it", "as", "an", "RDD", "of", "Strings", ".", ...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/context.py#L582-L602
[ "def", "textFile", "(", "self", ",", "name", ",", "minPartitions", "=", "None", ",", "use_unicode", "=", "True", ")", ":", "minPartitions", "=", "minPartitions", "or", "min", "(", "self", ".", "defaultParallelism", ",", "2", ")", "return", "RDD", "(", "s...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkContext.wholeTextFiles
Read a directory of text files from HDFS, a local file system (available on all nodes), or any Hadoop-supported file system URI. Each file is read as a single record and returned in a key-value pair, where the key is the path of each file, the value is the content of each file. ...
python/pyspark/context.py
def wholeTextFiles(self, path, minPartitions=None, use_unicode=True): """ Read a directory of text files from HDFS, a local file system (available on all nodes), or any Hadoop-supported file system URI. Each file is read as a single record and returned in a key-value pair, where...
def wholeTextFiles(self, path, minPartitions=None, use_unicode=True): """ Read a directory of text files from HDFS, a local file system (available on all nodes), or any Hadoop-supported file system URI. Each file is read as a single record and returned in a key-value pair, where...
[ "Read", "a", "directory", "of", "text", "files", "from", "HDFS", "a", "local", "file", "system", "(", "available", "on", "all", "nodes", ")", "or", "any", "Hadoop", "-", "supported", "file", "system", "URI", ".", "Each", "file", "is", "read", "as", "a"...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/context.py#L605-L648
[ "def", "wholeTextFiles", "(", "self", ",", "path", ",", "minPartitions", "=", "None", ",", "use_unicode", "=", "True", ")", ":", "minPartitions", "=", "minPartitions", "or", "self", ".", "defaultMinPartitions", "return", "RDD", "(", "self", ".", "_jsc", ".",...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkContext.binaryFiles
.. note:: Experimental Read a directory of binary files from HDFS, a local file system (available on all nodes), or any Hadoop-supported file system URI as a byte array. Each file is read as a single record and returned in a key-value pair, where the key is the path of each file, the ...
python/pyspark/context.py
def binaryFiles(self, path, minPartitions=None): """ .. note:: Experimental Read a directory of binary files from HDFS, a local file system (available on all nodes), or any Hadoop-supported file system URI as a byte array. Each file is read as a single record and returned ...
def binaryFiles(self, path, minPartitions=None): """ .. note:: Experimental Read a directory of binary files from HDFS, a local file system (available on all nodes), or any Hadoop-supported file system URI as a byte array. Each file is read as a single record and returned ...
[ "..", "note", "::", "Experimental" ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/context.py#L650-L665
[ "def", "binaryFiles", "(", "self", ",", "path", ",", "minPartitions", "=", "None", ")", ":", "minPartitions", "=", "minPartitions", "or", "self", ".", "defaultMinPartitions", "return", "RDD", "(", "self", ".", "_jsc", ".", "binaryFiles", "(", "path", ",", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkContext.binaryRecords
.. note:: Experimental Load data from a flat binary file, assuming each record is a set of numbers with the specified numerical format (see ByteBuffer), and the number of bytes per record is constant. :param path: Directory to the input data files :param recordLength: The lengt...
python/pyspark/context.py
def binaryRecords(self, path, recordLength): """ .. note:: Experimental Load data from a flat binary file, assuming each record is a set of numbers with the specified numerical format (see ByteBuffer), and the number of bytes per record is constant. :param path: Directo...
def binaryRecords(self, path, recordLength): """ .. note:: Experimental Load data from a flat binary file, assuming each record is a set of numbers with the specified numerical format (see ByteBuffer), and the number of bytes per record is constant. :param path: Directo...
[ "..", "note", "::", "Experimental" ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/context.py#L667-L678
[ "def", "binaryRecords", "(", "self", ",", "path", ",", "recordLength", ")", ":", "return", "RDD", "(", "self", ".", "_jsc", ".", "binaryRecords", "(", "path", ",", "recordLength", ")", ",", "self", ",", "NoOpSerializer", "(", ")", ")" ]
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkContext.sequenceFile
Read a Hadoop SequenceFile with arbitrary key and value Writable class from HDFS, a local file system (available on all nodes), or any Hadoop-supported file system URI. The mechanism is as follows: 1. A Java RDD is created from the SequenceFile or other InputFormat, and the key ...
python/pyspark/context.py
def sequenceFile(self, path, keyClass=None, valueClass=None, keyConverter=None, valueConverter=None, minSplits=None, batchSize=0): """ Read a Hadoop SequenceFile with arbitrary key and value Writable class from HDFS, a local file system (available on all nodes), or any Hadoo...
def sequenceFile(self, path, keyClass=None, valueClass=None, keyConverter=None, valueConverter=None, minSplits=None, batchSize=0): """ Read a Hadoop SequenceFile with arbitrary key and value Writable class from HDFS, a local file system (available on all nodes), or any Hadoo...
[ "Read", "a", "Hadoop", "SequenceFile", "with", "arbitrary", "key", "and", "value", "Writable", "class", "from", "HDFS", "a", "local", "file", "system", "(", "available", "on", "all", "nodes", ")", "or", "any", "Hadoop", "-", "supported", "file", "system", ...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/context.py#L688-L716
[ "def", "sequenceFile", "(", "self", ",", "path", ",", "keyClass", "=", "None", ",", "valueClass", "=", "None", ",", "keyConverter", "=", "None", ",", "valueConverter", "=", "None", ",", "minSplits", "=", "None", ",", "batchSize", "=", "0", ")", ":", "m...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkContext.newAPIHadoopFile
Read a 'new API' Hadoop InputFormat with arbitrary key and value class from HDFS, a local file system (available on all nodes), or any Hadoop-supported file system URI. The mechanism is the same as for sc.sequenceFile. A Hadoop configuration can be passed in as a Python dict. This will be conve...
python/pyspark/context.py
def newAPIHadoopFile(self, path, inputFormatClass, keyClass, valueClass, keyConverter=None, valueConverter=None, conf=None, batchSize=0): """ Read a 'new API' Hadoop InputFormat with arbitrary key and value class from HDFS, a local file system (available on all nodes), o...
def newAPIHadoopFile(self, path, inputFormatClass, keyClass, valueClass, keyConverter=None, valueConverter=None, conf=None, batchSize=0): """ Read a 'new API' Hadoop InputFormat with arbitrary key and value class from HDFS, a local file system (available on all nodes), o...
[ "Read", "a", "new", "API", "Hadoop", "InputFormat", "with", "arbitrary", "key", "and", "value", "class", "from", "HDFS", "a", "local", "file", "system", "(", "available", "on", "all", "nodes", ")", "or", "any", "Hadoop", "-", "supported", "file", "system",...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/context.py#L718-L746
[ "def", "newAPIHadoopFile", "(", "self", ",", "path", ",", "inputFormatClass", ",", "keyClass", ",", "valueClass", ",", "keyConverter", "=", "None", ",", "valueConverter", "=", "None", ",", "conf", "=", "None", ",", "batchSize", "=", "0", ")", ":", "jconf",...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkContext.union
Build the union of a list of RDDs. This supports unions() of RDDs with different serialized formats, although this forces them to be reserialized using the default serializer: >>> path = os.path.join(tempdir, "union-text.txt") >>> with open(path, "w") as testFile: ... ...
python/pyspark/context.py
def union(self, rdds): """ Build the union of a list of RDDs. This supports unions() of RDDs with different serialized formats, although this forces them to be reserialized using the default serializer: >>> path = os.path.join(tempdir, "union-text.txt") >>> with...
def union(self, rdds): """ Build the union of a list of RDDs. This supports unions() of RDDs with different serialized formats, although this forces them to be reserialized using the default serializer: >>> path = os.path.join(tempdir, "union-text.txt") >>> with...
[ "Build", "the", "union", "of", "a", "list", "of", "RDDs", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/context.py#L837-L862
[ "def", "union", "(", "self", ",", "rdds", ")", ":", "first_jrdd_deserializer", "=", "rdds", "[", "0", "]", ".", "_jrdd_deserializer", "if", "any", "(", "x", ".", "_jrdd_deserializer", "!=", "first_jrdd_deserializer", "for", "x", "in", "rdds", ")", ":", "rd...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkContext.accumulator
Create an L{Accumulator} with the given initial value, using a given L{AccumulatorParam} helper object to define how to add values of the data type if provided. Default AccumulatorParams are used for integers and floating-point numbers if you do not provide one. For other types, a custom...
python/pyspark/context.py
def accumulator(self, value, accum_param=None): """ Create an L{Accumulator} with the given initial value, using a given L{AccumulatorParam} helper object to define how to add values of the data type if provided. Default AccumulatorParams are used for integers and floating-point ...
def accumulator(self, value, accum_param=None): """ Create an L{Accumulator} with the given initial value, using a given L{AccumulatorParam} helper object to define how to add values of the data type if provided. Default AccumulatorParams are used for integers and floating-point ...
[ "Create", "an", "L", "{", "Accumulator", "}", "with", "the", "given", "initial", "value", "using", "a", "given", "L", "{", "AccumulatorParam", "}", "helper", "object", "to", "define", "how", "to", "add", "values", "of", "the", "data", "type", "if", "prov...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/context.py#L873-L891
[ "def", "accumulator", "(", "self", ",", "value", ",", "accum_param", "=", "None", ")", ":", "if", "accum_param", "is", "None", ":", "if", "isinstance", "(", "value", ",", "int", ")", ":", "accum_param", "=", "accumulators", ".", "INT_ACCUMULATOR_PARAM", "e...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkContext.addFile
Add a file to be downloaded with this Spark job on every node. The C{path} passed can be either a local file, a file in HDFS (or other Hadoop-supported filesystems), or an HTTP, HTTPS or FTP URI. To access the file in Spark jobs, use L{SparkFiles.get(fileName)<pyspark.files.Spar...
python/pyspark/context.py
def addFile(self, path, recursive=False): """ Add a file to be downloaded with this Spark job on every node. The C{path} passed can be either a local file, a file in HDFS (or other Hadoop-supported filesystems), or an HTTP, HTTPS or FTP URI. To access the file in Spark j...
def addFile(self, path, recursive=False): """ Add a file to be downloaded with this Spark job on every node. The C{path} passed can be either a local file, a file in HDFS (or other Hadoop-supported filesystems), or an HTTP, HTTPS or FTP URI. To access the file in Spark j...
[ "Add", "a", "file", "to", "be", "downloaded", "with", "this", "Spark", "job", "on", "every", "node", ".", "The", "C", "{", "path", "}", "passed", "can", "be", "either", "a", "local", "file", "a", "file", "in", "HDFS", "(", "or", "other", "Hadoop", ...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/context.py#L893-L921
[ "def", "addFile", "(", "self", ",", "path", ",", "recursive", "=", "False", ")", ":", "self", ".", "_jsc", ".", "sc", "(", ")", ".", "addFile", "(", "path", ",", "recursive", ")" ]
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkContext.addPyFile
Add a .py or .zip dependency for all tasks to be executed on this SparkContext in the future. The C{path} passed can be either a local file, a file in HDFS (or other Hadoop-supported filesystems), or an HTTP, HTTPS or FTP URI. .. note:: A path can be added only once. Subsequent additio...
python/pyspark/context.py
def addPyFile(self, path): """ Add a .py or .zip dependency for all tasks to be executed on this SparkContext in the future. The C{path} passed can be either a local file, a file in HDFS (or other Hadoop-supported filesystems), or an HTTP, HTTPS or FTP URI. .. note:: A ...
def addPyFile(self, path): """ Add a .py or .zip dependency for all tasks to be executed on this SparkContext in the future. The C{path} passed can be either a local file, a file in HDFS (or other Hadoop-supported filesystems), or an HTTP, HTTPS or FTP URI. .. note:: A ...
[ "Add", "a", ".", "py", "or", ".", "zip", "dependency", "for", "all", "tasks", "to", "be", "executed", "on", "this", "SparkContext", "in", "the", "future", ".", "The", "C", "{", "path", "}", "passed", "can", "be", "either", "a", "local", "file", "a", ...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/context.py#L923-L940
[ "def", "addPyFile", "(", "self", ",", "path", ")", ":", "self", ".", "addFile", "(", "path", ")", "(", "dirname", ",", "filename", ")", "=", "os", ".", "path", ".", "split", "(", "path", ")", "# dirname may be directory or HDFS/S3 prefix", "if", "filename"...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkContext._getJavaStorageLevel
Returns a Java StorageLevel based on a pyspark.StorageLevel.
python/pyspark/context.py
def _getJavaStorageLevel(self, storageLevel): """ Returns a Java StorageLevel based on a pyspark.StorageLevel. """ if not isinstance(storageLevel, StorageLevel): raise Exception("storageLevel must be of type pyspark.StorageLevel") newStorageLevel = self._jvm.org.apac...
def _getJavaStorageLevel(self, storageLevel): """ Returns a Java StorageLevel based on a pyspark.StorageLevel. """ if not isinstance(storageLevel, StorageLevel): raise Exception("storageLevel must be of type pyspark.StorageLevel") newStorageLevel = self._jvm.org.apac...
[ "Returns", "a", "Java", "StorageLevel", "based", "on", "a", "pyspark", ".", "StorageLevel", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/context.py#L949-L961
[ "def", "_getJavaStorageLevel", "(", "self", ",", "storageLevel", ")", ":", "if", "not", "isinstance", "(", "storageLevel", ",", "StorageLevel", ")", ":", "raise", "Exception", "(", "\"storageLevel must be of type pyspark.StorageLevel\"", ")", "newStorageLevel", "=", "...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkContext.setJobGroup
Assigns a group ID to all the jobs started by this thread until the group ID is set to a different value or cleared. Often, a unit of execution in an application consists of multiple Spark actions or jobs. Application programmers can use this method to group all those jobs together and give a ...
python/pyspark/context.py
def setJobGroup(self, groupId, description, interruptOnCancel=False): """ Assigns a group ID to all the jobs started by this thread until the group ID is set to a different value or cleared. Often, a unit of execution in an application consists of multiple Spark actions or jobs. ...
def setJobGroup(self, groupId, description, interruptOnCancel=False): """ Assigns a group ID to all the jobs started by this thread until the group ID is set to a different value or cleared. Often, a unit of execution in an application consists of multiple Spark actions or jobs. ...
[ "Assigns", "a", "group", "ID", "to", "all", "the", "jobs", "started", "by", "this", "thread", "until", "the", "group", "ID", "is", "set", "to", "a", "different", "value", "or", "cleared", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/context.py#L963-L1005
[ "def", "setJobGroup", "(", "self", ",", "groupId", ",", "description", ",", "interruptOnCancel", "=", "False", ")", ":", "self", ".", "_jsc", ".", "setJobGroup", "(", "groupId", ",", "description", ",", "interruptOnCancel", ")" ]
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkContext.runJob
Executes the given partitionFunc on the specified set of partitions, returning the result as an array of elements. If 'partitions' is not specified, this will run over all partitions. >>> myRDD = sc.parallelize(range(6), 3) >>> sc.runJob(myRDD, lambda part: [x * x for x in part]) ...
python/pyspark/context.py
def runJob(self, rdd, partitionFunc, partitions=None, allowLocal=False): """ Executes the given partitionFunc on the specified set of partitions, returning the result as an array of elements. If 'partitions' is not specified, this will run over all partitions. >>> myRDD = sc.pa...
def runJob(self, rdd, partitionFunc, partitions=None, allowLocal=False): """ Executes the given partitionFunc on the specified set of partitions, returning the result as an array of elements. If 'partitions' is not specified, this will run over all partitions. >>> myRDD = sc.pa...
[ "Executes", "the", "given", "partitionFunc", "on", "the", "specified", "set", "of", "partitions", "returning", "the", "result", "as", "an", "array", "of", "elements", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/context.py#L1052-L1075
[ "def", "runJob", "(", "self", ",", "rdd", ",", "partitionFunc", ",", "partitions", "=", "None", ",", "allowLocal", "=", "False", ")", ":", "if", "partitions", "is", "None", ":", "partitions", "=", "range", "(", "rdd", ".", "_jrdd", ".", "partitions", "...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkContext.dump_profiles
Dump the profile stats into directory `path`
python/pyspark/context.py
def dump_profiles(self, path): """ Dump the profile stats into directory `path` """ if self.profiler_collector is not None: self.profiler_collector.dump_profiles(path) else: raise RuntimeError("'spark.python.profile' configuration must be set " ...
def dump_profiles(self, path): """ Dump the profile stats into directory `path` """ if self.profiler_collector is not None: self.profiler_collector.dump_profiles(path) else: raise RuntimeError("'spark.python.profile' configuration must be set " ...
[ "Dump", "the", "profile", "stats", "into", "directory", "path" ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/context.py#L1085-L1092
[ "def", "dump_profiles", "(", "self", ",", "path", ")", ":", "if", "self", ".", "profiler_collector", "is", "not", "None", ":", "self", ".", "profiler_collector", ".", "dump_profiles", "(", "path", ")", "else", ":", "raise", "RuntimeError", "(", "\"'spark.pyt...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
ALS.train
Train a matrix factorization model given an RDD of ratings by users for a subset of products. The ratings matrix is approximated as the product of two lower-rank matrices of a given rank (number of features). To solve for these features, ALS is run iteratively with a configurable level o...
python/pyspark/mllib/recommendation.py
def train(cls, ratings, rank, iterations=5, lambda_=0.01, blocks=-1, nonnegative=False, seed=None): """ Train a matrix factorization model given an RDD of ratings by users for a subset of products. The ratings matrix is approximated as the product of two lower-rank matrices...
def train(cls, ratings, rank, iterations=5, lambda_=0.01, blocks=-1, nonnegative=False, seed=None): """ Train a matrix factorization model given an RDD of ratings by users for a subset of products. The ratings matrix is approximated as the product of two lower-rank matrices...
[ "Train", "a", "matrix", "factorization", "model", "given", "an", "RDD", "of", "ratings", "by", "users", "for", "a", "subset", "of", "products", ".", "The", "ratings", "matrix", "is", "approximated", "as", "the", "product", "of", "two", "lower", "-", "rank"...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/mllib/recommendation.py#L241-L275
[ "def", "train", "(", "cls", ",", "ratings", ",", "rank", ",", "iterations", "=", "5", ",", "lambda_", "=", "0.01", ",", "blocks", "=", "-", "1", ",", "nonnegative", "=", "False", ",", "seed", "=", "None", ")", ":", "model", "=", "callMLlibFunc", "(...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
FPGrowth.train
Computes an FP-Growth model that contains frequent itemsets. :param data: The input data set, each element contains a transaction. :param minSupport: The minimal support level. (default: 0.3) :param numPartitions: The number of partitions used by parallel...
python/pyspark/mllib/fpm.py
def train(cls, data, minSupport=0.3, numPartitions=-1): """ Computes an FP-Growth model that contains frequent itemsets. :param data: The input data set, each element contains a transaction. :param minSupport: The minimal support level. (default: 0.3) ...
def train(cls, data, minSupport=0.3, numPartitions=-1): """ Computes an FP-Growth model that contains frequent itemsets. :param data: The input data set, each element contains a transaction. :param minSupport: The minimal support level. (default: 0.3) ...
[ "Computes", "an", "FP", "-", "Growth", "model", "that", "contains", "frequent", "itemsets", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/mllib/fpm.py#L78-L93
[ "def", "train", "(", "cls", ",", "data", ",", "minSupport", "=", "0.3", ",", "numPartitions", "=", "-", "1", ")", ":", "model", "=", "callMLlibFunc", "(", "\"trainFPGrowthModel\"", ",", "data", ",", "float", "(", "minSupport", ")", ",", "int", "(", "nu...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
PrefixSpan.train
Finds the complete set of frequent sequential patterns in the input sequences of itemsets. :param data: The input data set, each element contains a sequence of itemsets. :param minSupport: The minimal support level of the sequential pattern, any pattern t...
python/pyspark/mllib/fpm.py
def train(cls, data, minSupport=0.1, maxPatternLength=10, maxLocalProjDBSize=32000000): """ Finds the complete set of frequent sequential patterns in the input sequences of itemsets. :param data: The input data set, each element contains a sequence of itemsets. ...
def train(cls, data, minSupport=0.1, maxPatternLength=10, maxLocalProjDBSize=32000000): """ Finds the complete set of frequent sequential patterns in the input sequences of itemsets. :param data: The input data set, each element contains a sequence of itemsets. ...
[ "Finds", "the", "complete", "set", "of", "frequent", "sequential", "patterns", "in", "the", "input", "sequences", "of", "itemsets", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/mllib/fpm.py#L140-L166
[ "def", "train", "(", "cls", ",", "data", ",", "minSupport", "=", "0.1", ",", "maxPatternLength", "=", "10", ",", "maxLocalProjDBSize", "=", "32000000", ")", ":", "model", "=", "callMLlibFunc", "(", "\"trainPrefixSpanModel\"", ",", "data", ",", "minSupport", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
KernelDensity.setSample
Set sample points from the population. Should be a RDD
python/pyspark/mllib/stat/KernelDensity.py
def setSample(self, sample): """Set sample points from the population. Should be a RDD""" if not isinstance(sample, RDD): raise TypeError("samples should be a RDD, received %s" % type(sample)) self._sample = sample
def setSample(self, sample): """Set sample points from the population. Should be a RDD""" if not isinstance(sample, RDD): raise TypeError("samples should be a RDD, received %s" % type(sample)) self._sample = sample
[ "Set", "sample", "points", "from", "the", "population", ".", "Should", "be", "a", "RDD" ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/mllib/stat/KernelDensity.py#L48-L52
[ "def", "setSample", "(", "self", ",", "sample", ")", ":", "if", "not", "isinstance", "(", "sample", ",", "RDD", ")", ":", "raise", "TypeError", "(", "\"samples should be a RDD, received %s\"", "%", "type", "(", "sample", ")", ")", "self", ".", "_sample", "...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
KernelDensity.estimate
Estimate the probability density at points
python/pyspark/mllib/stat/KernelDensity.py
def estimate(self, points): """Estimate the probability density at points""" points = list(points) densities = callMLlibFunc( "estimateKernelDensity", self._sample, self._bandwidth, points) return np.asarray(densities)
def estimate(self, points): """Estimate the probability density at points""" points = list(points) densities = callMLlibFunc( "estimateKernelDensity", self._sample, self._bandwidth, points) return np.asarray(densities)
[ "Estimate", "the", "probability", "density", "at", "points" ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/mllib/stat/KernelDensity.py#L54-L59
[ "def", "estimate", "(", "self", ",", "points", ")", ":", "points", "=", "list", "(", "points", ")", "densities", "=", "callMLlibFunc", "(", "\"estimateKernelDensity\"", ",", "self", ".", "_sample", ",", "self", ".", "_bandwidth", ",", "points", ")", "retur...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
_start_update_server
Start a TCP server to receive accumulator updates in a daemon thread, and returns it
python/pyspark/accumulators.py
def _start_update_server(auth_token): """Start a TCP server to receive accumulator updates in a daemon thread, and returns it""" server = AccumulatorServer(("localhost", 0), _UpdateRequestHandler, auth_token) thread = threading.Thread(target=server.serve_forever) thread.daemon = True thread.start() ...
def _start_update_server(auth_token): """Start a TCP server to receive accumulator updates in a daemon thread, and returns it""" server = AccumulatorServer(("localhost", 0), _UpdateRequestHandler, auth_token) thread = threading.Thread(target=server.serve_forever) thread.daemon = True thread.start() ...
[ "Start", "a", "TCP", "server", "to", "receive", "accumulator", "updates", "in", "a", "daemon", "thread", "and", "returns", "it" ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/accumulators.py#L289-L295
[ "def", "_start_update_server", "(", "auth_token", ")", ":", "server", "=", "AccumulatorServer", "(", "(", "\"localhost\"", ",", "0", ")", ",", "_UpdateRequestHandler", ",", "auth_token", ")", "thread", "=", "threading", ".", "Thread", "(", "target", "=", "serv...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
Accumulator.add
Adds a term to this accumulator's value
python/pyspark/accumulators.py
def add(self, term): """Adds a term to this accumulator's value""" self._value = self.accum_param.addInPlace(self._value, term)
def add(self, term): """Adds a term to this accumulator's value""" self._value = self.accum_param.addInPlace(self._value, term)
[ "Adds", "a", "term", "to", "this", "accumulator", "s", "value" ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/accumulators.py#L163-L165
[ "def", "add", "(", "self", ",", "term", ")", ":", "self", ".", "_value", "=", "self", ".", "accum_param", ".", "addInPlace", "(", "self", ".", "_value", ",", "term", ")" ]
618d6bff71073c8c93501ab7392c3cc579730f0b
train
GroupedData.agg
Compute aggregates and returns the result as a :class:`DataFrame`. The available aggregate functions can be: 1. built-in aggregation functions, such as `avg`, `max`, `min`, `sum`, `count` 2. group aggregate pandas UDFs, created with :func:`pyspark.sql.functions.pandas_udf` .. note...
python/pyspark/sql/group.py
def agg(self, *exprs): """Compute aggregates and returns the result as a :class:`DataFrame`. The available aggregate functions can be: 1. built-in aggregation functions, such as `avg`, `max`, `min`, `sum`, `count` 2. group aggregate pandas UDFs, created with :func:`pyspark.sql.functio...
def agg(self, *exprs): """Compute aggregates and returns the result as a :class:`DataFrame`. The available aggregate functions can be: 1. built-in aggregation functions, such as `avg`, `max`, `min`, `sum`, `count` 2. group aggregate pandas UDFs, created with :func:`pyspark.sql.functio...
[ "Compute", "aggregates", "and", "returns", "the", "result", "as", "a", ":", "class", ":", "DataFrame", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/group.py#L66-L116
[ "def", "agg", "(", "self", ",", "*", "exprs", ")", ":", "assert", "exprs", ",", "\"exprs should not be empty\"", "if", "len", "(", "exprs", ")", "==", "1", "and", "isinstance", "(", "exprs", "[", "0", "]", ",", "dict", ")", ":", "jdf", "=", "self", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
GroupedData.pivot
Pivots a column of the current :class:`DataFrame` and perform the specified aggregation. There are two versions of pivot function: one that requires the caller to specify the list of distinct values to pivot on, and one that does not. The latter is more concise but less efficient, because Spark ...
python/pyspark/sql/group.py
def pivot(self, pivot_col, values=None): """ Pivots a column of the current :class:`DataFrame` and perform the specified aggregation. There are two versions of pivot function: one that requires the caller to specify the list of distinct values to pivot on, and one that does not. The latt...
def pivot(self, pivot_col, values=None): """ Pivots a column of the current :class:`DataFrame` and perform the specified aggregation. There are two versions of pivot function: one that requires the caller to specify the list of distinct values to pivot on, and one that does not. The latt...
[ "Pivots", "a", "column", "of", "the", "current", ":", "class", ":", "DataFrame", "and", "perform", "the", "specified", "aggregation", ".", "There", "are", "two", "versions", "of", "pivot", "function", ":", "one", "that", "requires", "the", "caller", "to", ...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/group.py#L195-L221
[ "def", "pivot", "(", "self", ",", "pivot_col", ",", "values", "=", "None", ")", ":", "if", "values", "is", "None", ":", "jgd", "=", "self", ".", "_jgd", ".", "pivot", "(", "pivot_col", ")", "else", ":", "jgd", "=", "self", ".", "_jgd", ".", "pivo...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
GroupedData.apply
Maps each group of the current :class:`DataFrame` using a pandas udf and returns the result as a `DataFrame`. The user-defined function should take a `pandas.DataFrame` and return another `pandas.DataFrame`. For each group, all columns are passed together as a `pandas.DataFrame` to the ...
python/pyspark/sql/group.py
def apply(self, udf): """ Maps each group of the current :class:`DataFrame` using a pandas udf and returns the result as a `DataFrame`. The user-defined function should take a `pandas.DataFrame` and return another `pandas.DataFrame`. For each group, all columns are passed togeth...
def apply(self, udf): """ Maps each group of the current :class:`DataFrame` using a pandas udf and returns the result as a `DataFrame`. The user-defined function should take a `pandas.DataFrame` and return another `pandas.DataFrame`. For each group, all columns are passed togeth...
[ "Maps", "each", "group", "of", "the", "current", ":", "class", ":", "DataFrame", "using", "a", "pandas", "udf", "and", "returns", "the", "result", "as", "a", "DataFrame", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/group.py#L224-L276
[ "def", "apply", "(", "self", ",", "udf", ")", ":", "# Columns are special because hasattr always return True", "if", "isinstance", "(", "udf", ",", "Column", ")", "or", "not", "hasattr", "(", "udf", ",", "'func'", ")", "or", "udf", ".", "evalType", "!=", "Py...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
Window.partitionBy
Creates a :class:`WindowSpec` with the partitioning defined.
python/pyspark/sql/window.py
def partitionBy(*cols): """ Creates a :class:`WindowSpec` with the partitioning defined. """ sc = SparkContext._active_spark_context jspec = sc._jvm.org.apache.spark.sql.expressions.Window.partitionBy(_to_java_cols(cols)) return WindowSpec(jspec)
def partitionBy(*cols): """ Creates a :class:`WindowSpec` with the partitioning defined. """ sc = SparkContext._active_spark_context jspec = sc._jvm.org.apache.spark.sql.expressions.Window.partitionBy(_to_java_cols(cols)) return WindowSpec(jspec)
[ "Creates", "a", ":", "class", ":", "WindowSpec", "with", "the", "partitioning", "defined", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/window.py#L67-L73
[ "def", "partitionBy", "(", "*", "cols", ")", ":", "sc", "=", "SparkContext", ".", "_active_spark_context", "jspec", "=", "sc", ".", "_jvm", ".", "org", ".", "apache", ".", "spark", ".", "sql", ".", "expressions", ".", "Window", ".", "partitionBy", "(", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
Window.rowsBetween
Creates a :class:`WindowSpec` with the frame boundaries defined, from `start` (inclusive) to `end` (inclusive). Both `start` and `end` are relative positions from the current row. For example, "0" means "current row", while "-1" means the row before the current row, and "5" means the fi...
python/pyspark/sql/window.py
def rowsBetween(start, end): """ Creates a :class:`WindowSpec` with the frame boundaries defined, from `start` (inclusive) to `end` (inclusive). Both `start` and `end` are relative positions from the current row. For example, "0" means "current row", while "-1" means the row bef...
def rowsBetween(start, end): """ Creates a :class:`WindowSpec` with the frame boundaries defined, from `start` (inclusive) to `end` (inclusive). Both `start` and `end` are relative positions from the current row. For example, "0" means "current row", while "-1" means the row bef...
[ "Creates", "a", ":", "class", ":", "WindowSpec", "with", "the", "frame", "boundaries", "defined", "from", "start", "(", "inclusive", ")", "to", "end", "(", "inclusive", ")", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/window.py#L87-L139
[ "def", "rowsBetween", "(", "start", ",", "end", ")", ":", "if", "start", "<=", "Window", ".", "_PRECEDING_THRESHOLD", ":", "start", "=", "Window", ".", "unboundedPreceding", "if", "end", ">=", "Window", ".", "_FOLLOWING_THRESHOLD", ":", "end", "=", "Window",...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
WindowSpec.rowsBetween
Defines the frame boundaries, from `start` (inclusive) to `end` (inclusive). Both `start` and `end` are relative positions from the current row. For example, "0" means "current row", while "-1" means the row before the current row, and "5" means the fifth row after the current row. We ...
python/pyspark/sql/window.py
def rowsBetween(self, start, end): """ Defines the frame boundaries, from `start` (inclusive) to `end` (inclusive). Both `start` and `end` are relative positions from the current row. For example, "0" means "current row", while "-1" means the row before the current row, and "5" ...
def rowsBetween(self, start, end): """ Defines the frame boundaries, from `start` (inclusive) to `end` (inclusive). Both `start` and `end` are relative positions from the current row. For example, "0" means "current row", while "-1" means the row before the current row, and "5" ...
[ "Defines", "the", "frame", "boundaries", "from", "start", "(", "inclusive", ")", "to", "end", "(", "inclusive", ")", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/window.py#L235-L258
[ "def", "rowsBetween", "(", "self", ",", "start", ",", "end", ")", ":", "if", "start", "<=", "Window", ".", "_PRECEDING_THRESHOLD", ":", "start", "=", "Window", ".", "unboundedPreceding", "if", "end", ">=", "Window", ".", "_FOLLOWING_THRESHOLD", ":", "end", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
RandomRDDs.uniformRDD
Generates an RDD comprised of i.i.d. samples from the uniform distribution U(0.0, 1.0). To transform the distribution in the generated RDD from U(0.0, 1.0) to U(a, b), use C{RandomRDDs.uniformRDD(sc, n, p, seed)\ .map(lambda v: a + (b - a) * v)} :param sc: SparkContex...
python/pyspark/mllib/random.py
def uniformRDD(sc, size, numPartitions=None, seed=None): """ Generates an RDD comprised of i.i.d. samples from the uniform distribution U(0.0, 1.0). To transform the distribution in the generated RDD from U(0.0, 1.0) to U(a, b), use C{RandomRDDs.uniformRDD(sc, n, p, seed...
def uniformRDD(sc, size, numPartitions=None, seed=None): """ Generates an RDD comprised of i.i.d. samples from the uniform distribution U(0.0, 1.0). To transform the distribution in the generated RDD from U(0.0, 1.0) to U(a, b), use C{RandomRDDs.uniformRDD(sc, n, p, seed...
[ "Generates", "an", "RDD", "comprised", "of", "i", ".", "i", ".", "d", ".", "samples", "from", "the", "uniform", "distribution", "U", "(", "0", ".", "0", "1", ".", "0", ")", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/mllib/random.py#L50-L77
[ "def", "uniformRDD", "(", "sc", ",", "size", ",", "numPartitions", "=", "None", ",", "seed", "=", "None", ")", ":", "return", "callMLlibFunc", "(", "\"uniformRDD\"", ",", "sc", ".", "_jsc", ",", "size", ",", "numPartitions", ",", "seed", ")" ]
618d6bff71073c8c93501ab7392c3cc579730f0b
train
RandomRDDs.normalRDD
Generates an RDD comprised of i.i.d. samples from the standard normal distribution. To transform the distribution in the generated RDD from standard normal to some other normal N(mean, sigma^2), use C{RandomRDDs.normal(sc, n, p, seed)\ .map(lambda v: mean + sigma * v)} ...
python/pyspark/mllib/random.py
def normalRDD(sc, size, numPartitions=None, seed=None): """ Generates an RDD comprised of i.i.d. samples from the standard normal distribution. To transform the distribution in the generated RDD from standard normal to some other normal N(mean, sigma^2), use C{RandomRDDs...
def normalRDD(sc, size, numPartitions=None, seed=None): """ Generates an RDD comprised of i.i.d. samples from the standard normal distribution. To transform the distribution in the generated RDD from standard normal to some other normal N(mean, sigma^2), use C{RandomRDDs...
[ "Generates", "an", "RDD", "comprised", "of", "i", ".", "i", ".", "d", ".", "samples", "from", "the", "standard", "normal", "distribution", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/mllib/random.py#L81-L106
[ "def", "normalRDD", "(", "sc", ",", "size", ",", "numPartitions", "=", "None", ",", "seed", "=", "None", ")", ":", "return", "callMLlibFunc", "(", "\"normalRDD\"", ",", "sc", ".", "_jsc", ",", "size", ",", "numPartitions", ",", "seed", ")" ]
618d6bff71073c8c93501ab7392c3cc579730f0b
train
RandomRDDs.logNormalRDD
Generates an RDD comprised of i.i.d. samples from the log normal distribution with the input mean and standard distribution. :param sc: SparkContext used to create the RDD. :param mean: mean for the log Normal distribution :param std: std for the log Normal distribution :param s...
python/pyspark/mllib/random.py
def logNormalRDD(sc, mean, std, size, numPartitions=None, seed=None): """ Generates an RDD comprised of i.i.d. samples from the log normal distribution with the input mean and standard distribution. :param sc: SparkContext used to create the RDD. :param mean: mean for the log No...
def logNormalRDD(sc, mean, std, size, numPartitions=None, seed=None): """ Generates an RDD comprised of i.i.d. samples from the log normal distribution with the input mean and standard distribution. :param sc: SparkContext used to create the RDD. :param mean: mean for the log No...
[ "Generates", "an", "RDD", "comprised", "of", "i", ".", "i", ".", "d", ".", "samples", "from", "the", "log", "normal", "distribution", "with", "the", "input", "mean", "and", "standard", "distribution", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/mllib/random.py#L110-L139
[ "def", "logNormalRDD", "(", "sc", ",", "mean", ",", "std", ",", "size", ",", "numPartitions", "=", "None", ",", "seed", "=", "None", ")", ":", "return", "callMLlibFunc", "(", "\"logNormalRDD\"", ",", "sc", ".", "_jsc", ",", "float", "(", "mean", ")", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
RandomRDDs.exponentialRDD
Generates an RDD comprised of i.i.d. samples from the Exponential distribution with the input mean. :param sc: SparkContext used to create the RDD. :param mean: Mean, or 1 / lambda, for the Exponential distribution. :param size: Size of the RDD. :param numPartitions: Number of p...
python/pyspark/mllib/random.py
def exponentialRDD(sc, mean, size, numPartitions=None, seed=None): """ Generates an RDD comprised of i.i.d. samples from the Exponential distribution with the input mean. :param sc: SparkContext used to create the RDD. :param mean: Mean, or 1 / lambda, for the Exponential distri...
def exponentialRDD(sc, mean, size, numPartitions=None, seed=None): """ Generates an RDD comprised of i.i.d. samples from the Exponential distribution with the input mean. :param sc: SparkContext used to create the RDD. :param mean: Mean, or 1 / lambda, for the Exponential distri...
[ "Generates", "an", "RDD", "comprised", "of", "i", ".", "i", ".", "d", ".", "samples", "from", "the", "Exponential", "distribution", "with", "the", "input", "mean", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/mllib/random.py#L170-L193
[ "def", "exponentialRDD", "(", "sc", ",", "mean", ",", "size", ",", "numPartitions", "=", "None", ",", "seed", "=", "None", ")", ":", "return", "callMLlibFunc", "(", "\"exponentialRDD\"", ",", "sc", ".", "_jsc", ",", "float", "(", "mean", ")", ",", "siz...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
RandomRDDs.gammaRDD
Generates an RDD comprised of i.i.d. samples from the Gamma distribution with the input shape and scale. :param sc: SparkContext used to create the RDD. :param shape: shape (> 0) parameter for the Gamma distribution :param scale: scale (> 0) parameter for the Gamma distribution ...
python/pyspark/mllib/random.py
def gammaRDD(sc, shape, scale, size, numPartitions=None, seed=None): """ Generates an RDD comprised of i.i.d. samples from the Gamma distribution with the input shape and scale. :param sc: SparkContext used to create the RDD. :param shape: shape (> 0) parameter for the Gamma dis...
def gammaRDD(sc, shape, scale, size, numPartitions=None, seed=None): """ Generates an RDD comprised of i.i.d. samples from the Gamma distribution with the input shape and scale. :param sc: SparkContext used to create the RDD. :param shape: shape (> 0) parameter for the Gamma dis...
[ "Generates", "an", "RDD", "comprised", "of", "i", ".", "i", ".", "d", ".", "samples", "from", "the", "Gamma", "distribution", "with", "the", "input", "shape", "and", "scale", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/mllib/random.py#L197-L225
[ "def", "gammaRDD", "(", "sc", ",", "shape", ",", "scale", ",", "size", ",", "numPartitions", "=", "None", ",", "seed", "=", "None", ")", ":", "return", "callMLlibFunc", "(", "\"gammaRDD\"", ",", "sc", ".", "_jsc", ",", "float", "(", "shape", ")", ","...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
RandomRDDs.uniformVectorRDD
Generates an RDD comprised of vectors containing i.i.d. samples drawn from the uniform distribution U(0.0, 1.0). :param sc: SparkContext used to create the RDD. :param numRows: Number of Vectors in the RDD. :param numCols: Number of elements in each Vector. :param numPartitions:...
python/pyspark/mllib/random.py
def uniformVectorRDD(sc, numRows, numCols, numPartitions=None, seed=None): """ Generates an RDD comprised of vectors containing i.i.d. samples drawn from the uniform distribution U(0.0, 1.0). :param sc: SparkContext used to create the RDD. :param numRows: Number of Vectors in th...
def uniformVectorRDD(sc, numRows, numCols, numPartitions=None, seed=None): """ Generates an RDD comprised of vectors containing i.i.d. samples drawn from the uniform distribution U(0.0, 1.0). :param sc: SparkContext used to create the RDD. :param numRows: Number of Vectors in th...
[ "Generates", "an", "RDD", "comprised", "of", "vectors", "containing", "i", ".", "i", ".", "d", ".", "samples", "drawn", "from", "the", "uniform", "distribution", "U", "(", "0", ".", "0", "1", ".", "0", ")", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/mllib/random.py#L230-L251
[ "def", "uniformVectorRDD", "(", "sc", ",", "numRows", ",", "numCols", ",", "numPartitions", "=", "None", ",", "seed", "=", "None", ")", ":", "return", "callMLlibFunc", "(", "\"uniformVectorRDD\"", ",", "sc", ".", "_jsc", ",", "numRows", ",", "numCols", ","...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
RandomRDDs.normalVectorRDD
Generates an RDD comprised of vectors containing i.i.d. samples drawn from the standard normal distribution. :param sc: SparkContext used to create the RDD. :param numRows: Number of Vectors in the RDD. :param numCols: Number of elements in each Vector. :param numPartitions: Num...
python/pyspark/mllib/random.py
def normalVectorRDD(sc, numRows, numCols, numPartitions=None, seed=None): """ Generates an RDD comprised of vectors containing i.i.d. samples drawn from the standard normal distribution. :param sc: SparkContext used to create the RDD. :param numRows: Number of Vectors in the RDD...
def normalVectorRDD(sc, numRows, numCols, numPartitions=None, seed=None): """ Generates an RDD comprised of vectors containing i.i.d. samples drawn from the standard normal distribution. :param sc: SparkContext used to create the RDD. :param numRows: Number of Vectors in the RDD...
[ "Generates", "an", "RDD", "comprised", "of", "vectors", "containing", "i", ".", "i", ".", "d", ".", "samples", "drawn", "from", "the", "standard", "normal", "distribution", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/mllib/random.py#L256-L277
[ "def", "normalVectorRDD", "(", "sc", ",", "numRows", ",", "numCols", ",", "numPartitions", "=", "None", ",", "seed", "=", "None", ")", ":", "return", "callMLlibFunc", "(", "\"normalVectorRDD\"", ",", "sc", ".", "_jsc", ",", "numRows", ",", "numCols", ",", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
RandomRDDs.logNormalVectorRDD
Generates an RDD comprised of vectors containing i.i.d. samples drawn from the log normal distribution. :param sc: SparkContext used to create the RDD. :param mean: Mean of the log normal distribution :param std: Standard Deviation of the log normal distribution :param numRows: ...
python/pyspark/mllib/random.py
def logNormalVectorRDD(sc, mean, std, numRows, numCols, numPartitions=None, seed=None): """ Generates an RDD comprised of vectors containing i.i.d. samples drawn from the log normal distribution. :param sc: SparkContext used to create the RDD. :param mean: Mean of the log normal...
def logNormalVectorRDD(sc, mean, std, numRows, numCols, numPartitions=None, seed=None): """ Generates an RDD comprised of vectors containing i.i.d. samples drawn from the log normal distribution. :param sc: SparkContext used to create the RDD. :param mean: Mean of the log normal...
[ "Generates", "an", "RDD", "comprised", "of", "vectors", "containing", "i", ".", "i", ".", "d", ".", "samples", "drawn", "from", "the", "log", "normal", "distribution", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/mllib/random.py#L282-L312
[ "def", "logNormalVectorRDD", "(", "sc", ",", "mean", ",", "std", ",", "numRows", ",", "numCols", ",", "numPartitions", "=", "None", ",", "seed", "=", "None", ")", ":", "return", "callMLlibFunc", "(", "\"logNormalVectorRDD\"", ",", "sc", ".", "_jsc", ",", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
RandomRDDs.poissonVectorRDD
Generates an RDD comprised of vectors containing i.i.d. samples drawn from the Poisson distribution with the input mean. :param sc: SparkContext used to create the RDD. :param mean: Mean, or lambda, for the Poisson distribution. :param numRows: Number of Vectors in the RDD. :par...
python/pyspark/mllib/random.py
def poissonVectorRDD(sc, mean, numRows, numCols, numPartitions=None, seed=None): """ Generates an RDD comprised of vectors containing i.i.d. samples drawn from the Poisson distribution with the input mean. :param sc: SparkContext used to create the RDD. :param mean: Mean, or lam...
def poissonVectorRDD(sc, mean, numRows, numCols, numPartitions=None, seed=None): """ Generates an RDD comprised of vectors containing i.i.d. samples drawn from the Poisson distribution with the input mean. :param sc: SparkContext used to create the RDD. :param mean: Mean, or lam...
[ "Generates", "an", "RDD", "comprised", "of", "vectors", "containing", "i", ".", "i", ".", "d", ".", "samples", "drawn", "from", "the", "Poisson", "distribution", "with", "the", "input", "mean", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/mllib/random.py#L317-L343
[ "def", "poissonVectorRDD", "(", "sc", ",", "mean", ",", "numRows", ",", "numCols", ",", "numPartitions", "=", "None", ",", "seed", "=", "None", ")", ":", "return", "callMLlibFunc", "(", "\"poissonVectorRDD\"", ",", "sc", ".", "_jsc", ",", "float", "(", "...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
RandomRDDs.gammaVectorRDD
Generates an RDD comprised of vectors containing i.i.d. samples drawn from the Gamma distribution. :param sc: SparkContext used to create the RDD. :param shape: Shape (> 0) of the Gamma distribution :param scale: Scale (> 0) of the Gamma distribution :param numRows: Number of Ve...
python/pyspark/mllib/random.py
def gammaVectorRDD(sc, shape, scale, numRows, numCols, numPartitions=None, seed=None): """ Generates an RDD comprised of vectors containing i.i.d. samples drawn from the Gamma distribution. :param sc: SparkContext used to create the RDD. :param shape: Shape (> 0) of the Gamma di...
def gammaVectorRDD(sc, shape, scale, numRows, numCols, numPartitions=None, seed=None): """ Generates an RDD comprised of vectors containing i.i.d. samples drawn from the Gamma distribution. :param sc: SparkContext used to create the RDD. :param shape: Shape (> 0) of the Gamma di...
[ "Generates", "an", "RDD", "comprised", "of", "vectors", "containing", "i", ".", "i", ".", "d", ".", "samples", "drawn", "from", "the", "Gamma", "distribution", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/mllib/random.py#L379-L408
[ "def", "gammaVectorRDD", "(", "sc", ",", "shape", ",", "scale", ",", "numRows", ",", "numCols", ",", "numPartitions", "=", "None", ",", "seed", "=", "None", ")", ":", "return", "callMLlibFunc", "(", "\"gammaVectorRDD\"", ",", "sc", ".", "_jsc", ",", "flo...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkSession.getActiveSession
Returns the active SparkSession for the current thread, returned by the builder. >>> s = SparkSession.getActiveSession() >>> l = [('Alice', 1)] >>> rdd = s.sparkContext.parallelize(l) >>> df = s.createDataFrame(rdd, ['name', 'age']) >>> df.select("age").collect() [Row(age...
python/pyspark/sql/session.py
def getActiveSession(cls): """ Returns the active SparkSession for the current thread, returned by the builder. >>> s = SparkSession.getActiveSession() >>> l = [('Alice', 1)] >>> rdd = s.sparkContext.parallelize(l) >>> df = s.createDataFrame(rdd, ['name', 'age']) ...
def getActiveSession(cls): """ Returns the active SparkSession for the current thread, returned by the builder. >>> s = SparkSession.getActiveSession() >>> l = [('Alice', 1)] >>> rdd = s.sparkContext.parallelize(l) >>> df = s.createDataFrame(rdd, ['name', 'age']) ...
[ "Returns", "the", "active", "SparkSession", "for", "the", "current", "thread", "returned", "by", "the", "builder", ".", ">>>", "s", "=", "SparkSession", ".", "getActiveSession", "()", ">>>", "l", "=", "[", "(", "Alice", "1", ")", "]", ">>>", "rdd", "=", ...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/session.py#L263-L282
[ "def", "getActiveSession", "(", "cls", ")", ":", "from", "pyspark", "import", "SparkContext", "sc", "=", "SparkContext", ".", "_active_spark_context", "if", "sc", "is", "None", ":", "return", "None", "else", ":", "if", "sc", ".", "_jvm", ".", "SparkSession",...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkSession.conf
Runtime configuration interface for Spark. This is the interface through which the user can get and set all Spark and Hadoop configurations that are relevant to Spark SQL. When getting the value of a config, this defaults to the value set in the underlying :class:`SparkContext`, if any.
python/pyspark/sql/session.py
def conf(self): """Runtime configuration interface for Spark. This is the interface through which the user can get and set all Spark and Hadoop configurations that are relevant to Spark SQL. When getting the value of a config, this defaults to the value set in the underlying :class:`Spa...
def conf(self): """Runtime configuration interface for Spark. This is the interface through which the user can get and set all Spark and Hadoop configurations that are relevant to Spark SQL. When getting the value of a config, this defaults to the value set in the underlying :class:`Spa...
[ "Runtime", "configuration", "interface", "for", "Spark", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/session.py#L298-L307
[ "def", "conf", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "\"_conf\"", ")", ":", "self", ".", "_conf", "=", "RuntimeConfig", "(", "self", ".", "_jsparkSession", ".", "conf", "(", ")", ")", "return", "self", ".", "_conf" ]
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkSession.catalog
Interface through which the user may create, drop, alter or query underlying databases, tables, functions etc. :return: :class:`Catalog`
python/pyspark/sql/session.py
def catalog(self): """Interface through which the user may create, drop, alter or query underlying databases, tables, functions etc. :return: :class:`Catalog` """ from pyspark.sql.catalog import Catalog if not hasattr(self, "_catalog"): self._catalog = Catalo...
def catalog(self): """Interface through which the user may create, drop, alter or query underlying databases, tables, functions etc. :return: :class:`Catalog` """ from pyspark.sql.catalog import Catalog if not hasattr(self, "_catalog"): self._catalog = Catalo...
[ "Interface", "through", "which", "the", "user", "may", "create", "drop", "alter", "or", "query", "underlying", "databases", "tables", "functions", "etc", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/session.py#L311-L320
[ "def", "catalog", "(", "self", ")", ":", "from", "pyspark", ".", "sql", ".", "catalog", "import", "Catalog", "if", "not", "hasattr", "(", "self", ",", "\"_catalog\"", ")", ":", "self", ".", "_catalog", "=", "Catalog", "(", "self", ")", "return", "self"...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkSession.range
Create a :class:`DataFrame` with single :class:`pyspark.sql.types.LongType` column named ``id``, containing elements in a range from ``start`` to ``end`` (exclusive) with step value ``step``. :param start: the start value :param end: the end value (exclusive) :param step: the in...
python/pyspark/sql/session.py
def range(self, start, end=None, step=1, numPartitions=None): """ Create a :class:`DataFrame` with single :class:`pyspark.sql.types.LongType` column named ``id``, containing elements in a range from ``start`` to ``end`` (exclusive) with step value ``step``. :param start: the sta...
def range(self, start, end=None, step=1, numPartitions=None): """ Create a :class:`DataFrame` with single :class:`pyspark.sql.types.LongType` column named ``id``, containing elements in a range from ``start`` to ``end`` (exclusive) with step value ``step``. :param start: the sta...
[ "Create", "a", ":", "class", ":", "DataFrame", "with", "single", ":", "class", ":", "pyspark", ".", "sql", ".", "types", ".", "LongType", "column", "named", "id", "containing", "elements", "in", "a", "range", "from", "start", "to", "end", "(", "exclusive...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/session.py#L333-L361
[ "def", "range", "(", "self", ",", "start", ",", "end", "=", "None", ",", "step", "=", "1", ",", "numPartitions", "=", "None", ")", ":", "if", "numPartitions", "is", "None", ":", "numPartitions", "=", "self", ".", "_sc", ".", "defaultParallelism", "if",...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkSession._inferSchemaFromList
Infer schema from list of Row or tuple. :param data: list of Row or tuple :param names: list of column names :return: :class:`pyspark.sql.types.StructType`
python/pyspark/sql/session.py
def _inferSchemaFromList(self, data, names=None): """ Infer schema from list of Row or tuple. :param data: list of Row or tuple :param names: list of column names :return: :class:`pyspark.sql.types.StructType` """ if not data: raise ValueError("can no...
def _inferSchemaFromList(self, data, names=None): """ Infer schema from list of Row or tuple. :param data: list of Row or tuple :param names: list of column names :return: :class:`pyspark.sql.types.StructType` """ if not data: raise ValueError("can no...
[ "Infer", "schema", "from", "list", "of", "Row", "or", "tuple", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/session.py#L363-L380
[ "def", "_inferSchemaFromList", "(", "self", ",", "data", ",", "names", "=", "None", ")", ":", "if", "not", "data", ":", "raise", "ValueError", "(", "\"can not infer schema from empty dataset\"", ")", "first", "=", "data", "[", "0", "]", "if", "type", "(", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkSession._inferSchema
Infer schema from an RDD of Row or tuple. :param rdd: an RDD of Row or tuple :param samplingRatio: sampling ratio, or no sampling (default) :return: :class:`pyspark.sql.types.StructType`
python/pyspark/sql/session.py
def _inferSchema(self, rdd, samplingRatio=None, names=None): """ Infer schema from an RDD of Row or tuple. :param rdd: an RDD of Row or tuple :param samplingRatio: sampling ratio, or no sampling (default) :return: :class:`pyspark.sql.types.StructType` """ first =...
def _inferSchema(self, rdd, samplingRatio=None, names=None): """ Infer schema from an RDD of Row or tuple. :param rdd: an RDD of Row or tuple :param samplingRatio: sampling ratio, or no sampling (default) :return: :class:`pyspark.sql.types.StructType` """ first =...
[ "Infer", "schema", "from", "an", "RDD", "of", "Row", "or", "tuple", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/session.py#L382-L412
[ "def", "_inferSchema", "(", "self", ",", "rdd", ",", "samplingRatio", "=", "None", ",", "names", "=", "None", ")", ":", "first", "=", "rdd", ".", "first", "(", ")", "if", "not", "first", ":", "raise", "ValueError", "(", "\"The first row in RDD is empty, \"...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkSession._createFromRDD
Create an RDD for DataFrame from an existing RDD, returns the RDD and schema.
python/pyspark/sql/session.py
def _createFromRDD(self, rdd, schema, samplingRatio): """ Create an RDD for DataFrame from an existing RDD, returns the RDD and schema. """ if schema is None or isinstance(schema, (list, tuple)): struct = self._inferSchema(rdd, samplingRatio, names=schema) convert...
def _createFromRDD(self, rdd, schema, samplingRatio): """ Create an RDD for DataFrame from an existing RDD, returns the RDD and schema. """ if schema is None or isinstance(schema, (list, tuple)): struct = self._inferSchema(rdd, samplingRatio, names=schema) convert...
[ "Create", "an", "RDD", "for", "DataFrame", "from", "an", "existing", "RDD", "returns", "the", "RDD", "and", "schema", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/session.py#L414-L433
[ "def", "_createFromRDD", "(", "self", ",", "rdd", ",", "schema", ",", "samplingRatio", ")", ":", "if", "schema", "is", "None", "or", "isinstance", "(", "schema", ",", "(", "list", ",", "tuple", ")", ")", ":", "struct", "=", "self", ".", "_inferSchema",...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkSession._createFromLocal
Create an RDD for DataFrame from a list or pandas.DataFrame, returns the RDD and schema.
python/pyspark/sql/session.py
def _createFromLocal(self, data, schema): """ Create an RDD for DataFrame from a list or pandas.DataFrame, returns the RDD and schema. """ # make sure data could consumed multiple times if not isinstance(data, list): data = list(data) if schema is Non...
def _createFromLocal(self, data, schema): """ Create an RDD for DataFrame from a list or pandas.DataFrame, returns the RDD and schema. """ # make sure data could consumed multiple times if not isinstance(data, list): data = list(data) if schema is Non...
[ "Create", "an", "RDD", "for", "DataFrame", "from", "a", "list", "or", "pandas", ".", "DataFrame", "returns", "the", "RDD", "and", "schema", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/session.py#L435-L459
[ "def", "_createFromLocal", "(", "self", ",", "data", ",", "schema", ")", ":", "# make sure data could consumed multiple times", "if", "not", "isinstance", "(", "data", ",", "list", ")", ":", "data", "=", "list", "(", "data", ")", "if", "schema", "is", "None"...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkSession._get_numpy_record_dtype
Used when converting a pandas.DataFrame to Spark using to_records(), this will correct the dtypes of fields in a record so they can be properly loaded into Spark. :param rec: a numpy record to check field dtypes :return corrected dtype for a numpy.record or None if no correction needed
python/pyspark/sql/session.py
def _get_numpy_record_dtype(self, rec): """ Used when converting a pandas.DataFrame to Spark using to_records(), this will correct the dtypes of fields in a record so they can be properly loaded into Spark. :param rec: a numpy record to check field dtypes :return corrected dtype ...
def _get_numpy_record_dtype(self, rec): """ Used when converting a pandas.DataFrame to Spark using to_records(), this will correct the dtypes of fields in a record so they can be properly loaded into Spark. :param rec: a numpy record to check field dtypes :return corrected dtype ...
[ "Used", "when", "converting", "a", "pandas", ".", "DataFrame", "to", "Spark", "using", "to_records", "()", "this", "will", "correct", "the", "dtypes", "of", "fields", "in", "a", "record", "so", "they", "can", "be", "properly", "loaded", "into", "Spark", "....
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/session.py#L461-L482
[ "def", "_get_numpy_record_dtype", "(", "self", ",", "rec", ")", ":", "import", "numpy", "as", "np", "cur_dtypes", "=", "rec", ".", "dtype", "col_names", "=", "cur_dtypes", ".", "names", "record_type_list", "=", "[", "]", "has_rec_fix", "=", "False", "for", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkSession._convert_from_pandas
Convert a pandas.DataFrame to list of records that can be used to make a DataFrame :return list of records
python/pyspark/sql/session.py
def _convert_from_pandas(self, pdf, schema, timezone): """ Convert a pandas.DataFrame to list of records that can be used to make a DataFrame :return list of records """ if timezone is not None: from pyspark.sql.types import _check_series_convert_timestamps_tz_local...
def _convert_from_pandas(self, pdf, schema, timezone): """ Convert a pandas.DataFrame to list of records that can be used to make a DataFrame :return list of records """ if timezone is not None: from pyspark.sql.types import _check_series_convert_timestamps_tz_local...
[ "Convert", "a", "pandas", ".", "DataFrame", "to", "list", "of", "records", "that", "can", "be", "used", "to", "make", "a", "DataFrame", ":", "return", "list", "of", "records" ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/session.py#L484-L525
[ "def", "_convert_from_pandas", "(", "self", ",", "pdf", ",", "schema", ",", "timezone", ")", ":", "if", "timezone", "is", "not", "None", ":", "from", "pyspark", ".", "sql", ".", "types", "import", "_check_series_convert_timestamps_tz_local", "copied", "=", "Fa...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkSession._create_from_pandas_with_arrow
Create a DataFrame from a given pandas.DataFrame by slicing it into partitions, converting to Arrow data, then sending to the JVM to parallelize. If a schema is passed in, the data types will be used to coerce the data in Pandas to Arrow conversion.
python/pyspark/sql/session.py
def _create_from_pandas_with_arrow(self, pdf, schema, timezone): """ Create a DataFrame from a given pandas.DataFrame by slicing it into partitions, converting to Arrow data, then sending to the JVM to parallelize. If a schema is passed in, the data types will be used to coerce the data ...
def _create_from_pandas_with_arrow(self, pdf, schema, timezone): """ Create a DataFrame from a given pandas.DataFrame by slicing it into partitions, converting to Arrow data, then sending to the JVM to parallelize. If a schema is passed in, the data types will be used to coerce the data ...
[ "Create", "a", "DataFrame", "from", "a", "given", "pandas", ".", "DataFrame", "by", "slicing", "it", "into", "partitions", "converting", "to", "Arrow", "data", "then", "sending", "to", "the", "JVM", "to", "parallelize", ".", "If", "a", "schema", "is", "pas...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/session.py#L527-L588
[ "def", "_create_from_pandas_with_arrow", "(", "self", ",", "pdf", ",", "schema", ",", "timezone", ")", ":", "from", "pyspark", ".", "serializers", "import", "ArrowStreamPandasSerializer", "from", "pyspark", ".", "sql", ".", "types", "import", "from_arrow_type", ",...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkSession._create_shell_session
Initialize a SparkSession for a pyspark shell session. This is called from shell.py to make error handling simpler without needing to declare local variables in that script, which would expose those to users.
python/pyspark/sql/session.py
def _create_shell_session(): """ Initialize a SparkSession for a pyspark shell session. This is called from shell.py to make error handling simpler without needing to declare local variables in that script, which would expose those to users. """ import py4j from p...
def _create_shell_session(): """ Initialize a SparkSession for a pyspark shell session. This is called from shell.py to make error handling simpler without needing to declare local variables in that script, which would expose those to users. """ import py4j from p...
[ "Initialize", "a", "SparkSession", "for", "a", "pyspark", "shell", "session", ".", "This", "is", "called", "from", "shell", ".", "py", "to", "make", "error", "handling", "simpler", "without", "needing", "to", "declare", "local", "variables", "in", "that", "s...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/session.py#L591-L615
[ "def", "_create_shell_session", "(", ")", ":", "import", "py4j", "from", "pyspark", ".", "conf", "import", "SparkConf", "from", "pyspark", ".", "context", "import", "SparkContext", "try", ":", "# Try to access HiveConf, it will raise exception if Hive is not added", "conf...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkSession.createDataFrame
Creates a :class:`DataFrame` from an :class:`RDD`, a list or a :class:`pandas.DataFrame`. When ``schema`` is a list of column names, the type of each column will be inferred from ``data``. When ``schema`` is ``None``, it will try to infer the schema (column names and types) from ``data...
python/pyspark/sql/session.py
def createDataFrame(self, data, schema=None, samplingRatio=None, verifySchema=True): """ Creates a :class:`DataFrame` from an :class:`RDD`, a list or a :class:`pandas.DataFrame`. When ``schema`` is a list of column names, the type of each column will be inferred from ``data``. ...
def createDataFrame(self, data, schema=None, samplingRatio=None, verifySchema=True): """ Creates a :class:`DataFrame` from an :class:`RDD`, a list or a :class:`pandas.DataFrame`. When ``schema`` is a list of column names, the type of each column will be inferred from ``data``. ...
[ "Creates", "a", ":", "class", ":", "DataFrame", "from", "an", ":", "class", ":", "RDD", "a", "list", "or", "a", ":", "class", ":", "pandas", ".", "DataFrame", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/session.py#L619-L787
[ "def", "createDataFrame", "(", "self", ",", "data", ",", "schema", "=", "None", ",", "samplingRatio", "=", "None", ",", "verifySchema", "=", "True", ")", ":", "SparkSession", ".", "_activeSession", "=", "self", "self", ".", "_jvm", ".", "SparkSession", "."...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkSession.sql
Returns a :class:`DataFrame` representing the result of the given query. :return: :class:`DataFrame` >>> df.createOrReplaceTempView("table1") >>> df2 = spark.sql("SELECT field1 AS f1, field2 as f2 from table1") >>> df2.collect() [Row(f1=1, f2=u'row1'), Row(f1=2, f2=u'row2'), Ro...
python/pyspark/sql/session.py
def sql(self, sqlQuery): """Returns a :class:`DataFrame` representing the result of the given query. :return: :class:`DataFrame` >>> df.createOrReplaceTempView("table1") >>> df2 = spark.sql("SELECT field1 AS f1, field2 as f2 from table1") >>> df2.collect() [Row(f1=1, f2...
def sql(self, sqlQuery): """Returns a :class:`DataFrame` representing the result of the given query. :return: :class:`DataFrame` >>> df.createOrReplaceTempView("table1") >>> df2 = spark.sql("SELECT field1 AS f1, field2 as f2 from table1") >>> df2.collect() [Row(f1=1, f2...
[ "Returns", "a", ":", "class", ":", "DataFrame", "representing", "the", "result", "of", "the", "given", "query", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/session.py#L791-L801
[ "def", "sql", "(", "self", ",", "sqlQuery", ")", ":", "return", "DataFrame", "(", "self", ".", "_jsparkSession", ".", "sql", "(", "sqlQuery", ")", ",", "self", ".", "_wrapped", ")" ]
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkSession.table
Returns the specified table as a :class:`DataFrame`. :return: :class:`DataFrame` >>> df.createOrReplaceTempView("table1") >>> df2 = spark.table("table1") >>> sorted(df.collect()) == sorted(df2.collect()) True
python/pyspark/sql/session.py
def table(self, tableName): """Returns the specified table as a :class:`DataFrame`. :return: :class:`DataFrame` >>> df.createOrReplaceTempView("table1") >>> df2 = spark.table("table1") >>> sorted(df.collect()) == sorted(df2.collect()) True """ return Dat...
def table(self, tableName): """Returns the specified table as a :class:`DataFrame`. :return: :class:`DataFrame` >>> df.createOrReplaceTempView("table1") >>> df2 = spark.table("table1") >>> sorted(df.collect()) == sorted(df2.collect()) True """ return Dat...
[ "Returns", "the", "specified", "table", "as", "a", ":", "class", ":", "DataFrame", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/session.py#L804-L814
[ "def", "table", "(", "self", ",", "tableName", ")", ":", "return", "DataFrame", "(", "self", ".", "_jsparkSession", ".", "table", "(", "tableName", ")", ",", "self", ".", "_wrapped", ")" ]
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkSession.streams
Returns a :class:`StreamingQueryManager` that allows managing all the :class:`StreamingQuery` StreamingQueries active on `this` context. .. note:: Evolving. :return: :class:`StreamingQueryManager`
python/pyspark/sql/session.py
def streams(self): """Returns a :class:`StreamingQueryManager` that allows managing all the :class:`StreamingQuery` StreamingQueries active on `this` context. .. note:: Evolving. :return: :class:`StreamingQueryManager` """ from pyspark.sql.streaming import StreamingQuer...
def streams(self): """Returns a :class:`StreamingQueryManager` that allows managing all the :class:`StreamingQuery` StreamingQueries active on `this` context. .. note:: Evolving. :return: :class:`StreamingQueryManager` """ from pyspark.sql.streaming import StreamingQuer...
[ "Returns", "a", ":", "class", ":", "StreamingQueryManager", "that", "allows", "managing", "all", "the", ":", "class", ":", "StreamingQuery", "StreamingQueries", "active", "on", "this", "context", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/session.py#L842-L851
[ "def", "streams", "(", "self", ")", ":", "from", "pyspark", ".", "sql", ".", "streaming", "import", "StreamingQueryManager", "return", "StreamingQueryManager", "(", "self", ".", "_jsparkSession", ".", "streams", "(", ")", ")" ]
618d6bff71073c8c93501ab7392c3cc579730f0b
train
SparkSession.stop
Stop the underlying :class:`SparkContext`.
python/pyspark/sql/session.py
def stop(self): """Stop the underlying :class:`SparkContext`. """ self._sc.stop() # We should clean the default session up. See SPARK-23228. self._jvm.SparkSession.clearDefaultSession() self._jvm.SparkSession.clearActiveSession() SparkSession._instantiatedSession ...
def stop(self): """Stop the underlying :class:`SparkContext`. """ self._sc.stop() # We should clean the default session up. See SPARK-23228. self._jvm.SparkSession.clearDefaultSession() self._jvm.SparkSession.clearActiveSession() SparkSession._instantiatedSession ...
[ "Stop", "the", "underlying", ":", "class", ":", "SparkContext", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/session.py#L854-L862
[ "def", "stop", "(", "self", ")", ":", "self", ".", "_sc", ".", "stop", "(", ")", "# We should clean the default session up. See SPARK-23228.", "self", ".", "_jvm", ".", "SparkSession", ".", "clearDefaultSession", "(", ")", "self", ".", "_jvm", ".", "SparkSession...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
StatusTracker.getJobInfo
Returns a :class:`SparkJobInfo` object, or None if the job info could not be found or was garbage collected.
python/pyspark/status.py
def getJobInfo(self, jobId): """ Returns a :class:`SparkJobInfo` object, or None if the job info could not be found or was garbage collected. """ job = self._jtracker.getJobInfo(jobId) if job is not None: return SparkJobInfo(jobId, job.stageIds(), str(job.stat...
def getJobInfo(self, jobId): """ Returns a :class:`SparkJobInfo` object, or None if the job info could not be found or was garbage collected. """ job = self._jtracker.getJobInfo(jobId) if job is not None: return SparkJobInfo(jobId, job.stageIds(), str(job.stat...
[ "Returns", "a", ":", "class", ":", "SparkJobInfo", "object", "or", "None", "if", "the", "job", "info", "could", "not", "be", "found", "or", "was", "garbage", "collected", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/status.py#L78-L85
[ "def", "getJobInfo", "(", "self", ",", "jobId", ")", ":", "job", "=", "self", ".", "_jtracker", ".", "getJobInfo", "(", "jobId", ")", "if", "job", "is", "not", "None", ":", "return", "SparkJobInfo", "(", "jobId", ",", "job", ".", "stageIds", "(", ")"...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
StatusTracker.getStageInfo
Returns a :class:`SparkStageInfo` object, or None if the stage info could not be found or was garbage collected.
python/pyspark/status.py
def getStageInfo(self, stageId): """ Returns a :class:`SparkStageInfo` object, or None if the stage info could not be found or was garbage collected. """ stage = self._jtracker.getStageInfo(stageId) if stage is not None: # TODO: fetch them in batch for better ...
def getStageInfo(self, stageId): """ Returns a :class:`SparkStageInfo` object, or None if the stage info could not be found or was garbage collected. """ stage = self._jtracker.getStageInfo(stageId) if stage is not None: # TODO: fetch them in batch for better ...
[ "Returns", "a", ":", "class", ":", "SparkStageInfo", "object", "or", "None", "if", "the", "stage", "info", "could", "not", "be", "found", "or", "was", "garbage", "collected", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/status.py#L87-L96
[ "def", "getStageInfo", "(", "self", ",", "stageId", ")", ":", "stage", "=", "self", ".", "_jtracker", ".", "getStageInfo", "(", "stageId", ")", "if", "stage", "is", "not", "None", ":", "# TODO: fetch them in batch for better performance", "attrs", "=", "[", "g...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
_restore
Restore an object of namedtuple
python/pyspark/serializers.py
def _restore(name, fields, value): """ Restore an object of namedtuple""" k = (name, fields) cls = __cls.get(k) if cls is None: cls = collections.namedtuple(name, fields) __cls[k] = cls return cls(*value)
def _restore(name, fields, value): """ Restore an object of namedtuple""" k = (name, fields) cls = __cls.get(k) if cls is None: cls = collections.namedtuple(name, fields) __cls[k] = cls return cls(*value)
[ "Restore", "an", "object", "of", "namedtuple" ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/serializers.py#L578-L585
[ "def", "_restore", "(", "name", ",", "fields", ",", "value", ")", ":", "k", "=", "(", "name", ",", "fields", ")", "cls", "=", "__cls", ".", "get", "(", "k", ")", "if", "cls", "is", "None", ":", "cls", "=", "collections", ".", "namedtuple", "(", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
_hack_namedtuple
Make class generated by namedtuple picklable
python/pyspark/serializers.py
def _hack_namedtuple(cls): """ Make class generated by namedtuple picklable """ name = cls.__name__ fields = cls._fields def __reduce__(self): return (_restore, (name, fields, tuple(self))) cls.__reduce__ = __reduce__ cls._is_namedtuple_ = True return cls
def _hack_namedtuple(cls): """ Make class generated by namedtuple picklable """ name = cls.__name__ fields = cls._fields def __reduce__(self): return (_restore, (name, fields, tuple(self))) cls.__reduce__ = __reduce__ cls._is_namedtuple_ = True return cls
[ "Make", "class", "generated", "by", "namedtuple", "picklable" ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/serializers.py#L588-L597
[ "def", "_hack_namedtuple", "(", "cls", ")", ":", "name", "=", "cls", ".", "__name__", "fields", "=", "cls", ".", "_fields", "def", "__reduce__", "(", "self", ")", ":", "return", "(", "_restore", ",", "(", "name", ",", "fields", ",", "tuple", "(", "se...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
_hijack_namedtuple
Hack namedtuple() to make it picklable
python/pyspark/serializers.py
def _hijack_namedtuple(): """ Hack namedtuple() to make it picklable """ # hijack only one time if hasattr(collections.namedtuple, "__hijack"): return global _old_namedtuple # or it will put in closure global _old_namedtuple_kwdefaults # or it will put in closure too def _copy_func(f...
def _hijack_namedtuple(): """ Hack namedtuple() to make it picklable """ # hijack only one time if hasattr(collections.namedtuple, "__hijack"): return global _old_namedtuple # or it will put in closure global _old_namedtuple_kwdefaults # or it will put in closure too def _copy_func(f...
[ "Hack", "namedtuple", "()", "to", "make", "it", "picklable" ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/serializers.py#L600-L651
[ "def", "_hijack_namedtuple", "(", ")", ":", "# hijack only one time", "if", "hasattr", "(", "collections", ".", "namedtuple", ",", "\"__hijack\"", ")", ":", "return", "global", "_old_namedtuple", "# or it will put in closure", "global", "_old_namedtuple_kwdefaults", "# or...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
ArrowCollectSerializer.load_stream
Load a stream of un-ordered Arrow RecordBatches, where the last iteration yields a list of indices that can be used to put the RecordBatches in the correct order.
python/pyspark/serializers.py
def load_stream(self, stream): """ Load a stream of un-ordered Arrow RecordBatches, where the last iteration yields a list of indices that can be used to put the RecordBatches in the correct order. """ # load the batches for batch in self.serializer.load_stream(stream): ...
def load_stream(self, stream): """ Load a stream of un-ordered Arrow RecordBatches, where the last iteration yields a list of indices that can be used to put the RecordBatches in the correct order. """ # load the batches for batch in self.serializer.load_stream(stream): ...
[ "Load", "a", "stream", "of", "un", "-", "ordered", "Arrow", "RecordBatches", "where", "the", "last", "iteration", "yields", "a", "list", "of", "indices", "that", "can", "be", "used", "to", "put", "the", "RecordBatches", "in", "the", "correct", "order", "."...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/serializers.py#L200-L215
[ "def", "load_stream", "(", "self", ",", "stream", ")", ":", "# load the batches", "for", "batch", "in", "self", ".", "serializer", ".", "load_stream", "(", "stream", ")", ":", "yield", "batch", "# load the batch order indices", "num", "=", "read_int", "(", "st...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
ArrowStreamPandasSerializer._create_batch
Create an Arrow record batch from the given pandas.Series or list of Series, with optional type. :param series: A single pandas.Series, list of Series, or list of (series, arrow_type) :return: Arrow RecordBatch
python/pyspark/serializers.py
def _create_batch(self, series): """ Create an Arrow record batch from the given pandas.Series or list of Series, with optional type. :param series: A single pandas.Series, list of Series, or list of (series, arrow_type) :return: Arrow RecordBatch """ import pand...
def _create_batch(self, series): """ Create an Arrow record batch from the given pandas.Series or list of Series, with optional type. :param series: A single pandas.Series, list of Series, or list of (series, arrow_type) :return: Arrow RecordBatch """ import pand...
[ "Create", "an", "Arrow", "record", "batch", "from", "the", "given", "pandas", ".", "Series", "or", "list", "of", "Series", "with", "optional", "type", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/serializers.py#L274-L335
[ "def", "_create_batch", "(", "self", ",", "series", ")", ":", "import", "pandas", "as", "pd", "import", "pyarrow", "as", "pa", "from", "pyspark", ".", "sql", ".", "types", "import", "_check_series_convert_timestamps_internal", "# Make input conform to [(series1, type1...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
ArrowStreamPandasSerializer.dump_stream
Make ArrowRecordBatches from Pandas Series and serialize. Input is a single series or a list of series accompanied by an optional pyarrow type to coerce the data to.
python/pyspark/serializers.py
def dump_stream(self, iterator, stream): """ Make ArrowRecordBatches from Pandas Series and serialize. Input is a single series or a list of series accompanied by an optional pyarrow type to coerce the data to. """ batches = (self._create_batch(series) for series in iterator) ...
def dump_stream(self, iterator, stream): """ Make ArrowRecordBatches from Pandas Series and serialize. Input is a single series or a list of series accompanied by an optional pyarrow type to coerce the data to. """ batches = (self._create_batch(series) for series in iterator) ...
[ "Make", "ArrowRecordBatches", "from", "Pandas", "Series", "and", "serialize", ".", "Input", "is", "a", "single", "series", "or", "a", "list", "of", "series", "accompanied", "by", "an", "optional", "pyarrow", "type", "to", "coerce", "the", "data", "to", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/serializers.py#L337-L343
[ "def", "dump_stream", "(", "self", ",", "iterator", ",", "stream", ")", ":", "batches", "=", "(", "self", ".", "_create_batch", "(", "series", ")", "for", "series", "in", "iterator", ")", "super", "(", "ArrowStreamPandasSerializer", ",", "self", ")", ".", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
ArrowStreamPandasSerializer.load_stream
Deserialize ArrowRecordBatches to an Arrow table and return as a list of pandas.Series.
python/pyspark/serializers.py
def load_stream(self, stream): """ Deserialize ArrowRecordBatches to an Arrow table and return as a list of pandas.Series. """ batches = super(ArrowStreamPandasSerializer, self).load_stream(stream) import pyarrow as pa for batch in batches: yield [self.arrow_t...
def load_stream(self, stream): """ Deserialize ArrowRecordBatches to an Arrow table and return as a list of pandas.Series. """ batches = super(ArrowStreamPandasSerializer, self).load_stream(stream) import pyarrow as pa for batch in batches: yield [self.arrow_t...
[ "Deserialize", "ArrowRecordBatches", "to", "an", "Arrow", "table", "and", "return", "as", "a", "list", "of", "pandas", ".", "Series", "." ]
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/serializers.py#L345-L352
[ "def", "load_stream", "(", "self", ",", "stream", ")", ":", "batches", "=", "super", "(", "ArrowStreamPandasSerializer", ",", "self", ")", ".", "load_stream", "(", "stream", ")", "import", "pyarrow", "as", "pa", "for", "batch", "in", "batches", ":", "yield...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
ArrowStreamPandasUDFSerializer.dump_stream
Override because Pandas UDFs require a START_ARROW_STREAM before the Arrow stream is sent. This should be sent after creating the first record batch so in case of an error, it can be sent back to the JVM before the Arrow stream starts.
python/pyspark/serializers.py
def dump_stream(self, iterator, stream): """ Override because Pandas UDFs require a START_ARROW_STREAM before the Arrow stream is sent. This should be sent after creating the first record batch so in case of an error, it can be sent back to the JVM before the Arrow stream starts. ...
def dump_stream(self, iterator, stream): """ Override because Pandas UDFs require a START_ARROW_STREAM before the Arrow stream is sent. This should be sent after creating the first record batch so in case of an error, it can be sent back to the JVM before the Arrow stream starts. ...
[ "Override", "because", "Pandas", "UDFs", "require", "a", "START_ARROW_STREAM", "before", "the", "Arrow", "stream", "is", "sent", ".", "This", "should", "be", "sent", "after", "creating", "the", "first", "record", "batch", "so", "in", "case", "of", "an", "err...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/serializers.py#L381-L397
[ "def", "dump_stream", "(", "self", ",", "iterator", ",", "stream", ")", ":", "def", "init_stream_yield_batches", "(", ")", ":", "should_write_start_length", "=", "True", "for", "series", "in", "iterator", ":", "batch", "=", "self", ".", "_create_batch", "(", ...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
StreamingQuery.awaitTermination
Waits for the termination of `this` query, either by :func:`query.stop()` or by an exception. If the query has terminated with an exception, then the exception will be thrown. If `timeout` is set, it returns whether the query has terminated or not within the `timeout` seconds. If the qu...
python/pyspark/sql/streaming.py
def awaitTermination(self, timeout=None): """Waits for the termination of `this` query, either by :func:`query.stop()` or by an exception. If the query has terminated with an exception, then the exception will be thrown. If `timeout` is set, it returns whether the query has terminated or not wit...
def awaitTermination(self, timeout=None): """Waits for the termination of `this` query, either by :func:`query.stop()` or by an exception. If the query has terminated with an exception, then the exception will be thrown. If `timeout` is set, it returns whether the query has terminated or not wit...
[ "Waits", "for", "the", "termination", "of", "this", "query", "either", "by", ":", "func", ":", "query", ".", "stop", "()", "or", "by", "an", "exception", ".", "If", "the", "query", "has", "terminated", "with", "an", "exception", "then", "the", "exception...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/streaming.py#L86-L103
[ "def", "awaitTermination", "(", "self", ",", "timeout", "=", "None", ")", ":", "if", "timeout", "is", "not", "None", ":", "if", "not", "isinstance", "(", "timeout", ",", "(", "int", ",", "float", ")", ")", "or", "timeout", "<", "0", ":", "raise", "...
618d6bff71073c8c93501ab7392c3cc579730f0b
train
StreamingQuery.recentProgress
Returns an array of the most recent [[StreamingQueryProgress]] updates for this query. The number of progress updates retained for each stream is configured by Spark session configuration `spark.sql.streaming.numRecentProgressUpdates`.
python/pyspark/sql/streaming.py
def recentProgress(self): """Returns an array of the most recent [[StreamingQueryProgress]] updates for this query. The number of progress updates retained for each stream is configured by Spark session configuration `spark.sql.streaming.numRecentProgressUpdates`. """ return [jso...
def recentProgress(self): """Returns an array of the most recent [[StreamingQueryProgress]] updates for this query. The number of progress updates retained for each stream is configured by Spark session configuration `spark.sql.streaming.numRecentProgressUpdates`. """ return [jso...
[ "Returns", "an", "array", "of", "the", "most", "recent", "[[", "StreamingQueryProgress", "]]", "updates", "for", "this", "query", ".", "The", "number", "of", "progress", "updates", "retained", "for", "each", "stream", "is", "configured", "by", "Spark", "sessio...
apache/spark
python
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/streaming.py#L115-L120
[ "def", "recentProgress", "(", "self", ")", ":", "return", "[", "json", ".", "loads", "(", "p", ".", "json", "(", ")", ")", "for", "p", "in", "self", ".", "_jsq", ".", "recentProgress", "(", ")", "]" ]
618d6bff71073c8c93501ab7392c3cc579730f0b