我有一個spark接受值的sql查詢。如何將變量傳遞給SQL字符串
Dataset getQuery = spark.sql("select * from trafficdata where message_time between 1486036800000 and 1486108800000 ")
我想這一次是作爲變量像
Long val1 = 1486036800000
Long val2 = 1486108800000
Dataset getQuery = spark.sql("select * from trafficdata where message_time between $val1 and $val2 ")
我$val1
但它不工作嘗試。任何人都可以建議,如何在java中做到這一點?
的可能的複製(HTTP://計算器。 com/questions/9643610/java-including-variables-within-strings) –