I ma using some code to get adouble array from an item in dataframe
val ratio1=hiveContext.sql("SELECT percentile_approx(ts, array (0.5,0.7)) from df")
val trainingPoint=ratio1.collect()(0).getAs[Array[Double]](0)(0)
val validationPoint=ratio1.collect()(0).getAs[Array[Double]](0)(1)
System.out.print("The training set from hive is :")
ratio1.show(false)
the dataframe is as follow:
The training set from hive is :+----------+
|_c0 |
+----------+
|[5.0, 7.0]|
+----------+
so I need to get the two double points
but I get below error
17/05/08 09:10:32 ERROR ApplicationMaster: User class threw exception: java.lang.ClassCastException: scala.collection.mutable.WrappedArray$ofRef cannot be cast to [D
java.lang.ClassCastException: scala.collection.mutable.WrappedArray$ofRef cannot be cast to [D
at testCase$.main(testCase.scala:40)
at testCase.main(testCase.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.spark.deploy.yarn.ApplicationMaster$$anon$2.run(ApplicationMaster.scala:559)
I want to know how to get the two double points from above dataframe?