src/main/java/org/embulk/formatter/avro/AvroFormatterPlugin.java in embulk-formatter-avro-0.1.0 vs src/main/java/org/embulk/formatter/avro/AvroFormatterPlugin.java in embulk-formatter-avro-0.1.1
- old
+ new
@@ -28,12 +28,10 @@
import org.embulk.spi.util.Timestamps;
import org.slf4j.Logger;
import java.io.File;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
import java.util.Map;
public class AvroFormatterPlugin
implements FormatterPlugin
{
@@ -76,11 +74,11 @@
}
control.run(task.dump());
}
- final Logger logger = Exec.getLogger(this.getClass());
+ private final Logger logger = Exec.getLogger(this.getClass());
@Override
public PageOutput open(TaskSource taskSource, final Schema schema,
FileOutput output)
{
@@ -102,11 +100,10 @@
} catch (IOException e) {
throw new ConfigException("avsc file is not found");
}
final AbstractAvroValueConverter[] avroValueConverters = new AbstractAvroValueConverter[schema.size()];
- List<AbstractAvroValueConverter> array = new ArrayList<>();
for (Column c : schema.getColumns()) {
org.apache.avro.Schema.Field field = avroSchema.getField(c.getName());
if (field != null) {
avroValueConverters[c.getIndex()] = AvroValueConverterFactory.createConverter(field);
}
@@ -122,20 +119,9 @@
while (pageReader.nextRecord()) {
GenericRecord record = new GenericData.Record(avroSchema);
try {
schema.visitColumns(new AvroFormatterColumnVisitor(pageReader, timestampFormatters, avroValueConverters, record));
- } catch (RuntimeException ex) {
- if (skipErrorRecord) {
- logger.warn(ex.getMessage());
- logger.warn(String.format("skip record: %s", record));
- continue;
- } else {
- throw ex;
- }
- }
-
- try {
writer.append(record);
} catch (RuntimeException ex) {
if (skipErrorRecord) {
logger.warn(ex.getMessage());
logger.warn(String.format("skip record: %s", record));