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

    https://github.com/apache/spark/pull/20686#discussion_r171546691
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/ml/feature/QuantileDiscretizerSuite.scala 
---
    @@ -324,19 +352,46 @@ class QuantileDiscretizerSuite
           .setStages(Array(discretizerForCol1, discretizerForCol2, 
discretizerForCol3))
           .fit(df)
     
    -    val resultForMultiCols = plForMultiCols.transform(df)
    -      .select("result1", "result2", "result3")
    -      .collect()
    -
    -    val resultForSingleCol = plForSingleCol.transform(df)
    -      .select("result1", "result2", "result3")
    -      .collect()
    +    val expected = Seq(
    +      (0.0, 0.0, 0.0),
    +      (0.0, 0.0, 1.0),
    +      (0.0, 0.0, 1.0),
    +      (0.0, 1.0, 2.0),
    +      (0.0, 1.0, 2.0),
    +      (0.0, 1.0, 2.0),
    +      (0.0, 1.0, 3.0),
    +      (0.0, 2.0, 4.0),
    +      (0.0, 2.0, 4.0),
    +      (1.0, 2.0, 5.0),
    +      (1.0, 2.0, 5.0),
    +      (1.0, 2.0, 5.0),
    +      (1.0, 3.0, 6.0),
    +      (1.0, 3.0, 6.0),
    +      (1.0, 3.0, 7.0),
    +      (1.0, 4.0, 8.0),
    +      (1.0, 4.0, 8.0),
    +      (1.0, 4.0, 9.0),
    +      (1.0, 4.0, 9.0),
    +      (1.0, 4.0, 9.0)
    +      ).toDF("result1", "result2", "result3")
    +        .collect().toSeq
    --- End diff --
    
    What about use:
    ```
    val expected = plForSingleCol.transform(df).select("result1", "result2", 
"result3").collect()
    ```
    So that avoid hardcoding the big array.


---

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

Reply via email to