use of com.pingcap.tikv.codec.CodecDataOutput in project tispark by pingcap.
the class RowKey method encode.
private static byte[] encode(long tableId, Handle handle) {
CodecDataOutput cdo = new CodecDataOutput();
encodePrefix(cdo, tableId);
cdo.write(handle.encoded());
return cdo.toBytes();
}
use of com.pingcap.tikv.codec.CodecDataOutput in project tispark by pingcap.
the class TypedKey method encodeKey.
private static byte[] encodeKey(Object val, DataType type, int prefixLength) {
CodecDataOutput cdo = new CodecDataOutput();
type.encodeKey(cdo, val, prefixLength);
return cdo.toBytes();
}
use of com.pingcap.tikv.codec.CodecDataOutput in project tispark by pingcap.
the class IntegerTypeTest method encode.
private static byte[] encode(Object val, EncodeType encodeType, DataType type) {
CodecDataOutput cdo = new CodecDataOutput();
type.encode(cdo, encodeType, val);
return cdo.toBytes();
}
use of com.pingcap.tikv.codec.CodecDataOutput in project tispark by pingcap.
the class RealTypeTest method encode.
private static byte[] encode(Object val, EncodeType encodeType, DataType type) {
CodecDataOutput cdo = new CodecDataOutput();
type.encode(cdo, encodeType, val);
return cdo.toBytes();
}
use of com.pingcap.tikv.codec.CodecDataOutput in project tispark by pingcap.
the class RangeSplitterTest method keyRange.
private static KeyRange keyRange(Long s, Long e) {
ByteString sKey = ByteString.EMPTY;
ByteString eKey = ByteString.EMPTY;
if (s != null) {
CodecDataOutput cdo = new CodecDataOutput();
IntegerCodec.writeLongFully(cdo, s, true);
sKey = cdo.toByteString();
}
if (e != null) {
CodecDataOutput cdo = new CodecDataOutput();
IntegerCodec.writeLongFully(cdo, e, true);
eKey = cdo.toByteString();
}
return KeyRange.newBuilder().setStart(sKey).setEnd(eKey).build();
}
Aggregations