Search in sources :

Example 6 with IntHandle

use of com.pingcap.tikv.key.IntHandle in project tispark by pingcap.

the class TableCodecV1Test method makeValues.

private void makeValues() {
    List<Object> values = new ArrayList<>();
    values.add(new IntHandle(1L));
    values.add(1L);
    DateTime dateTime = DateTime.parse("1995-10-10");
    // values.add(new Timestamp(dateTime.getMillis()));
    // values.add(new Timestamp(dateTime.getMillis()));
    values.add("abc");
    values.add("δΈ­");
    this.values = values.toArray();
}
Also used : ArrayList(java.util.ArrayList) IntHandle(com.pingcap.tikv.key.IntHandle) DateTime(org.joda.time.DateTime)

Example 7 with IntHandle

use of com.pingcap.tikv.key.IntHandle in project tispark by pingcap.

the class TableCodecV1Test method testRowCodec.

@Test
public void testRowCodec() {
    // multiple test was added since encodeRow refuse its cdo
    for (int i = 0; i < 4; i++) {
        byte[] bytes = TableCodecV1.encodeRow(tblInfo.getColumns(), values, tblInfo.isPkHandle());
        // testing the correctness via decodeRow
        Row row = TableCodecV1.decodeRow(bytes, new IntHandle(1L), tblInfo);
        for (int j = 0; j < tblInfo.getColumns().size(); j++) {
            assertEquals(row.get(j, null), values[j]);
        }
    }
}
Also used : IntHandle(com.pingcap.tikv.key.IntHandle) Row(com.pingcap.tikv.row.Row) Test(org.junit.Test)

Example 8 with IntHandle

use of com.pingcap.tikv.key.IntHandle in project tispark by pingcap.

the class TableCodecV2Test method testLargeColID.

@Test
public void testLargeColID() {
    TestCase testCase = TestCase.createNew(new int[] { 128, 1, 1, 0, 0, 0, 44, 1, 0, 0, 0, 0, 0, 0 }, MetaUtils.TableBuilder.newBuilder().name("t").addColumn("c1", StringType.CHAR, 300).build(), new IntHandle(300L), new Object[] { "" });
    testCase.test();
}
Also used : IntHandle(com.pingcap.tikv.key.IntHandle) Test(org.junit.Test)

Aggregations

IntHandle (com.pingcap.tikv.key.IntHandle)8 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)3 Handle (com.pingcap.tikv.key.Handle)2 Row (com.pingcap.tikv.row.Row)2 ImmutableList (com.google.common.collect.ImmutableList)1 ByteString (com.google.protobuf.ByteString)1 TiDAGRequest (com.pingcap.tikv.meta.TiDAGRequest)1 TiIndexInfo (com.pingcap.tikv.meta.TiIndexInfo)1 TiTableInfo (com.pingcap.tikv.meta.TiTableInfo)1 TLongObjectHashMap (gnu.trove.map.hash.TLongObjectHashMap)1 List (java.util.List)1 DateTime (org.joda.time.DateTime)1