use of io.ordinate.engine.builder.ExecuteCompiler in project Mycat2 by MyCATApache.
the class CsvScanTest method baseTest.
// @Test
@SneakyThrows
public void baseTest() {
Path path = Paths.get("D:\\testcsv.csv");
//
// CsvWriter writer = new CsvWriter(path.toFile(), new CsvWriterSettings());
// for (int i = 0; i < 800_0000; i++) {
// writer.writeRow(Arrays.asList(i,i));
// }
// writer.close();
StopWatch stopWatch = new StopWatch();
ExecuteCompiler executeCompiler = new ExecuteCompiler();
CsvScanPlan csvScan = new ValuesCsvScanPlan(path.toString(), SchemaBuilder.ofArrowType(ArrowTypes.INT64_TYPE, ArrowTypes.STRING_TYPE).toArrow(), executeCompiler.createRootContext());
Function column = executeCompiler.column(0, csvScan.schema());
Function add = executeCompiler.call("+", Arrays.asList(column, column));
RootContext rootContext = executeCompiler.createRootContext();
PhysicalPlan projection = executeCompiler.project(csvScan, Arrays.asList(add));
for (int i = 0; i < 100; i++) {
stopWatch.reset();
stopWatch.start();
Observable<VectorSchemaRoot> execute = projection.execute(rootContext);
AtomicLong count = new AtomicLong(0);
execute.blockingLatest().forEach(c -> {
count.getAndAdd(c.getRowCount());
c.close();
});
stopWatch.stop();
System.out.println("count:" + count);
Duration duration = Duration.ofMillis(stopWatch.getTime());
System.out.println(duration.getSeconds());
System.out.println(stopWatch.toString());
}
//
// Thread.sleep(100000000);
}
Aggregations