use of org.embulk.spi.SchemaConfigException in project embulk by embulk.
the class TestRenameFilterPlugin method throwSchemaConfigExceptionIfColumnNotFound.
@Test
public void throwSchemaConfigExceptionIfColumnNotFound() {
ConfigSource pluginConfig = Exec.newConfigSource().set("columns", ImmutableMap.of("not_found", "any_name"));
try {
filter.transaction(pluginConfig, SCHEMA, new FilterPlugin.Control() {
public void run(TaskSource task, Schema schema) {
}
});
fail();
} catch (Throwable t) {
assertTrue(t instanceof SchemaConfigException);
}
}
use of org.embulk.spi.SchemaConfigException in project embulk by embulk.
the class RemoveColumnsFilterPlugin method getExistentColumns.
private List<String> getExistentColumns(Schema schema, List<String> specifiedColumns, boolean acceptUnmatch) {
ImmutableList.Builder<String> existentColumns = ImmutableList.builder();
for (String column : specifiedColumns) {
try {
schema.lookupColumn(column);
existentColumns.add(column);
} catch (SchemaConfigException e) {
if (!acceptUnmatch) {
throw new ConfigException(String.format(ENGLISH, "Column '%s' doesn't exist in the schema", column));
}
}
}
return existentColumns.build();
}
Aggregations