use of alluxio.table.common.transform.action.TransformAction in project alluxio by Alluxio.
the class TransformDefinition method parse.
/**
* @param definition the string definition
* @return the {@link TransformDefinition} representation
*/
public static TransformDefinition parse(String definition) {
definition = definition.trim();
if (definition.isEmpty()) {
return new TransformDefinition(definition, Collections.emptyList(), new Properties());
}
// accept semicolon as new lines for inline definitions
definition = definition.replace(";", "\n");
final Properties properties = new Properties();
final StringReader reader = new StringReader(definition);
try {
properties.load(reader);
} catch (IOException e) {
// The only way this throws an IOException is if the definition is null which isn't possible.
return new TransformDefinition(definition, Collections.emptyList(), properties);
}
final List<TransformAction> actions = TransformActionRegistry.create(properties);
return new TransformDefinition(definition, actions, properties);
}
use of alluxio.table.common.transform.action.TransformAction in project alluxio by Alluxio.
the class TransformPlan method computeJobConfigs.
private ArrayList<JobConfig> computeJobConfigs(TransformDefinition definition) {
ArrayList<JobConfig> actions = new ArrayList<>();
Layout baseLayout = mBaseLayout;
boolean deleteSrc = false;
for (TransformAction action : definition.getActions()) {
actions.add(action.generateJobConfig(baseLayout, mTransformedLayout, deleteSrc));
baseLayout = mTransformedLayout;
deleteSrc = true;
}
if (actions.isEmpty()) {
throw new IllegalArgumentException("At least one action should be defined for the transformation");
}
return actions;
}
Aggregations