private void loadVarCharDataAddress() {
   DrillBuf buf = vector.getDataVector().getBuffer();
   checkBuf(buf);
   this.characterData = buf.memoryAddress();
   this.characterDataOriginal = buf.memoryAddress();
   this.characterDataMax = buf.memoryAddress() + buf.capacity();
 }
 private void loadRepeatedOffsetAddress() {
   DrillBuf buf = vector.getOffsetVector().getBuffer();
   checkBuf(buf);
   this.repeatedOffset = buf.memoryAddress() + 4;
   this.repeatedOffsetOriginal = buf.memoryAddress() + 4;
   this.repeatedOffsetMax = buf.memoryAddress() + buf.capacity();
 }
 private void loadVarCharOffsetAddress() {
   DrillBuf buf = vector.getDataVector().getOffsetVector().getBuffer();
   checkBuf(buf);
   this.charLengthOffset = buf.memoryAddress() + 4;
   this.charLengthOffsetOriginal =
       buf.memoryAddress()
           + 4; // add four as offsets conceptually start at 1. (first item is 0..1)
   this.charLengthOffsetMax = buf.memoryAddress() + buf.capacity();
 }
Esempio n. 4
0
 public DrillBuf replace(DrillBuf old, int newSize) {
   if (managedBuffers.remove(old.memoryAddress()) == null) {
     throw new IllegalStateException("Tried to remove unmanaged buffer.");
   }
   old.release(1);
   return getManagedBuffer(newSize);
 }
Esempio n. 5
0
  private DrillBuf(
      BufferAllocator allocator,
      Accountor a,
      ByteBuf replacement,
      DrillBuf buffer,
      int index,
      int length,
      boolean root) {
    super(length);
    if (index < 0 || index > buffer.capacity() - length) {
      throw new IndexOutOfBoundsException(
          buffer.toString() + ".slice(" + index + ", " + length + ')');
    }

    this.length = length;
    writerIndex(length);

    this.b = replacement;
    this.addr = buffer.memoryAddress() + index;
    this.offset = index;
    this.acct = a;
    this.length = length;
    this.rootBuffer = root;
    this.allocator = allocator;
  }
Esempio n. 6
0
  public static long hash64(long start, long end, DrillBuf buffer, long seed) {
    if (BoundsChecking.BOUNDS_CHECKING_ENABLED) {
      buffer.checkBytes((int) start, (int) end);
    }

    long s = buffer.memoryAddress() + start;
    long e = buffer.memoryAddress() + end;

    return hash64bytes(s, e, seed);
  }
Esempio n. 7
0
 public DrillBuf getManagedBuffer(int size) {
   DrillBuf newBuf = allocator.buffer(size, this);
   managedBuffers.put(newBuf.memoryAddress(), newBuf);
   return newBuf;
 }
Esempio n. 8
0
 private static ByteBuf getUnderlying(DrillBuf b) {
   ByteBuf underlying = b.unwrap().unwrap();
   return underlying.slice((int) (b.memoryAddress() - underlying.memoryAddress()), b.length);
 }