Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- val conf = new SparkConf().setAppName("MyApp").setMaster("local")
- val sc = new SparkContext(conf)
- val sqlcontext = new org.apache.spark.sql.SQLContext(sc)
- sqlcontext.setConf("url", "mysql://localhost:3306/myDB?user=us&password=pw")
- val action = sqlcontext.jdbc(jdbcUrl, "action").registerTempTable("action")
- val session = sqlcontext.jdbc(jdbcUrl, "session").registerTempTable("session")
- sqlcontext.cacheTable("action")
- sqlcontext.cacheTable("session")
- val data = sqlcontext.sql('SELECT * FROM action INNER JOIN session ON action.session_id = session.session_id")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement