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

    https://github.com/apache/spark/pull/18798#discussion_r131735748
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/stat/Summarizer.scala ---
    @@ -547,35 +533,11 @@ object SummaryBuilderImpl extends Logging {
           // val features = udt.deserialize(featuresExpr.eval(row))
           val featuresDatum = featuresExpr.eval(row).asInstanceOf[InternalRow]
     
    -      val isDense = featuresDatum.getByte(0) == 1
    -
    -      val indices: ArrayData = if (isDense) null else 
featuresDatum.getArray(2)
    -      val values: ArrayData = featuresDatum.getArray(3)
    -      val _size = if (isDense) values.numElements() else 
featuresDatum.getInt(1)
    -
    -      val features = new TraversableIndexedSeq {
    -
    -        override def foreachActive(f: (Int, Double) => Unit): Unit = {
    -          var i = 0
    -          if (isDense) {
    -            while (i < _size) {
    -              f(i, values.getDouble(i))
    -              i += 1
    -            }
    -          } else {
    -            while (i < indices.numElements()) {
    -              f(indices.getInt(i), values.getDouble(i))
    -              i += 1
    -            }
    -          }
    -        }
    -
    -        override def size: Int = _size
    -      }
    +      val features = udt.deserialize(featuresDatum)
    --- End diff --
    
    Change to use `VectorUDT.deserialize` (Because last version code here won't 
improve performance markedly but increase code complexity.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to