Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DataFrameReader df = new DataFrameReader(spark).format("csv").option("header", true);
- Dataset<Row> set=df.load("s3n://"+this.accessId.replace(""", "")+":"+this.accessToken.replace(""", "")+"@"+this.bucketName.replace(""", "")+"/"+this.filePath.replace(""", "")+"");
- set.take(500)
- String url ="jdbc:mysql://"+this.hostName+":3306/"+this.dataBaseName+"?user="+this.userName+"&password="+this.password;
- SparkSession spark=StartSpark.getSparkSession();
- SQLContext sc = spark.sqlContext();
- DataFrameReader df = new DataFrameReader(spark).format("csv").option("header", true);
- Dataset<Row> set = sc
- .read()
- .option("url", url)
- .option("dbtable", this.tableName)
- .option("driver","com.mysql.jdbc.Driver")
- .format("jdbc")
- .load();
- set.take(500);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement