Search in sources :

Example 1 with LocalFsFileInputFactory

use of io.crate.execution.engine.collect.files.LocalFsFileInputFactory in project crate by crate.

the class CsvReaderBenchmark method measureFileReadingIteratorForCSV.

@Benchmark()
public void measureFileReadingIteratorForCSV(Blackhole blackhole) {
    Reference raw = createReference("_raw", DataTypes.STRING);
    InputFactory.Context<LineCollectorExpression<?>> ctx = inputFactory.ctxForRefs(txnCtx, FileLineReferenceResolver::getImplementation);
    List<Input<?>> inputs = Collections.singletonList(ctx.add(raw));
    BatchIterator<Row> batchIterator = FileReadingIterator.newInstance(Collections.singletonList(fileUri), inputs, ctx.expressions(), null, Map.of(LocalFsFileInputFactory.NAME, new LocalFsFileInputFactory()), false, 1, 0, CopyFromParserProperties.DEFAULT, CSV, Settings.EMPTY);
    while (batchIterator.moveNext()) {
        blackhole.consume(batchIterator.currentElement().get(0));
    }
}
Also used : LocalFsFileInputFactory(io.crate.execution.engine.collect.files.LocalFsFileInputFactory) InputFactory(io.crate.expression.InputFactory) Input(io.crate.data.Input) LineCollectorExpression(io.crate.execution.engine.collect.files.LineCollectorExpression) LocalFsFileInputFactory(io.crate.execution.engine.collect.files.LocalFsFileInputFactory) FileLineReferenceResolver(io.crate.expression.reference.file.FileLineReferenceResolver) Reference(io.crate.metadata.Reference) Row(io.crate.data.Row) Benchmark(org.openjdk.jmh.annotations.Benchmark)

Example 2 with LocalFsFileInputFactory

use of io.crate.execution.engine.collect.files.LocalFsFileInputFactory in project crate by crate.

the class JsonReaderBenchmark method measureFileReadingIteratorForJson.

@Benchmark()
public void measureFileReadingIteratorForJson(Blackhole blackhole) {
    Reference raw = createReference("_raw", DataTypes.STRING);
    InputFactory.Context<LineCollectorExpression<?>> ctx = inputFactory.ctxForRefs(txnCtx, FileLineReferenceResolver::getImplementation);
    List<Input<?>> inputs = Collections.singletonList(ctx.add(raw));
    BatchIterator<Row> batchIterator = FileReadingIterator.newInstance(Collections.singletonList(fileUri), inputs, ctx.expressions(), null, Map.of(LocalFsFileInputFactory.NAME, new LocalFsFileInputFactory()), false, 1, 0, CopyFromParserProperties.DEFAULT, JSON, Settings.EMPTY);
    while (batchIterator.moveNext()) {
        blackhole.consume(batchIterator.currentElement().get(0));
    }
}
Also used : LocalFsFileInputFactory(io.crate.execution.engine.collect.files.LocalFsFileInputFactory) InputFactory(io.crate.expression.InputFactory) Input(io.crate.data.Input) LineCollectorExpression(io.crate.execution.engine.collect.files.LineCollectorExpression) LocalFsFileInputFactory(io.crate.execution.engine.collect.files.LocalFsFileInputFactory) FileLineReferenceResolver(io.crate.expression.reference.file.FileLineReferenceResolver) Reference(io.crate.metadata.Reference) Row(io.crate.data.Row) Benchmark(org.openjdk.jmh.annotations.Benchmark)

Aggregations

Input (io.crate.data.Input)2 Row (io.crate.data.Row)2 LineCollectorExpression (io.crate.execution.engine.collect.files.LineCollectorExpression)2 LocalFsFileInputFactory (io.crate.execution.engine.collect.files.LocalFsFileInputFactory)2 InputFactory (io.crate.expression.InputFactory)2 FileLineReferenceResolver (io.crate.expression.reference.file.FileLineReferenceResolver)2 Reference (io.crate.metadata.Reference)2 Benchmark (org.openjdk.jmh.annotations.Benchmark)2