Created
May 14, 2019 12:31
-
-
Save pulsation/d70d923fc72bc04af844eaf5a7271010 to your computer and use it in GitHub Desktop.
addFile test in spark2 shell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.spark.SparkFiles | |
import org.apache.spark.SparkContext | |
val context = spark.sparkContext | |
val fileName = "file.csv" | |
val fetchedFile = context.addFile(s"ftp://my-ftp-server.net/$fileName") | |
val readFile = context.textFile(SparkFiles.get(fileName)).collect() | |
readFile.foreach(println) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment