spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bago Amirbekian (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (SPARK-23333) SparkML VectorAssembler.transform slow when needing to invoke .first() on sorted DataFrame
Date Tue, 27 Feb 2018 21:25:00 GMT

    [ https://issues.apache.org/jira/browse/SPARK-23333?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16379296#comment-16379296
] 

Bago Amirbekian edited comment on SPARK-23333 at 2/27/18 9:24 PM:
------------------------------------------------------------------

[~MBALearnsToCode] you can use a `VectorSizeHint` transformer to include `numAttributes`
in the dataframe column metadata and avoid the call to `first`. https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/feature/VectorSizeHint.scala#L42


was (Author: bago.amirbekian):
[~MBALearnsToCode] you can use a `VectorSizeHint` transformer to include `numAttributes`
in the dataframe column metadata and avoid the call to `first`. https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/feature/VectorSizeHint.scala

> SparkML VectorAssembler.transform slow when needing to invoke .first() on sorted DataFrame
> ------------------------------------------------------------------------------------------
>
>                 Key: SPARK-23333
>                 URL: https://issues.apache.org/jira/browse/SPARK-23333
>             Project: Spark
>          Issue Type: Improvement
>          Components: ML, MLlib, SQL
>    Affects Versions: 2.2.1
>            Reporter: V Luong
>            Priority: Minor
>
> Under certain circumstances, newDF = vectorAssembler.transform(oldDF) invokes oldDF.first()
in order to establish some metadata/attributes: [https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/feature/VectorAssembler.scala#L88.] When
oldDF is sorted, the above triggering of oldDF.first() can be very slow.
> For the purpose of establishing metadata, taking an arbitrary row from oldDF will be
just as good as taking oldDF.first(). Is there hence a way we can speed up a great deal by somehow
grabbing a random row, instead of relying on oldDF.first()?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org


Mime
View raw message