Dr Mich Talebzadeh
Disclaimer: Use it at your own risk. Any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on this email's technical content is explicitly disclaimed. The author will in no case be liable for any monetary damages arising from such loss, damage or destruction.
Try like this:val primitiveDS = spark.sql("select 1.2 avg ,2.3 stddev").collect().apply(0)val arr = Array(primitiveDS.getDecimal(0), primitiveDS.getDecimal(1))primitiveDS: org.apache.spark.sql.Row = [1.2,2.3] arr: Array[java.math.BigDecimal] = Array(1.2, 2.3)