2013-01-21 19:42:24 -05:00
|
|
|
package spark;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
|
|
|
/**
|
2013-01-23 13:36:18 -05:00
|
|
|
* Resolves paths to files added through `SparkContext.addFile()`.
|
2013-01-21 19:42:24 -05:00
|
|
|
*/
|
|
|
|
public class SparkFiles {
|
|
|
|
|
|
|
|
private SparkFiles() {}
|
|
|
|
|
|
|
|
/**
|
2013-01-23 13:36:18 -05:00
|
|
|
* Get the absolute path of a file added through `SparkContext.addFile()`.
|
2013-01-21 19:42:24 -05:00
|
|
|
*/
|
|
|
|
public static String get(String filename) {
|
|
|
|
return new File(getRootDirectory(), filename).getAbsolutePath();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-01-23 13:36:18 -05:00
|
|
|
* Get the root directory that contains files added through `SparkContext.addFile()`.
|
2013-01-21 19:42:24 -05:00
|
|
|
*/
|
|
|
|
public static String getRootDirectory() {
|
|
|
|
return SparkEnv.get().sparkFilesDir();
|
|
|
|
}
|
2013-01-23 13:36:18 -05:00
|
|
|
}
|