BootstrapEntry bootstrap,
ClassDefinition classDefinition,
List<Expression> projections,
IdentityHashMap<Expression, Type> expressionTypes)
{
MethodDefinition filterAndProjectMethod = classDefinition.declareMethod(new CompilerContext(bootstrap.getBootstrapMethod()),
a(PUBLIC),
"filterAndProjectRowOriented",
type(void.class),
arg("page", com.facebook.presto.operator.Page.class),
arg("pageBuilder", PageBuilder.class));
CompilerContext compilerContext = filterAndProjectMethod.getCompilerContext();
LocalVariableDefinition positionVariable = compilerContext.declareVariable(int.class, "position");
LocalVariableDefinition rowsVariable = compilerContext.declareVariable(int.class, "rows");
filterAndProjectMethod.getBody()
.comment("int rows = page.getPositionCount();")
.getVariable("page")
.invokeVirtual(com.facebook.presto.operator.Page.class, "getPositionCount", int.class)
.putVariable(rowsVariable);
List<LocalVariableDefinition> cursorVariables = new ArrayList<>();
int channels = getMaxInputChannel(expressionTypes) + 1;
for (int i = 0; i < channels; i++) {
LocalVariableDefinition cursorVariable = compilerContext.declareVariable(BlockCursor.class, "cursor_" + i);
cursorVariables.add(cursorVariable);
filterAndProjectMethod.getBody()
.comment("BlockCursor %s = page.getBlock(%s).cursor();", cursorVariable.getName(), i)
.getVariable("page")
.push(i)