0

I am using property file to pass sql query in spark scala, my property file like this.

spark.query=select '$env' from table_name limit 5

In spark code

val env="dev"
val query=sparkContext.getConf.get("spark.query");

println(query);

spark.sql(s"""$query""");

But here it's not talking value for dev my output is like below:

select $env from table_name =>$env value not populating.

James Z
  • 12,209
  • 10
  • 24
  • 44
User6006
  • 597
  • 4
  • 21
  • 1
    Related question: https://stackoverflow.com/questions/50655112/scala-interpolate-string-from-variable – Shaido Apr 16 '20 at 05:51
  • First, important thing is that you don't need to put a semicolon (;) in Scala – Bob Apr 16 '20 at 14:34

0 Answers0