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

    https://github.com/apache/spark/pull/22014#discussion_r208091445
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/ApproxCountDistinctForIntervals.scala
 ---
    @@ -67,6 +67,7 @@ case class ApproxCountDistinctForIntervals(
         (endpointsExpression.dataType, endpointsExpression.eval()) match {
           case (ArrayType(elementType, _), arrayData: ArrayData) =>
             arrayData.toObjectArray(elementType).map(_.toString.toDouble)
    +      case _ => throw new RuntimeException("not found at endpoints")
    --- End diff --
    
    Can we do this like:
    
    ```scala
        val endpointsType = endpointsExpression.dataType.asInstanceOf[ArrayType]
        val endpoints = endpointsExpression.eval().asInstanceOf[ArrayData]
        
endpoints.toObjectArray(endpointsType.elementType).map(_.toString.toDouble)
    ```



---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to