Github user zhengruifeng commented on the issue:
https://github.com/apache/spark/pull/16971
@thunterdb Good point. I will check the `sampled` in `def query`.
@MLnick @gatorsmile I perfer empty array as the result for empty dataset or
columns that only contains na.
And, in the case that only some columns only contains na. Current
implementation will return null, and result for all column can not be
obtained. I think the result for common columns should be accessable.
```
val rows = spark.sparkContext.parallelize(Seq(Row(Double.NaN, 1.0,
Double.NaN),
+ Row(1.0, -1.0, null), Row(-1.0, Double.NaN, null), Row(Double.NaN,
Double.NaN, null),
+ Row(null, null, Double.NaN), Row(null, 1.0, null), Row(-1.0, null,
Double.NaN),
+ Row(Double.NaN, null, null)))
val schema = StructType(Seq(StructField("input1", DoubleType, nullable
= true),
+ StructField("input2", DoubleType, nullable = true),
+ StructField("input3", DoubleType, nullable = true)))
val dfNaN = spark.createDataFrame(rows, schema)
val resNaNAll = dfNaN.stat.approxQuantile(Array("input1", "input2",
"input3"),
Array(q1, q2), epsilon)
```
In the returned array, result for columns `input1` and `input2` should be
ok, and result for `input3` is empty. `Array(Array(num1, num2), Array(num3,
num4), Array())`
---
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]