Examples of DrillBuf


Examples of io.netty.buffer.DrillBuf

  @Test
  public void testHadooopVInt() throws Exception {
    final int _0 = 0;
    final int _9 = 9;
    final DrillBuf buffer = getAllocator().buffer(_9);

    long longVal = 0;
    buffer.clear();
    HadoopWritables.writeVLong(buffer, _0, _9, 0);
    longVal = HadoopWritables.readVLong(buffer, _0, _9);
    assertEquals(longVal, 0);

    buffer.clear();
    HadoopWritables.writeVLong(buffer, _0, _9, Long.MAX_VALUE);
    longVal = HadoopWritables.readVLong(buffer, _0, _9);
    assertEquals(longVal, Long.MAX_VALUE);

    buffer.clear();
    HadoopWritables.writeVLong(buffer, _0, _9, Long.MIN_VALUE);
    longVal = HadoopWritables.readVLong(buffer, _0, _9);
    assertEquals(longVal, Long.MIN_VALUE);

    int intVal = 0;
    buffer.clear();
    HadoopWritables.writeVInt(buffer, _0, _9, 0);
    intVal = HadoopWritables.readVInt(buffer, _0, _9);
    assertEquals(intVal, 0);

    buffer.clear();
    HadoopWritables.writeVInt(buffer, _0, _9, Integer.MAX_VALUE);
    intVal = HadoopWritables.readVInt(buffer, _0, _9);
    assertEquals(intVal, Integer.MAX_VALUE);

    buffer.clear();
    HadoopWritables.writeVInt(buffer, _0, _9, Integer.MIN_VALUE);
    intVal = HadoopWritables.readVInt(buffer, _0, _9);
    assertEquals(intVal, Integer.MIN_VALUE);
    buffer.release();
  }
View Full Code Here

Examples of io.netty.buffer.DrillBuf

  public DrillBuf getManagedBuffer() {
    return getManagedBuffer(256);
  }

  public DrillBuf getManagedBuffer(int size) {
    DrillBuf newBuf = allocator.buffer(size);
    managedBuffers.put(newBuf.memoryAddress(), newBuf);
    newBuf.setFragmentContext(this);
    return newBuf;
  }
View Full Code Here

Examples of io.netty.buffer.DrillBuf

    }
    if(!acct.reserve(min)) {
      return null;
    }
    UnsafeDirectLittleEndian buffer = innerAllocator.directBuffer(min, max);
    DrillBuf wrapped = new DrillBuf(this, acct, buffer);
    acct.reserved(min, wrapped);
    return wrapped;
  }
View Full Code Here

Examples of io.netty.buffer.DrillBuf

        logger.warn("Unable to allocate buffer of size {} due to memory limit. Current allocation: {}", size, getAllocatedMemory(), new Exception());
        return null;
      };

      UnsafeDirectLittleEndian buffer = innerAllocator.directBuffer(size, max);
      DrillBuf wrapped = new DrillBuf(this, childAcct, buffer);
      childAcct.reserved(buffer.capacity(), wrapped);
      return wrapped;
    }
View Full Code Here

Examples of io.netty.buffer.DrillBuf

    }


    public DrillBuf getAllocation() {
      DrillBuf b = new DrillBuf(allocator, acct, innerAllocator.directBuffer(bytes, bytes));
      acct.reserved(bytes, b);
      return b;
    }
View Full Code Here

Examples of io.netty.buffer.DrillBuf

  public DrillBuf getManagedBuffer() {
    return getManagedBuffer(256);
  }

  public DrillBuf getManagedBuffer(int size) {
    DrillBuf newBuf = allocator.buffer(size);
    managedBuffers.put(newBuf.memoryAddress(), newBuf);
    newBuf.setOperatorContext(this);
    return newBuf;
  }
View Full Code Here

Examples of io.netty.buffer.DrillBuf

        intermediateBytes[intermediateIndex] = shiftBits;

        if (sign == true) {
            intermediateBytes[0] = (byte) (intermediateBytes[0] | 0x80);
        }
        DrillBuf intermediate = data.getAllocator().buffer(intermediateBytes.length);
        intermediate.setBytes(0, intermediateBytes);

        BigDecimal ret = getBigDecimalFromIntermediate(intermediate, 0, nDecimalDigits + 1, scale);
        intermediate.release();
        return ret;
    }
View Full Code Here

Examples of io.netty.buffer.DrillBuf

      if (index >= varCharVector.getValueCapacity()) {
        return false;
      }

      if (usingDictionary) {
        DrillBuf b = DrillBuf.wrapByteBuffer(currDictValToWrite.toByteBuffer());
        int st=0;
        int len=currDictValToWrite.length();
        VarCharHolder holder = new VarCharHolder();
        holder.buffer=b;
        holder.start=0;
View Full Code Here

Examples of io.netty.buffer.DrillBuf

      if (index >= vector.getValueCapacity()) {
        return false;
      }

      if (usingDictionary) {
        DrillBuf b = DrillBuf.wrapByteBuffer(currDictValToWrite.toByteBuffer());
        success = mutator.setSafe(index, 1, 0, currDictValToWrite.length(), b);
      }
      else {
        success = mutator.setSafe(index, 1, start, start+length, value);
      }
View Full Code Here

Examples of io.netty.buffer.DrillBuf

      if (index >= varBinaryVector.getValueCapacity()) {
        return false;
      }

      if (usingDictionary) {
        DrillBuf b = DrillBuf.wrapByteBuffer(currDictValToWrite.toByteBuffer());
        int st=0;
        int len=currDictValToWrite.length();
        VarBinaryHolder holder = new VarBinaryHolder();
        holder.buffer=b;
        holder.start=0;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.