Github user wzhfy commented on the issue:
https://github.com/apache/spark/pull/19406
@srowen I tried your way on my laptop, it works fine. But an existing test
case failed: (500 expected , 499 returned)
```
test("percentile_approx, supports constant folding for parameter accuracy
and percentages") {
withTempView(table) {
(1 to 1000).toDF("col").createOrReplaceTempView(table)
checkAnswer(
spark.sql(s"SELECT percentile_approx(col, array(0.25 + 0.25D), 200
+ 800D) FROM $table"),
Row(Seq(500D))
)
}
}
```
It seems to me both way (rounding targetError and starting from 1/ not
rounding targetError and starting from 0) can get the answer within relative
error. One way is more accurate in some cases, and the other is more accurate
in some other cases.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]