Search in sources :

Example 1 with DrillTextRecordWriter

use of org.apache.drill.exec.store.text.DrillTextRecordWriter in project drill by apache.

the class TextFormatPlugin method getRecordWriter.

@Override
public RecordWriter getRecordWriter(final FragmentContext context, final EasyWriter writer) throws IOException {
    final Map<String, String> options = Maps.newHashMap();
    options.put("location", writer.getLocation());
    FragmentHandle handle = context.getHandle();
    String fragmentId = String.format("%d_%d", handle.getMajorFragmentId(), handle.getMinorFragmentId());
    options.put("prefix", fragmentId);
    options.put("separator", ((TextFormatConfig) getConfig()).getFieldDelimiterAsString());
    options.put(FileSystem.FS_DEFAULT_NAME_KEY, ((FileSystemConfig) writer.getStorageConfig()).connection);
    options.put("extension", ((TextFormatConfig) getConfig()).getExtensions().get(0));
    RecordWriter recordWriter = new DrillTextRecordWriter(context.getAllocator(), writer.getStorageStrategy());
    recordWriter.init(options);
    return recordWriter;
}
Also used : RecordWriter(org.apache.drill.exec.store.RecordWriter) DrillTextRecordWriter(org.apache.drill.exec.store.text.DrillTextRecordWriter) DrillTextRecordWriter(org.apache.drill.exec.store.text.DrillTextRecordWriter) FragmentHandle(org.apache.drill.exec.proto.ExecProtos.FragmentHandle)

Aggregations

FragmentHandle (org.apache.drill.exec.proto.ExecProtos.FragmentHandle)1 RecordWriter (org.apache.drill.exec.store.RecordWriter)1 DrillTextRecordWriter (org.apache.drill.exec.store.text.DrillTextRecordWriter)1