cloud-fan commented on a change in pull request #35041:
URL: https://github.com/apache/spark/pull/35041#discussion_r821441631



##########
File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/aggregate/PercentileSuite.scala
##########
@@ -207,41 +240,49 @@ class PercentileSuite extends SparkFunSuite {
       CreateArray(Seq(0, 0.5, 1).map(Literal(_))))
 
     validPercentages.foreach { percentage =>
-      val percentile1 = new Percentile(child, percentage)
-      assertEqual(percentile1.checkInputDataTypes(), TypeCheckSuccess)
+      Seq(new Percentile(child, percentage),
+        new PercentileDisc(child, percentage)).foreach { percentile =>
+        assertEqual(percentile.checkInputDataTypes(), TypeCheckSuccess)
+      }
     }
 
     val invalidPercentages = Seq(Literal(-0.5), Literal(1.5), Literal(2D),
       CreateArray(Seq(-0.5, 0, 2).map(Literal(_))))
 
     invalidPercentages.foreach { percentage =>
-      val percentile2 = new Percentile(child, percentage)
-      assertEqual(percentile2.checkInputDataTypes(),
-        TypeCheckFailure(s"Percentage(s) must be between 0.0 and 1.0, " +
-        s"but got ${percentage.simpleString(100)}"))
+      Seq(new Percentile(child, percentage),
+        new PercentileDisc(child, percentage)).foreach { percentile =>

Review comment:
       We can have a small method like
   ```
   def withPercentiles(child: Expression, percentage)(f: PercentileBase => 
Unit) {
     Seq(new Percentile(child, percentage), ...).foreach...
   }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to