Github user mpjlu commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18899#discussion_r132610049
  
    --- Diff: 
mllib-local/src/main/scala/org/apache/spark/ml/linalg/Vectors.scala ---
    @@ -635,8 +642,9 @@ class SparseVector @Since("2.0.0") (
         nnz
       }
     
    -  override def toSparse: SparseVector = {
    -    val nnz = numNonzeros
    +  override def toSparse: SparseVector = toSparse(numNonzeros)
    --- End diff --
    
    If define 
    `def toSparse: SparseVector = toSparse(numNonzeros)`
    in the superclass, when call dv.toSparse (there are this kinds of call in 
the code), there will be error message:
    Both toSparse in the DenseVector of type (nnz:Int) 
org.apache.spark.ml.linalg.SparseVector and toSparse in trait Vector of type 
=>org.apache.spark.ml.linalg.SparseVector match  .
    So we should change the name of toSparse(nnz: Int), maybe 
toSparseWithSize(nnz: Int).



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to