Skip to content

Commit 2e00687

Browse files
authored
add test case (#125)
1 parent 0b392ea commit 2e00687

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.alipay.oceanbase.hbase;
2+
3+
import org.junit.After;
4+
import org.junit.Before;
5+
6+
import java.io.IOException;
7+
8+
/*-
9+
* #%L
10+
* OBKV HBase Client Framework
11+
* %%
12+
* Copyright (C) 2022 OceanBase Group
13+
* %%
14+
* OBKV HBase Client Framework is licensed under Mulan PSL v2.
15+
* You can use this software according to the terms and conditions of the Mulan PSL v2.
16+
* You may obtain a copy of Mulan PSL v2 at:
17+
* http://license.coscl.org.cn/MulanPSL2
18+
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
19+
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
20+
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
21+
* See the Mulan PSL v2 for more details.
22+
* #L%
23+
*/
24+
25+
/// Only support odp mode for now.
26+
public class OHVarPrefixPartitionTest extends HTableTestBase {
27+
@Before
28+
public void before() throws Exception {
29+
hTable = ObHTableTestUtil.newOHTableClient("test_var_prefix_partition");
30+
((OHTableClient) hTable).init();
31+
}
32+
33+
@After
34+
public void finish() throws IOException {
35+
hTable.close();
36+
}
37+
38+
@After
39+
public void after() throws IOException {
40+
hTable.close();
41+
}
42+
}

src/test/java/unit_test_db.sql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ CREATE TABLE `test$partitionFamily1` (
5454
PRIMARY KEY (`K`, `Q`, `T`)
5555
) partition by key(`K`) partitions 17;
5656

57+
CREATE TABLE `test_var_prefix_partition$family1` (
58+
`K` varbinary(1024) NOT NULL,
59+
`Q` varbinary(256) NOT NULL,
60+
`T` bigint(20) NOT NULL,
61+
`V` varbinary(1024) DEFAULT NULL,
62+
`K_PREFIX` varbinary(1024) generated always as (SUBSTRING_INDEX(`K`, '.', 1)),
63+
PRIMARY KEY (`K`, `Q`, `T`)
64+
) partition by key(`K_PREFIX`) partitions 15;
65+
5766
CREATE TABLEGROUP test SHARDING = 'ADAPTIVE';
5867
CREATE TABLE `test$family_group` (
5968
`K` varbinary(1024) NOT NULL,

0 commit comments

Comments
 (0)