Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ public void setup() throws Exception {
syncRefreshMetaHelper(obTableClient);
}

private void executeSQL(String createSQL) throws SQLException {
Connection connection = ObTableClientTestUtil.getConnection();
Statement statement = connection.createStatement();
statement.execute(createSQL);
}

private void dropTable(String tableName) throws SQLException {
// use sql to drop table
Connection connection = ObTableClientTestUtil.getConnection();
Expand All @@ -91,6 +97,14 @@ public void testAutoIncrementRowkey() throws Exception {
final String TABLE_NAME = "test_auto_increment_rowkey";

try {
executeSQL("CREATE TABLE IF NOT EXISTS `test_auto_increment_rowkey` (" +
"`c1` int auto_increment," +
"`c2` int NOT NULL," +
"`c3` int DEFAULT NULL," +
"`c4` varchar(255) DEFAULT NULL," +
"PRIMARY KEY(`c1`, `c2`)) partition by range columns(`c2`)" +
"(PARTITION p0 VALUES LESS THAN (100), PARTITION p1 VALUES LESS THAN (1000));");

client.insert(TABLE_NAME, new Object[] { 0, 1 }, new String[] { "c3" },
new Object[] { 1 });

Expand Down Expand Up @@ -304,6 +318,14 @@ public void testAutoIncrementNotRowkey() throws Exception {
final String TABLE_NAME = "test_auto_increment_not_rowkey";

try {
executeSQL("CREATE TABLE IF NOT EXISTS `test_auto_increment_not_rowkey` (" +
"`c1` int NOT NULL," +
"`c2` int DEFAULT NULL," +
"`c3` tinyint auto_increment," +
"`c4` varchar(255) DEFAULT NULL," +
"PRIMARY KEY(`c1`)) partition by range columns(`c1`)" +
"(PARTITION p0 VALUES LESS THAN (100), PARTITION p1 VALUES LESS THAN (1000));");

client
.insert(TABLE_NAME, new Object[] { 1 }, new String[] { "c2" }, new Object[] { 1 });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,18 @@ public void close() throws Exception {

@Test
public void test_batch() throws Exception {

/*
*
CREATE TABLE `test_varchar_table` (
`c1` varchar(20) NOT NULL,
`c2` varchar(20) DEFAULT NULL,
PRIMARY KEY (`c1`)
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'lz4_1.0' REPLICA_NUM = 3 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 10
* */
*/
if (this.getClass().getSimpleName().equals("ObTableTest")) {
// could not get tableId from ObTable
return;
}

for (int i = 0; i < 100; i++) {
TableBatchOps batchOps = client.batch("test_varchar_table");

Expand Down