public class SamplePathFilter
extends org.apache.hadoop.conf.Configured
implements org.apache.hadoop.fs.PathFilter
Constructor and Description |
---|
SamplePathFilter() |
Modifier and Type | Method and Description |
---|---|
boolean |
accept(org.apache.hadoop.fs.Path path) |
static boolean |
isFile(org.apache.hadoop.fs.Path path) |
scala.util.Random |
random() |
static String |
ratioParam() |
double |
sampleRatio() |
static String |
seedParam() |
void |
setConf(org.apache.hadoop.conf.Configuration conf) |
static <T> T |
withPathFilter(double sampleRatio,
SparkSession spark,
long seed,
scala.Function0<T> f)
Sets the HDFS PathFilter flag and then restores it.
|
public static String ratioParam()
public static String seedParam()
public static boolean isFile(org.apache.hadoop.fs.Path path)
public static <T> T withPathFilter(double sampleRatio, SparkSession spark, long seed, scala.Function0<T> f)
sampleRatio
- Fraction of the files that the filter picksspark
- Existing Spark sessionseed
- Random number seedf
- The function to evaluate after setting the flagpublic scala.util.Random random()
public double sampleRatio()
public void setConf(org.apache.hadoop.conf.Configuration conf)
setConf
in interface org.apache.hadoop.conf.Configurable
setConf
in class org.apache.hadoop.conf.Configured
public boolean accept(org.apache.hadoop.fs.Path path)
accept
in interface org.apache.hadoop.fs.PathFilter