Search in sources :

Example 6 with CodecDataOutput

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();
}
Also used : CodecDataOutput(com.pingcap.tikv.codec.CodecDataOutput)

Example 7 with CodecDataOutput

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();
}
Also used : CodecDataOutput(com.pingcap.tikv.codec.CodecDataOutput)

Example 8 with CodecDataOutput

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();
}
Also used : CodecDataOutput(com.pingcap.tikv.codec.CodecDataOutput)

Example 9 with CodecDataOutput

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();
}
Also used : CodecDataOutput(com.pingcap.tikv.codec.CodecDataOutput)

Example 10 with CodecDataOutput

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();
}
Also used : ByteString(com.google.protobuf.ByteString) CodecDataOutput(com.pingcap.tikv.codec.CodecDataOutput)

Aggregations

CodecDataOutput (com.pingcap.tikv.codec.CodecDataOutput)20 ByteString (com.google.protobuf.ByteString)4 Expr (com.pingcap.tidb.tipb.Expr)2 BytePairWrapper (com.pingcap.tikv.BytePairWrapper)2 FuncCallExpr (com.pingcap.tikv.expression.FuncCallExpr)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 MockServerTest (com.pingcap.tikv.MockServerTest)1 CodecDataInput (com.pingcap.tikv.codec.CodecDataInput)1 AllocateRowIDOverflowException (com.pingcap.tikv.exception.AllocateRowIDOverflowException)1 TiBatchWriteException (com.pingcap.tikv.exception.TiBatchWriteException)1 TypeException (com.pingcap.tikv.exception.TypeException)1 TiDAGRequest (com.pingcap.tikv.meta.TiDAGRequest)1 TiTableInfo (com.pingcap.tikv.meta.TiTableInfo)1 TiTimestamp (com.pingcap.tikv.meta.TiTimestamp)1 PDErrorHandler (com.pingcap.tikv.operation.PDErrorHandler)1 SchemaInfer (com.pingcap.tikv.operation.SchemaInfer)1 TiRegion (com.pingcap.tikv.region.TiRegion)1 Row (com.pingcap.tikv.row.Row)1 DataType (com.pingcap.tikv.types.DataType)1 RegionTask (com.pingcap.tikv.util.RangeSplitter.RegionTask)1