dynamically bind variable/parameter in Spark SQL?

后端 未结 4 704
情深已故
情深已故 2020-12-31 05:38

How to bind variable in Apache Spark SQL? For example:

val sqlContext = new org.apache.spark.sql.hive.HiveContext(sc)
sqlContext.sql(\"SELECT * FROM src WHE         


        
4条回答
  •  醉梦人生
    2020-12-31 05:54

    Try These

    sqlContext.sql(s"SELECT * FROM src WHERE col1 = '${VAL1}'").collect().foreach(println)
    

提交回复
热议问题