本文整理汇总了Java中org.embulk.spi.PageReader.nextRecord方法的典型用法代码示例。如果您正苦于以下问题:Java PageReader.nextRecord方法的具体用法?Java PageReader.nextRecord怎么用?Java PageReader.nextRecord使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.embulk.spi.PageReader
的用法示例。
在下文中一共展示了PageReader.nextRecord方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: filter
import org.embulk.spi.PageReader; //导入方法依赖的package包/类
private List<Object[]> filter(PluginTask task, Schema inputSchema, Object ... objects)
{
TestPageBuilderReader.MockPageOutput output = new TestPageBuilderReader.MockPageOutput();
Schema outputSchema = BuildJsonFilterPlugin.buildOutputSchema(task, inputSchema);
PageBuilder pageBuilder = new PageBuilder(runtime.getBufferAllocator(), outputSchema, output);
PageReader pageReader = new PageReader(inputSchema);
BuildJsonVisitorImpl visitor = new BuildJsonVisitorImpl(task, inputSchema, outputSchema, pageReader, pageBuilder);
List<Page> pages = PageTestUtils.buildPage(runtime.getBufferAllocator(), inputSchema, objects);
for (Page page : pages) {
pageReader.setPage(page);
while (pageReader.nextRecord()) {
outputSchema.visitColumns(visitor);
pageBuilder.addRecord();
}
}
pageBuilder.finish();
pageBuilder.close();
return Pages.toObjects(outputSchema, output.pages);
}
示例2: filter
import org.embulk.spi.PageReader; //导入方法依赖的package包/类
private List<Object[]> filter(PluginTask task, Schema inputSchema, Object ... objects)
{
MockPageOutput output = new MockPageOutput();
Schema outputSchema = ColumnFilterPlugin.buildOutputSchema(task, inputSchema);
PageBuilder pageBuilder = new PageBuilder(runtime.getBufferAllocator(), outputSchema, output);
PageReader pageReader = new PageReader(inputSchema);
ColumnVisitorImpl visitor = new ColumnVisitorImpl(task, inputSchema, outputSchema, pageReader, pageBuilder);
List<Page> pages = PageTestUtils.buildPage(runtime.getBufferAllocator(), inputSchema, objects);
for (Page page : pages) {
pageReader.setPage(page);
while (pageReader.nextRecord()) {
outputSchema.visitColumns(visitor);
pageBuilder.addRecord();
}
}
pageBuilder.finish();
pageBuilder.close();
return Pages.toObjects(outputSchema, output.pages);
}
示例3: testOpen
import org.embulk.spi.PageReader; //导入方法依赖的package包/类
@Test
public void testOpen(final @Mocked PageReader reader, final @Mocked PageBuilder builder, final @Mocked Page page) throws Exception {
new NonStrictExpectations() {{
taskSource.loadTask(PluginTask.class); result = task;
task.getDelimiter(); result = "";
reader.nextRecord(); result = true; result = false;
}};
SpeedometerFilterPlugin plugin = new SpeedometerFilterPlugin();
PageOutput output = plugin.open(taskSource, schema, schema, inPageOutput);
output.add(page);
new Verifications() {{
taskSource.loadTask(PluginTask.class); times = 1;
builder.addRecord(); times = 1;
builder.finish(); times = 0;
reader.nextRecord(); times = 2;
reader.setPage(page); times = 1;
schema.visitColumns(withInstanceOf(ColumnVisitor.class)); times = 1;
}};
}
示例4: buildPageReader
import org.embulk.spi.PageReader; //导入方法依赖的package包/类
private static PageReader buildPageReader(Schema schema, final Object... objects)
{
PageReader pageReader = new PageReader(schema);
List<Page> pages = PageTestUtils.buildPage(runtime.getBufferAllocator(), schema, objects);
for (Page page : pages) {
pageReader.setPage(page);
}
pageReader.nextRecord();
return pageReader;
}
示例5: open
import org.embulk.spi.PageReader; //导入方法依赖的package包/类
@Override
public PageOutput open(final TaskSource taskSource, final Schema inputSchema,
final Schema outputSchema, final PageOutput output)
{
final PluginTask task = taskSource.loadTask(PluginTask.class);
final boolean orCondition = task.getCondition().toLowerCase().equals("or");
final PageReader pageReader = new PageReader(inputSchema);
final PageBuilder pageBuilder = new PageBuilder(Exec.getBufferAllocator(), outputSchema, output);
final AbstractGuardColumnVisitor guradVisitor;
if (task.getWhere().isPresent()) {
ParserExp parserExp = new Parser(inputSchema).parse(task.getWhere().get());
guradVisitor = new GuardColumnVisitorWhereImpl(task, inputSchema, outputSchema, pageReader, parserExp);
}
else if (orCondition) {
guradVisitor = new GuardColumnVisitorOrImpl(task, inputSchema, outputSchema, pageReader);
}
else {
guradVisitor = new GuardColumnVisitorAndImpl(task, inputSchema, outputSchema, pageReader);
}
final BuilderColumnVisitorImpl builderVisitor;
builderVisitor = new BuilderColumnVisitorImpl(task, inputSchema, outputSchema, pageReader, pageBuilder);
return new PageOutput() {
@Override
public void finish()
{
pageBuilder.finish();
}
@Override
public void close()
{
pageBuilder.close();
}
@Override
public void add(Page page)
{
pageReader.setPage(page);
while (pageReader.nextRecord()) {
if (guradVisitor.visitColumns(inputSchema)) {
// output.add(page); did not work, double release() error occurred. We need to copy from reader to builder...
outputSchema.visitColumns(builderVisitor);
pageBuilder.addRecord();
}
}
}
};
}