use of com.questdb.parser.plaintext.PlainTextStoringParser in project questdb by bluestreak01.
the class ImportManager method importFile.
public static void importFile(Factory factory, String fileName, char delimiter, CharSequence schema, int sampleSize, boolean forceHeader) throws IOException {
BootstrapEnv env = new BootstrapEnv();
env.typeProbeCollection = new TypeProbeCollection();
env.configuration = new ServerConfiguration();
env.factory = factory;
try (PlainTextLexer parser = new PlainTextLexer(env).of(delimiter)) {
File file = new File(fileName);
String location = file.getName();
switch(factory.getConfiguration().exists(location)) {
case JournalConfiguration.EXISTS_FOREIGN:
throw new JournalRuntimeException("A foreign file/directory already exists: " + (new File(factory.getConfiguration().getJournalBase(), location)));
default:
try (PlainTextStoringParser l = new PlainTextStoringParser(env).of(location, false, false, PlainTextStoringParser.ATOMICITY_RELAXED)) {
analyzeAndParse(file, parser, l, schema, sampleSize, forceHeader);
}
break;
}
}
}
Aggregations