use of com.pingcap.tikv.codec.CodecDataOutput in project tispark by pingcap.
the class ProtoConverter method visit.
@Override
@SuppressWarnings("unchecked")
protected Expr visit(ColumnRef node, Object context) {
long position = 0;
if (validateColPosition) {
requireNonNull(context, "Context of a ColumnRef should not be null");
Map<String, Integer> colIdOffsetMap = (Map<String, Integer>) context;
position = requireNonNull(colIdOffsetMap.get(node.getName()), "Required column position info " + node.getName() + " is not in a valid context.");
}
Expr.Builder builder = Expr.newBuilder();
builder.setTp(ExprType.ColumnRef);
CodecDataOutput cdo = new CodecDataOutput();
// After switching to DAG request mode, expression value
// should be the index of table columns we provided in
// the first executor of a DAG request.
IntegerCodec.writeLong(cdo, position);
builder.setVal(cdo.toByteString());
builder.setFieldType(toPBFieldType(getType(node)));
return builder.build();
}
use of com.pingcap.tikv.codec.CodecDataOutput in project tispark by pingcap.
the class TiColumnInfo method getOriginDefaultValueAsByteString.
private ByteString getOriginDefaultValueAsByteString() {
CodecDataOutput cdo = new CodecDataOutput();
type.encode(cdo, EncodeType.VALUE, type.getOriginDefaultValue(getOriginDefaultValue(), version));
return cdo.toByteString();
}
use of com.pingcap.tikv.codec.CodecDataOutput in project tispark by pingcap.
the class IntHandle method encoded.
@Override
public byte[] encoded() {
CodecDataOutput cdo = new CodecDataOutput();
IntegerCodec.writeLong(cdo, handle);
byte[] encoded = cdo.toBytes();
if (infFlag == 1) {
return Arrays.copyOf(encoded, encoded.length + 1);
}
return encoded;
}
use of com.pingcap.tikv.codec.CodecDataOutput in project tispark by pingcap.
the class Key method createTypelessMax.
private static Key createTypelessMax() {
CodecDataOutput cdo = new CodecDataOutput();
DataType.encodeMaxValue(cdo);
return new Key(cdo.toBytes()) {
@Override
public String toString() {
return "MAX";
}
};
}
use of com.pingcap.tikv.codec.CodecDataOutput in project tispark by pingcap.
the class Key method createNull.
private static Key createNull() {
CodecDataOutput cdo = new CodecDataOutput();
DataType.encodeNull(cdo);
return new Key(cdo.toBytes()) {
@Override
public String toString() {
return "null";
}
};
}
Aggregations