Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %dep
- z.load("/home/vagrant/mysql-connector-java-5.1.6.jar")
- sc.version
- import org.apache.spark.sql.DataFrame
- def selectAll (table :String ) :DataFrame = {
- (sqlContext.read.format("jdbc")
- .option("url", "jdbc:mysql://172.16.235.242:8889/Kokoroe")
- .option("driver", "com.mysql.jdbc.Driver")
- .option("dbtable", table)
- .option("user", "root").load())
- }
- val courses = (sqlContext.read.format("jdbc")
- .option("url", "jdbc:mysql://172.16.235.242:8889/Kokoroe")
- .option("driver", "com.mysql.jdbc.Driver")
- .option("dbtable", "courses")
- .option("user", "root").load())
- val translation = selectAll("courses_translations")
- val coursesDesc = courses.join(translation, courses("id") === translation("course_id"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement