use of org.neo4j.unsafe.impl.batchimport.Configuration.Default in project neo4j by neo4j.
the class QuickImport method main.
public static void main(String[] arguments) throws IOException {
Args args = Args.parse(arguments);
long nodeCount = parseLongWithUnit(args.get("nodes", null));
long relationshipCount = parseLongWithUnit(args.get("relationships", null));
int labelCount = args.getNumber("labels", 4).intValue();
int relationshipTypeCount = args.getNumber("relationship-types", 4).intValue();
File dir = new File(args.get(ImportTool.Options.STORE_DIR.key()));
long randomSeed = args.getNumber("random-seed", currentTimeMillis()).longValue();
Configuration config = COMMAS;
Extractors extractors = new Extractors(config.arrayDelimiter());
IdType idType = IdType.valueOf(args.get("id-type", IdType.ACTUAL.name()));
Header nodeHeader = parseNodeHeader(args, idType, extractors);
Header relationshipHeader = parseRelationshipHeader(args, idType, extractors);
FormattedLogProvider sysoutLogProvider = FormattedLogProvider.toOutputStream(System.out);
org.neo4j.unsafe.impl.batchimport.Configuration importConfig = new Default() {
@Override
public int maxNumberOfProcessors() {
return args.getNumber(ImportTool.Options.PROCESSORS.key(), super.maxNumberOfProcessors()).intValue();
}
@Override
public int denseNodeThreshold() {
return args.getNumber(dense_node_threshold.name(), super.denseNodeThreshold()).intValue();
}
};
SimpleDataGenerator generator = new SimpleDataGenerator(nodeHeader, relationshipHeader, randomSeed, nodeCount, labelCount, relationshipTypeCount, idType);
Input input = new DataGeneratorInput(nodeCount, relationshipCount, generator.nodes(), generator.relationships(), idType, silentBadCollector(0));
try (FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction()) {
BatchImporter consumer;
if (args.getBoolean("to-csv")) {
consumer = new CsvOutput(dir, nodeHeader, relationshipHeader, config);
} else {
consumer = new ParallelBatchImporter(dir, fileSystem, importConfig, new SimpleLogService(sysoutLogProvider, sysoutLogProvider), defaultVisible(), Config.defaults());
}
consumer.doImport(input);
}
}
Aggregations