use of org.apache.drill.exec.store.easy.sequencefile.SequenceFileFormatConfig in project drill by axbaretto.
the class StoragePluginTestUtils method configureFormatPlugins.
public static void configureFormatPlugins(StoragePluginRegistry pluginRegistry, String storagePlugin) throws ExecutionSetupException {
FileSystemPlugin fileSystemPlugin = (FileSystemPlugin) pluginRegistry.getPlugin(storagePlugin);
FileSystemConfig fileSystemConfig = (FileSystemConfig) fileSystemPlugin.getConfig();
TextFormatPlugin.TextFormatConfig textConfig = new TextFormatPlugin.TextFormatConfig();
textConfig.extensions = ImmutableList.of("txt");
textConfig.fieldDelimiter = '\u0000';
fileSystemConfig.formats.put("txt", textConfig);
TextFormatPlugin.TextFormatConfig ssvConfig = new TextFormatPlugin.TextFormatConfig();
ssvConfig.extensions = ImmutableList.of("ssv");
ssvConfig.fieldDelimiter = ' ';
fileSystemConfig.formats.put("ssv", ssvConfig);
TextFormatPlugin.TextFormatConfig psvConfig = new TextFormatPlugin.TextFormatConfig();
psvConfig.extensions = ImmutableList.of("tbl");
psvConfig.fieldDelimiter = '|';
fileSystemConfig.formats.put("psv", psvConfig);
SequenceFileFormatConfig seqConfig = new SequenceFileFormatConfig();
seqConfig.extensions = ImmutableList.of("seq");
fileSystemConfig.formats.put("sequencefile", seqConfig);
TextFormatPlugin.TextFormatConfig csvhtestConfig = new TextFormatPlugin.TextFormatConfig();
csvhtestConfig.extensions = ImmutableList.of("csvh-test");
csvhtestConfig.fieldDelimiter = ',';
csvhtestConfig.extractHeader = true;
csvhtestConfig.skipFirstLine = true;
fileSystemConfig.formats.put("csvh-test", csvhtestConfig);
pluginRegistry.createOrUpdate(storagePlugin, fileSystemConfig, true);
}
use of org.apache.drill.exec.store.easy.sequencefile.SequenceFileFormatConfig in project drill by apache.
the class StoragePluginTestUtils method configureFormatPlugins.
public static void configureFormatPlugins(StoragePluginRegistry pluginRegistry, String storagePlugin) throws PluginException {
FileSystemConfig fileSystemConfig = (FileSystemConfig) pluginRegistry.getStoredConfig(storagePlugin);
Map<String, FormatPluginConfig> newFormats = new HashMap<>();
Optional.ofNullable(fileSystemConfig.getFormats()).ifPresent(newFormats::putAll);
newFormats.put("txt", new TextFormatConfig(ImmutableList.of("txt"), null, "\u0000", null, null, null, null, null));
newFormats.put("ssv", new TextFormatConfig(ImmutableList.of("ssv"), null, " ", null, null, null, null, null));
newFormats.put("psv", new TextFormatConfig(ImmutableList.of("tbl"), null, "|", null, null, null, null, null));
SequenceFileFormatConfig seqConfig = new SequenceFileFormatConfig(ImmutableList.of("seq"));
newFormats.put("sequencefile", seqConfig);
newFormats.put("csvh-test", new TextFormatConfig(ImmutableList.of("csvh-test"), null, ",", null, null, null, true, true));
FileSystemConfig newFileSystemConfig = new FileSystemConfig(fileSystemConfig.getConnection(), fileSystemConfig.getConfig(), fileSystemConfig.getWorkspaces(), newFormats, PlainCredentialsProvider.EMPTY_CREDENTIALS_PROVIDER);
newFileSystemConfig.setEnabled(fileSystemConfig.isEnabled());
pluginRegistry.put(storagePlugin, newFileSystemConfig);
}
Aggregations