Source:
public int[] findJoinPositions(int probePosition, Page probe, int probeGeometryChannel, Optional<Integer> probePartitionChannel) { Block probeGeometryBlock = probe.getBlock(probeGeometryChannel); if (probeGeometryBlock.isNull(probePosition)) { return EMPTY_ADDRESSES; } int probePartition = probePartitionChannel.map(channel -> toIntExact(INTEGER.getLong(probe.getBlock(channel), probePosition))).orElse(-1); Slice slice = probeGeometryBlock.getSlice(probePosition, 0, probeGeometryBlock.getSliceLength(probePosition)); OGCGeometry probeGeometry = deserialize(slice); verify(probeGeometry != null); if (probeGeometry.isEmpty()) { return EMPTY_ADDRESSES; } boolean probeIsPoint = probeGeometry instanceof OGCPoint; IntArrayList matchingPositions = new IntArrayList(); Rectangle queryRect = GeometryUtils.getExtent(probeGeometry); rtree.findIntersections(queryRect, item -> { GeometryWithPosition geometryWithPosition = (GeometryWithPosition) item; OGCGeometry buildGeometry = geometryWithPosition.getGeometry(); if (partitions.isEmpty() || (probePartition == geometryWithPosition.getPartition() && (probeIsPoint || (buildGeometry instanceof OGCPoint) || testReferencePoint(queryRect, buildGeometry, probePartition)))) { if (radiusChannel == -1) { if (spatialRelationshipTest.apply(buildGeometry, probeGeometry, OptionalDouble.empty())) { matchingPositions.add(geometryWithPosition.getPosition()); } } else { if (spatialRelationshipTest.apply(geometryWithPosition.getGeometry(), probeGeometry, OptionalDouble.of(getRadius(geometryWithPosition.getPosition())))) { matchingPositions.add(geometryWithPosition.getPosition()); } } } }); return matchingPositions.toIntArray(null); }

Target:
public int[] findJoinPositions(int probePosition, Page probe, int probeGeometryChannel, Optional<Integer> probePartitionChannel) { Block probeGeometryBlock = probe.getBlock(probeGeometryChannel); if (probeGeometryBlock.isNull(probePosition)) { return EMPTY_ADDRESSES; } int probePartition = probePartitionChannel.map(channel -> toIntExact(INTEGER.getLong(probe.getBlock(channel), probePosition))).orElse(-1); Slice slice = probeGeometryBlock.getSlice(probePosition, 0, probeGeometryBlock.getSliceLength(probePosition)); OGCGeometry probeGeometry = deserialize(slice); verify(probeGeometry != null); if (probeGeometry.isEmpty()) { return EMPTY_ADDRESSES; } boolean probeIsPoint = probeGeometry instanceof OGCPoint; IntArrayList matchingPositions = new IntArrayList(); Rectangle queryRectangle = getExtent(probeGeometry); rtree.findIntersections(queryRectangle, geometryWithPosition -> { OGCGeometry buildGeometry = geometryWithPosition.getGeometry(); if (partitions.isEmpty() || (probePartition == geometryWithPosition.getPartition() && (probeIsPoint || (buildGeometry instanceof OGCPoint) || testReferencePoint(queryRectangle, buildGeometry, probePartition)))) { if (radiusChannel == -1) { if (spatialRelationshipTest.apply(buildGeometry, probeGeometry, OptionalDouble.empty())) { matchingPositions.add(geometryWithPosition.getPosition()); } } else { if (spatialRelationshipTest.apply(geometryWithPosition.getGeometry(), probeGeometry, OptionalDouble.of(getRadius(geometryWithPosition.getPosition())))) { matchingPositions.add(geometryWithPosition.getPosition()); } } } }); return matchingPositions.toIntArray(null); }