Github user MLnick commented on the issue:

    https://github.com/apache/spark/pull/16971
  
    Yes my point was returning null is not very idiomatic in Scala. Better to
    return Option or empty collection. Option doesn't work for Java compat, so
    empty Array is best in this case I believe.
    
    +1 for empty Array and if we can return the quantiles for the non-empty /
    non-NaN cols as per your suggestion that is ideal.
    On Thu, 23 Feb 2017 at 08:12, Ruifeng Zheng <[email protected]>
    wrote:
    
    > @thunterdb <https://github.com/thunterdb> Good point. I will check the
    > sampled in def query.
    >
    > @MLnick <https://github.com/MLnick> @gatorsmile
    > <https://github.com/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())
    >
    > —
    > You are receiving this because you were mentioned.
    > Reply to this email directly, view it on GitHub
    > <https://github.com/apache/spark/pull/16971#issuecomment-281904333>, or 
mute
    > the thread
    > 
<https://github.com/notifications/unsubscribe-auth/AA_SB04fXTwOGec3BqPZ06w9F6ps-hTxks5rfSNLgaJpZM4MD1Gt>
    > .
    >



---
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