use of org.neo4j.internal.batchimport.input.Distribution in project neo4j by neo4j.
the class CsvInputEstimateCalculationIT method generateData.
private DataFactory generateData(Header.Factory factory, MutableLong start, long count, long nodeCount, String headerString, String fileName, Groups groups) throws IOException {
Path file = testDirectory.file(fileName);
Header header = factory.create(charSeeker(wrap(headerString), COMMAS, false), COMMAS, IdType.INTEGER, groups);
Distribution<String> distribution = new Distribution<>(new String[] { "Token" });
Deserialization<String> deserialization = new StringDeserialization(COMMAS);
try (PrintWriter out = new PrintWriter(Files.newBufferedWriter(file));
RandomEntityDataGenerator generator = new RandomEntityDataGenerator(nodeCount, count, toIntExact(count), random.seed(), start.longValue(), header, distribution, distribution, 0, 0, 5);
InputChunk chunk = generator.newChunk();
InputEntity entity = new InputEntity()) {
out.println(headerString);
while (generator.next(chunk)) {
while (chunk.next(entity)) {
out.println(convert(entity, deserialization, header));
}
}
}
start.add(count);
return DataFactories.data(InputEntityDecorators.NO_DECORATOR, StandardCharsets.UTF_8, file);
}
Aggregations