[HUDI-1137] Add option to configure different path selector
This commit is contained in:
@@ -352,12 +352,17 @@ public class UtilHelpers {
|
||||
}
|
||||
}
|
||||
|
||||
public static DFSPathSelector createSourceSelector(String sourceSelectorClass, TypedProperties props,
|
||||
public static DFSPathSelector createSourceSelector(TypedProperties props,
|
||||
Configuration conf) throws IOException {
|
||||
String sourceSelectorClass =
|
||||
props.getString(DFSPathSelector.Config.SOURCE_INPUT_SELECTOR, DFSPathSelector.class.getName());
|
||||
try {
|
||||
return (DFSPathSelector) ReflectionUtils.loadClass(sourceSelectorClass,
|
||||
DFSPathSelector selector = (DFSPathSelector) ReflectionUtils.loadClass(sourceSelectorClass,
|
||||
new Class<?>[]{TypedProperties.class, Configuration.class},
|
||||
props, conf);
|
||||
|
||||
LOG.info("Using path selector " + selector.getClass().getName());
|
||||
return selector;
|
||||
} catch (Throwable e) {
|
||||
throw new IOException("Could not load source selector class " + sourceSelectorClass, e);
|
||||
}
|
||||
|
||||
@@ -47,8 +47,7 @@ public class AvroDFSSource extends AvroSource {
|
||||
SchemaProvider schemaProvider) throws IOException {
|
||||
super(props, sparkContext, sparkSession, schemaProvider);
|
||||
this.pathSelector = UtilHelpers
|
||||
.createSourceSelector(DFSPathSelector.class.getName(), props, sparkContext
|
||||
.hadoopConfiguration());
|
||||
.createSourceSelector(props, sparkContext.hadoopConfiguration());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -52,6 +52,7 @@ public class DFSPathSelector {
|
||||
public static class Config {
|
||||
|
||||
public static final String ROOT_INPUT_PATH_PROP = "hoodie.deltastreamer.source.dfs.root";
|
||||
public static final String SOURCE_INPUT_SELECTOR = "hoodie.deltastreamer.source.input.selector";
|
||||
}
|
||||
|
||||
protected static final List<String> IGNORE_FILEPREFIX_LIST = Arrays.asList(".", "_");
|
||||
|
||||
Reference in New Issue
Block a user