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

    https://github.com/apache/spark/pull/16479#discussion_r94900222
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/source/libsvm/LibSVMRelation.scala ---
    @@ -45,9 +45,12 @@ private[libsvm] class LibSVMOutputWriter(
     
       private val writer = CodecStreams.createOutputStreamWriter(context, new 
Path(path))
     
    -  override def write(row: Row): Unit = {
    -    val label = row.get(0)
    -    val vector = row.get(1).asInstanceOf[Vector]
    +  // This `asInstanceOf` is safe because it's guaranteed by 
`LibSVMFileFormat.verifySchema`
    --- End diff --
    
    `LibSVMFileFormat.verifySchema` is only called in the [`buildReader` 
](https://github.com/cloud-fan/spark/blob/79bb30cf222c43c98d4d52ab207d65fdca1f83b5/mllib/src/main/scala/org/apache/spark/ml/source/libsvm/LibSVMRelation.scala#L143),
 but this is the write path, right?


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