/** Marks bits for the ords (points) that belong in the right sub tree (those docs that have values >= the splitValue). */ private byte[] markRightTree(long rightCount, int splitDim, PathSlice source, LongBitSet ordBitSet) throws IOException { // Now we mark ords that fall into the right half, so we can partition on all other dims that are not the split dim: // Read the split value, then mark all ords in the right tree (larger than the split value): // TODO: find a way to also checksum this reader? If we changed to markLeftTree, and scanned the final chunk, it could work? try (PointReader reader = source.writer.getReader(source.start + source.count - rightCount, rightCount)) { boolean result = reader.next(); assert result: "rightCount=" + rightCount + " source.count=" + source.count + " source.writer=" + source.writer; System.arraycopy(reader.packedValue(), splitDim*bytesPerDim, scratch1, 0, bytesPerDim); if (numDataDims > 1) { assert ordBitSet.get(reader.ord()) == false; ordBitSet.set(reader.ord()); // Subtract 1 from rightCount because we already did the first value above (so we could record the split value): reader.markOrds(rightCount-1, ordBitSet); } } catch (Throwable t) { throw verifyChecksum(t, source.writer); } return scratch1; }
/** Marks bits for the ords (points) that belong in the right sub tree (those docs that have values >= the splitValue). */ private byte[] markRightTree(long rightCount, int splitDim, PathSlice source, LongBitSet ordBitSet) throws IOException { // Now we mark ords that fall into the right half, so we can partition on all other dims that are not the split dim: // Read the split value, then mark all ords in the right tree (larger than the split value): // TODO: find a way to also checksum this reader? If we changed to markLeftTree, and scanned the final chunk, it could work? try (PointReader reader = source.writer.getReader(source.start + source.count - rightCount, rightCount)) { boolean result = reader.next(); assert result; System.arraycopy(reader.packedValue(), splitDim*bytesPerDim, scratch1, 0, bytesPerDim); if (numDataDims > 1) { assert ordBitSet.get(reader.ord()) == false; ordBitSet.set(reader.ord()); // Subtract 1 from rightCount because we already did the first value above (so we could record the split value): reader.markOrds(rightCount-1, ordBitSet); } } catch (Throwable t) { throw verifyChecksum(t, source.writer); } return scratch1; }
/** Marks bits for the ords (points) that belong in the right sub tree (those docs that have values >= the splitValue). */ private byte[] markRightTree(long rightCount, int splitDim, PathSlice source, LongBitSet ordBitSet) throws IOException { // Now we mark ords that fall into the right half, so we can partition on all other dims that are not the split dim: // Read the split value, then mark all ords in the right tree (larger than the split value): // TODO: find a way to also checksum this reader? If we changed to markLeftTree, and scanned the final chunk, it could work? try (PointReader reader = source.writer.getReader(source.start + source.count - rightCount, rightCount)) { boolean result = reader.next(); assert result: "rightCount=" + rightCount + " source.count=" + source.count + " source.writer=" + source.writer; System.arraycopy(reader.packedValue(), splitDim*bytesPerDim, scratch1, 0, bytesPerDim); if (numDataDims > 1) { assert ordBitSet.get(reader.ord()) == false; ordBitSet.set(reader.ord()); // Subtract 1 from rightCount because we already did the first value above (so we could record the split value): reader.markOrds(rightCount-1, ordBitSet); } } catch (Throwable t) { throw verifyChecksum(t, source.writer); } return scratch1; }