15 package com.cloudera.impala.hive.executor;
17 import java.nio.ByteBuffer;
21 @SuppressWarnings(
"restriction")
33 static public final int STRING_VALUE_LEN_OFFSET = 8;
58 bufferCapacity_ = getLength();
59 array_ = ByteBuffer.allocate(0);
67 UnsafeUtil.UNSAFE.freeMemory(bufferPtr_);
73 int len = getLength();
75 array_ = ByteBuffer.allocate(len);
76 byte[] buffer = array_.array();
78 long srcPtr = UnsafeUtil.UNSAFE.getLong(stringValPtr_);
79 UnsafeUtil.Copy(buffer, 0, srcPtr, len);
85 return bufferCapacity_;
90 if (newCap <= bufferCapacity_)
return;
91 bufferPtr_ = UnsafeUtil.UNSAFE.reallocateMemory(bufferPtr_, newCap);
92 UnsafeUtil.UNSAFE.putLong(stringValPtr_, bufferPtr_);
93 bufferCapacity_ = newCap;
98 return UnsafeUtil.UNSAFE.getInt(stringValPtr_ + STRING_VALUE_LEN_OFFSET);
105 UnsafeUtil.UNSAFE.putInt(stringValPtr_ + 8, s);
111 long strPtr = UnsafeUtil.UNSAFE.getLong(stringValPtr_);
112 UnsafeUtil.Copy(strPtr, v,
offset, len);
void set(byte[] v, int offset, int len)
ImpalaStringWritable(long ptr)
void setCapacity(int newCap)
uint8_t offset[7 *64-sizeof(uint64_t)]