Github user sethah commented on the issue:

    https://github.com/apache/spark/pull/18899
  
    I think there _is_ new functionality, a new method that needs its 
functionality defined. One specific example, we need a test like:
    
    ````scala
      test("toSparseWithSize") {
        val dv = Vectors.dense(1, 2, 3)
        withClue("toSparseWithSize fails on the wrong number of non-zeros") {
          intercept[java.lang.ArrayIndexOutOfBoundsException] {
            dv.toSparseWithSize(2)
          }
        }
      }
    ```` 
    
    This is evidence to future developers that the potential failure of this 
method is known and intended.  Also, we need a test for when we specify it 
incorrectly the other way. i.e. what is the expected outcome of:
    
    ````scala
    val dv = Vectors.dense(1, 2, 3)
    val sv = dv.toSparseWithSize(6)
    ````
    
    Right now, I get the error `java.lang.IllegalArgumentException: requirement 
failed: You provided 6 indices and values, which exceeds the specified vector 
size 3.` These behaviors are undesirable IMO, but should at least be tested.
    
    I don't believe there's any way to find a better solution without at least 
adding an O(nnz) operation. Honestly, some more specific performance results 
would be great to have here.


---
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