Re: How to retrieve multiple columns values (in one row) to variables in Spark Scala method

2019-04-06 Thread Mich Talebzadeh
Thanks Ayan! Much appreciated your help. Regards, Dr Mich Talebzadeh LinkedIn * https://www.linkedin.com/profile/view?id=AAEWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw * http://talebzadehmich.wordpress.com

Re: How to retrieve multiple columns values (in one row) to variables in Spark Scala method

2019-04-05 Thread ayan guha
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)

How to retrieve multiple columns values (in one row) to variables in Spark Scala method

2019-04-05 Thread Mich Talebzadeh
Hi, Pretty basic question. I use Spark on Hbase to retrieve the last 14 prices average and standard deviation for a security (ticker) from an Hbase table. However, the call is expensive in Spark streaming where these values are used to indicate buy and sell and subsequently the high value