本文整理汇总了Java中io.netty.buffer.DrillBuf类的典型用法代码示例。如果您正苦于以下问题:Java DrillBuf类的具体用法?Java DrillBuf怎么用?Java DrillBuf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DrillBuf类属于io.netty.buffer包,在下文中一共展示了DrillBuf类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testVectorCanLoadEmptyBuffer
import io.netty.buffer.DrillBuf; //导入依赖的package包/类
@Test
public void testVectorCanLoadEmptyBuffer() throws Exception {
final DrillBuf empty = allocator.getEmpty();
testVectors(new VectorVerifier() {
@Override
public void verify(ValueVector vector) {
final String hint = String.format("%s failed the test case", vector.getClass().getSimpleName());
final UserBitShared.SerializedField metadata = vector.getMetadata();
assertEquals(hint, 0, metadata.getBufferLength());
assertEquals(hint, 0, metadata.getValueCount());
vector.load(metadata, empty);
assertEquals(hint, 0, vector.getValueCapacity());
assertEquals(hint, 0, vector.getAccessor().getValueCount());
vector.clear();
}
});
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:23,代码来源:TestValueVector.java
示例2: getBuffers
import io.netty.buffer.DrillBuf; //导入依赖的package包/类
@Override
public DrillBuf[] getBuffers(boolean clear) {
DrillBuf[] out;
if (getBufferSize() == 0) {
out = new DrillBuf[0];
} else {
out = new DrillBuf[]{data};
if (clear) {
data.readerIndex(0);
data.retain(1);
}
}
if (clear) {
clear();
}
return out;
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:18,代码来源:BaseDataValueVector.java
示例3: load
import io.netty.buffer.DrillBuf; //导入依赖的package包/类
@Override
public void load(SerializedField metadata, DrillBuf buffer) {
final List<SerializedField> children = metadata.getChildList();
final SerializedField offsetField = children.get(0);
offsets.load(offsetField, buffer);
int bufOffset = offsetField.getBufferLength();
for (int i = 1; i < children.size(); i++) {
final SerializedField child = children.get(i);
final MaterializedField fieldDef = MaterializedField.create(child);
ValueVector vector = getChild(fieldDef.getLastName());
if (vector == null) {
// if we arrive here, we didn't have a matching vector.
vector = TypeHelper.getNewVector(fieldDef, allocator);
putChild(fieldDef.getLastName(), vector);
}
final int vectorLength = child.getBufferLength();
vector.load(child, buffer.slice(bufOffset, vectorLength));
bufOffset += vectorLength;
}
assert bufOffset == buffer.capacity();
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:25,代码来源:RepeatedMapVector.java
示例4: load
import io.netty.buffer.DrillBuf; //导入依赖的package包/类
@Override
public void load(SerializedField metadata, DrillBuf buf) {
final List<SerializedField> fields = metadata.getChildList();
valueCount = metadata.getValueCount();
int bufOffset = 0;
for (final SerializedField child : fields) {
final MaterializedField fieldDef = MaterializedField.create(child);
ValueVector vector = getChild(fieldDef.getLastName());
if (vector == null) {
// if we arrive here, we didn't have a matching vector.
vector = TypeHelper.getNewVector(fieldDef, allocator);
putChild(fieldDef.getLastName(), vector);
}
if (child.getValueCount() == 0) {
vector.clear();
} else {
vector.load(child, buf.slice(bufOffset, child.getBufferLength()));
}
bufOffset += child.getBufferLength();
}
assert bufOffset == buf.capacity();
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:26,代码来源:MapVector.java
示例5: getBuffers
import io.netty.buffer.DrillBuf; //导入依赖的package包/类
@Override
public DrillBuf[] getBuffers(boolean clear) {
List<DrillBuf> buffers = Lists.newArrayList();
for (ValueVector vector : vectors.values()) {
for (DrillBuf buf : vector.getBuffers(false)) {
buffers.add(buf);
if (clear) {
buf.retain();
}
}
if (clear) {
vector.clear();
}
}
return buffers.toArray(new DrillBuf[buffers.size()]);
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:19,代码来源:AbstractMapVector.java
示例6: setSafe
import io.netty.buffer.DrillBuf; //导入依赖的package包/类
@Override
public boolean setSafe(int index, DrillBuf bytebuf, int start, int length) {
if (index >= varCharVector.getValueCapacity()) {
return false;
}
if (usingDictionary) {
currDictValToWrite = pageReader.dictionaryValueReader.readBytes();
mutator.setSafe(index, currDictValToWrite.toByteBuffer(), 0, currDictValToWrite.length());
} else {
mutator.setSafe(index, start, start + length, bytebuf);
}
return true;
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:15,代码来源:VarLengthColumnReaders.java
示例7: transfer
import io.netty.buffer.DrillBuf; //导入依赖的package包/类
private boolean transfer(Accountor target, DrillBuf buf, long size, boolean release) {
boolean withinLimit = target.forceAdditionalReservation(size);
if(release){
release(buf, size);
}
if (ENABLE_ACCOUNTING) {
target.buffers.put(buf, new DebugStackTrace(buf.capacity(), Thread.currentThread().getStackTrace()));
}
return withinLimit;
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:12,代码来源:Accountor.java
示例8: releasePartial
import io.netty.buffer.DrillBuf; //导入依赖的package包/类
public void releasePartial(DrillBuf buf, long size) {
remainder.returnAllocation(size);
if (ENABLE_ACCOUNTING) {
if (buf != null) {
DebugStackTrace dst = buffers.get(buf);
if (dst == null) {
throw new IllegalStateException("Partially releasing a buffer that has already been released. Buffer: " + buf);
}
dst.size -= size;
if (dst.size < 0) {
throw new IllegalStateException("Partially releasing a buffer that has already been released. Buffer: " + buf);
}
}
}
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:16,代码来源:Accountor.java
示例9: release
import io.netty.buffer.DrillBuf; //导入依赖的package包/类
public void release(DrillBuf buf, long size) {
remainder.returnAllocation(size);
if (ENABLE_ACCOUNTING) {
if (buf != null && buffers.remove(buf) == null) {
throw new IllegalStateException("Releasing a buffer that has already been released. Buffer: " + buf);
}
}
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:9,代码来源:Accountor.java
示例10: compareSparseSamePrecScale
import io.netty.buffer.DrillBuf; //导入依赖的package包/类
public static int compareSparseSamePrecScale(DrillBuf left, int lStart, byte[] right, int length) {
// check the sign first
boolean lSign = (left.getInt(lStart) & 0x80000000) != 0;
boolean rSign = ByteFunctionHelpers.getSign(right);
int cmp = 0;
if (lSign != rSign) {
return (lSign == false) ? 1 : -1;
}
// invert the comparison if we are comparing negative numbers
int invert = (lSign == true) ? -1 : 1;
// compare byte by byte
int n = 0;
int lPos = lStart;
int rPos = 0;
while (n < length/4) {
int leftInt = Decimal38SparseHolder.getInteger(n, lStart, left);
int rightInt = ByteFunctionHelpers.getInteger(right, n);
if (leftInt != rightInt) {
cmp = (leftInt - rightInt ) > 0 ? 1 : -1;
break;
}
n++;
}
return cmp * invert;
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:29,代码来源:DecimalUtility.java
示例11: loadPage
import io.netty.buffer.DrillBuf; //导入依赖的package包/类
public void loadPage(DrillBuf target, int pageLength) throws IOException {
target.clear();
ByteBuffer directBuffer = target.nioBuffer(0, pageLength);
while (directBuffer.remaining() > 0) {
CompatibilityUtil.getBuf(input, directBuffer, directBuffer.remaining());
}
target.writerIndex(pageLength);
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:9,代码来源:ColumnDataReader.java
示例12: compareDenseBytes
import io.netty.buffer.DrillBuf; //导入依赖的package包/类
public static int compareDenseBytes(DrillBuf left, int leftStart, boolean leftSign, DrillBuf right, int rightStart, boolean rightSign, int width) {
int invert = 1;
/* If signs are different then simply look at the
* sign of the two inputs and determine which is greater
*/
if (leftSign != rightSign) {
return((leftSign == true) ? -1 : 1);
} else if(leftSign == true) {
/* Both inputs are negative, at the end we will
* have to invert the comparison
*/
invert = -1;
}
int cmp = 0;
for (int i = 0; i < width; i++) {
byte leftByte = left.getByte(leftStart + i);
byte rightByte = right.getByte(rightStart + i);
// Unsigned byte comparison
if ((leftByte & 0xFF) > (rightByte & 0xFF)) {
cmp = 1;
break;
} else if ((leftByte & 0xFF) < (rightByte & 0xFF)) {
cmp = -1;
break;
}
}
cmp *= invert; // invert the comparison if both were negative values
return cmp;
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:36,代码来源:DecimalUtility.java
示例13: getIntegerFromSparseBuffer
import io.netty.buffer.DrillBuf; //导入依赖的package包/类
public static int getIntegerFromSparseBuffer(DrillBuf buffer, int start, int index) {
int value = buffer.getInt(start + (index * 4));
if (index == 0) {
/* the first byte contains sign bit, return value without it */
value = (value & 0x7FFFFFFF);
}
return value;
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:10,代码来源:DecimalUtility.java
示例14: QueryDataBatch
import io.netty.buffer.DrillBuf; //导入依赖的package包/类
public QueryDataBatch(QueryData header, DrillBuf data) {
// logger.debug("New Result Batch with header {} and data {}", header, data);
this.header = header;
this.data = data;
if (this.data != null) {
data.retain(1);
}
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:9,代码来源:QueryDataBatch.java
示例15: initCap
import io.netty.buffer.DrillBuf; //导入依赖的package包/类
public static void initCap(int start, int end, DrillBuf inBuf, DrillBuf outBuf) {
boolean capNext = true;
int out = 0;
for (int id = start; id < end; id++, out++) {
byte currentByte = inBuf.getByte(id);
// 'A - Z' : 0x41 - 0x5A
// 'a - z' : 0x61 - 0x7A
// '0-9' : 0x30 - 0x39
if (capNext) { // curCh is whitespace or first character of word.
if (currentByte >= 0x30 && currentByte <= 0x39) { // 0-9
capNext = false;
} else if (currentByte >= 0x41 && currentByte <= 0x5A) { // A-Z
capNext = false;
} else if (currentByte >= 0x61 && currentByte <= 0x7A) { // a-z
capNext = false;
currentByte -= 0x20; // Uppercase this character
}
// else {} whitespace
} else { // Inside of a word or white space after end of word.
if (currentByte >= 0x30 && currentByte <= 0x39) { // 0-9
// noop
} else if (currentByte >= 0x41 && currentByte <= 0x5A) { // A-Z
currentByte -= 0x20; // Lowercase this character
} else if (currentByte >= 0x61 && currentByte <= 0x7A) { // a-z
// noop
} else { // whitespace
capNext = true;
}
}
outBuf.setByte(out, currentByte);
} // end of for_loop
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:35,代码来源:StringFunctionHelpers.java
示例16: decompress
import io.netty.buffer.DrillBuf; //导入依赖的package包/类
@Override
public void decompress(DrillBuf input, int compressedSize, DrillBuf output, int uncompressedSize)
throws IOException {
BytesInput uncompressed = decompress(new ByteBufBytesInput(input), uncompressedSize);
output.clear();
output.setBytes(0, uncompressed.toByteArray());
output.writerIndex((int) uncompressed.size());
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:9,代码来源:DirectCodecFactory.java
示例17: getBufferSize
import io.netty.buffer.DrillBuf; //导入依赖的package包/类
private long getBufferSize(VectorAccessible batch) {
long size = 0;
for (VectorWrapper<?> w : batch) {
DrillBuf[] bufs = w.getValueVector().getBuffers(false);
for (DrillBuf buf : bufs) {
if (buf.isRootBuffer()) {
size += buf.capacity();
}
}
}
return size;
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:13,代码来源:ExternalSortBatch.java
示例18: close
import io.netty.buffer.DrillBuf; //导入依赖的package包/类
@Override
public void close() {
if (closed) {
logger.debug("Attempted to close Operator context for {}, but context is already closed", popConfig != null ? popConfig.getClass().getName() : null);
return;
}
logger.debug("Closing context for {}", popConfig != null ? popConfig.getClass().getName() : null);
// release managed buffers.
Object[] buffers = ((LongObjectOpenHashMap<Object>)(Object)managedBuffers).values;
for (int i =0; i < buffers.length; i++) {
if (managedBuffers.allocated[i]) {
((DrillBuf)buffers[i]).release();
}
}
if (allocator != null) {
allocator.close();
}
if (fs != null) {
try {
fs.close();
} catch (IOException e) {
throw new DrillRuntimeException(e);
}
}
closed = true;
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:30,代码来源:OperatorContextImpl.java
示例19: close
import io.netty.buffer.DrillBuf; //导入依赖的package包/类
@Override
public void close() throws Exception {
final Object[] mbuffers = ((LongObjectOpenHashMap<Object>) (Object) managedBuffers).values;
for (int i = 0; i < mbuffers.length; i++) {
if (managedBuffers.allocated[i]) {
((DrillBuf) mbuffers[i]).release(1);
}
}
managedBuffers.clear();
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:11,代码来源:BufferManager.java
示例20: replace
import io.netty.buffer.DrillBuf; //导入依赖的package包/类
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);
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:8,代码来源:BufferManager.java
注:本文中的io.netty.buffer.DrillBuf类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论