I want to run queries on Apache Phoenix which has a JDBC driver. The query
that I want to run is:
select ts,ename from random_data_date limit 10
But I'm having issues with the JdbcRDD upper and lowerBound parameters
(that I don't actually understand).
Here's what I have so far:
import org.apache.spark.rdd.JdbcRDD
import java.sql.{Connection, DriverManager, ResultSet}
val url="jdbc:phoenix:zookeeper"
val sql = "select ts,ename from random_data_date limit ?"
val myRDD = new JdbcRDD(sc, () => DriverManager.getConnection(url), sql, 5,
10, 2, r => r.getString("ts") + ", " + r.getString("ename"))
But this doesn't work because the sql expression that the JdbcRDD expects
has to have two ?s to represent the lower and upper bound.
How can I run my query through the JdbcRDD?
Regards,
Alaa Ali