Source:
private void generatePositionNotDistinctFromRowWithPageMethod( ClassDefinition classDefinition, CallSiteBinder callSiteBinder, List<Type> joinChannelTypes, List<FieldDefinition> joinChannelFields) { Parameter leftBlockIndex = arg("leftBlockIndex", int.class); Parameter leftBlockPosition = arg("leftBlockPosition", int.class); Parameter rightPosition = arg("rightPosition", int.class); Parameter page = arg("page", Page.class); Parameter rightChannels = arg("rightChannels", int[].class); MethodDefinition positionNotDistinctFromRowMethod = classDefinition.declareMethod( a(PUBLIC), "positionNotDistinctFromRow", type(boolean.class), leftBlockIndex, leftBlockPosition, rightPosition, page, rightChannels); Variable thisVariable = positionNotDistinctFromRowMethod.getThis(); Scope scope = positionNotDistinctFromRowMethod.getScope(); BytecodeBlock body = positionNotDistinctFromRowMethod.getBody(); scope.declareVariable("wasNull", body, constantFalse()); for (int index = 0; index < joinChannelTypes.size(); index++) { BytecodeExpression leftBlock = thisVariable .getField(joinChannelFields.get(index)) .invoke("get", Object.class, leftBlockIndex) .cast(Block.class); BytecodeExpression rightBlock = page.invoke("getBlock", Block.class, rightChannels.getElement(index)); Type type = joinChannelTypes.get(index); ScalarFunctionImplementation operator = operators.getUnchecked(type); Binding binding = callSiteBinder.bind(operator.getMethodHandle()); List<BytecodeNode> argumentsBytecode = new ArrayList<>(); argumentsBytecode.add(generateArgument(callSiteBinder, scope, type, leftBlock, leftBlockPosition)); argumentsBytecode.add(generateArgument(callSiteBinder, scope, type, rightBlock, rightPosition)); BytecodeNode isDistinctFrom = BytecodeUtils.generateInvocation(scope, "isDistinctFrom", operator, Optional.empty(), argumentsBytecode, binding); body.append(new IfStatement() .condition(isDistinctFrom) .ifTrue(constantFalse().ret())); } body.append(constantTrue().ret()); }

Target:
private void generatePositionNotDistinctFromRowWithPageMethod( ClassDefinition classDefinition, CallSiteBinder callSiteBinder, List<Type> joinChannelTypes, List<FieldDefinition> joinChannelFields) { Parameter leftBlockIndex = arg("leftBlockIndex", int.class); Parameter leftBlockPosition = arg("leftBlockPosition", int.class); Parameter rightPosition = arg("rightPosition", int.class); Parameter page = arg("page", Page.class); Parameter rightChannels = arg("rightChannels", int[].class); MethodDefinition positionNotDistinctFromRowMethod = classDefinition.declareMethod( a(PUBLIC), "positionNotDistinctFromRow", type(boolean.class), leftBlockIndex, leftBlockPosition, rightPosition, page, rightChannels); Variable thisVariable = positionNotDistinctFromRowMethod.getThis(); Scope scope = positionNotDistinctFromRowMethod.getScope(); BytecodeBlock body = positionNotDistinctFromRowMethod.getBody(); if (groupByUsesEqualTo) { body.append(thisVariable.invoke( "positionEqualsRow", boolean.class, leftBlockIndex, leftBlockPosition, rightPosition, page, rightChannels).ret()); return; } scope.declareVariable("wasNull", body, constantFalse()); for (int index = 0; index < joinChannelTypes.size(); index++) { BytecodeExpression leftBlock = thisVariable .getField(joinChannelFields.get(index)) .invoke("get", Object.class, leftBlockIndex) .cast(Block.class); BytecodeExpression rightBlock = page.invoke("getBlock", Block.class, rightChannels.getElement(index)); Type type = joinChannelTypes.get(index); ScalarFunctionImplementation operator = getOperator(type); Binding binding = callSiteBinder.bind(operator.getMethodHandle()); List<BytecodeNode> argumentsBytecode = new ArrayList<>(); argumentsBytecode.add(generateInputReference(callSiteBinder, scope, type, leftBlock, leftBlockPosition)); argumentsBytecode.add(generateInputReference(callSiteBinder, scope, type, rightBlock, rightPosition)); body.append(new IfStatement() .condition(BytecodeUtils.generateInvocation(scope, "isDistinctFrom", operator, Optional.empty(), argumentsBytecode, binding)) .ifTrue(constantFalse().ret())); } body.append(constantTrue().ret()); }