未验证 提交 211c7f38 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

[TD-5398]<fix>: taosdemo 4096 columns table creation failed. (#6931)

* [TD-5398]<fix>: taosdemo 4096 columns table creation failed.

* change column name prefix from col to c for maxium column number to fix buffer length.

* use accurate buffer length.

* fix test case for column name be shorter.
Co-authored-by: NShuduo Sang <sdsang@taosdata.com>
上级 16b9fc88
...@@ -71,8 +71,8 @@ extern char configDir[]; ...@@ -71,8 +71,8 @@ extern char configDir[];
#define HEAD_BUFF_LEN TSDB_MAX_COLUMNS*24 // 16*MAX_COLUMNS + (192+32)*2 + insert into .. #define HEAD_BUFF_LEN TSDB_MAX_COLUMNS*24 // 16*MAX_COLUMNS + (192+32)*2 + insert into ..
#define MAX_SQL_SIZE 65536 #define COL_BUFFER_LEN (TSDB_MAX_BYTES_PER_ROW - 50)
#define BUFFER_SIZE (65536*2) #define BUFFER_SIZE (50 + TSDB_DB_NAME_LEN + TSDB_TABLE_NAME_LEN + TSDB_MAX_BYTES_PER_ROW + TSDB_MAX_TAGS_LEN)
#define COND_BUF_LEN (BUFFER_SIZE - 30) #define COND_BUF_LEN (BUFFER_SIZE - 30)
#define MAX_USERNAME_SIZE 64 #define MAX_USERNAME_SIZE 64
#define MAX_PASSWORD_SIZE 64 #define MAX_PASSWORD_SIZE 64
...@@ -80,7 +80,6 @@ extern char configDir[]; ...@@ -80,7 +80,6 @@ extern char configDir[];
#define MAX_TB_NAME_SIZE 64 #define MAX_TB_NAME_SIZE 64
#define MAX_DATA_SIZE (16*TSDB_MAX_COLUMNS)+20 // max record len: 16*MAX_COLUMNS, timestamp string and ,('') need extra space #define MAX_DATA_SIZE (16*TSDB_MAX_COLUMNS)+20 // max record len: 16*MAX_COLUMNS, timestamp string and ,('') need extra space
#define OPT_ABORT 1 /* –abort */ #define OPT_ABORT 1 /* –abort */
#define STRING_LEN 60000
#define MAX_PREPARED_RAND 1000000 #define MAX_PREPARED_RAND 1000000
#define MAX_FILE_NAME_LEN 256 // max file name length on linux is 255. #define MAX_FILE_NAME_LEN 256 // max file name length on linux is 255.
...@@ -2710,7 +2709,7 @@ static int createSuperTable( ...@@ -2710,7 +2709,7 @@ static int createSuperTable(
char command[BUFFER_SIZE] = "\0"; char command[BUFFER_SIZE] = "\0";
char cols[STRING_LEN] = "\0"; char cols[COL_BUFFER_LEN] = "\0";
int colIndex; int colIndex;
int len = 0; int len = 0;
...@@ -2726,55 +2725,55 @@ static int createSuperTable( ...@@ -2726,55 +2725,55 @@ static int createSuperTable(
char* dataType = superTbl->columns[colIndex].dataType; char* dataType = superTbl->columns[colIndex].dataType;
if (strcasecmp(dataType, "BINARY") == 0) { if (strcasecmp(dataType, "BINARY") == 0) {
len += snprintf(cols + len, STRING_LEN - len, len += snprintf(cols + len, COL_BUFFER_LEN - len,
", col%d %s(%d)", colIndex, "BINARY", ", C%d %s(%d)", colIndex, "BINARY",
superTbl->columns[colIndex].dataLen); superTbl->columns[colIndex].dataLen);
lenOfOneRow += superTbl->columns[colIndex].dataLen + 3; lenOfOneRow += superTbl->columns[colIndex].dataLen + 3;
} else if (strcasecmp(dataType, "NCHAR") == 0) { } else if (strcasecmp(dataType, "NCHAR") == 0) {
len += snprintf(cols + len, STRING_LEN - len, len += snprintf(cols + len, COL_BUFFER_LEN - len,
", col%d %s(%d)", colIndex, "NCHAR", ", C%d %s(%d)", colIndex, "NCHAR",
superTbl->columns[colIndex].dataLen); superTbl->columns[colIndex].dataLen);
lenOfOneRow += superTbl->columns[colIndex].dataLen + 3; lenOfOneRow += superTbl->columns[colIndex].dataLen + 3;
} else if (strcasecmp(dataType, "INT") == 0) { } else if (strcasecmp(dataType, "INT") == 0) {
if ((g_args.demo_mode) && (colIndex == 1)) { if ((g_args.demo_mode) && (colIndex == 1)) {
len += snprintf(cols + len, STRING_LEN - len, len += snprintf(cols + len, COL_BUFFER_LEN - len,
", VOLTAGE INT"); ", VOLTAGE INT");
} else { } else {
len += snprintf(cols + len, STRING_LEN - len, ", col%d %s", colIndex, "INT"); len += snprintf(cols + len, COL_BUFFER_LEN - len, ", C%d %s", colIndex, "INT");
} }
lenOfOneRow += 11; lenOfOneRow += 11;
} else if (strcasecmp(dataType, "BIGINT") == 0) { } else if (strcasecmp(dataType, "BIGINT") == 0) {
len += snprintf(cols + len, STRING_LEN - len, ", col%d %s", len += snprintf(cols + len, COL_BUFFER_LEN - len, ", C%d %s",
colIndex, "BIGINT"); colIndex, "BIGINT");
lenOfOneRow += 21; lenOfOneRow += 21;
} else if (strcasecmp(dataType, "SMALLINT") == 0) { } else if (strcasecmp(dataType, "SMALLINT") == 0) {
len += snprintf(cols + len, STRING_LEN - len, ", col%d %s", len += snprintf(cols + len, COL_BUFFER_LEN - len, ", C%d %s",
colIndex, "SMALLINT"); colIndex, "SMALLINT");
lenOfOneRow += 6; lenOfOneRow += 6;
} else if (strcasecmp(dataType, "TINYINT") == 0) { } else if (strcasecmp(dataType, "TINYINT") == 0) {
len += snprintf(cols + len, STRING_LEN - len, ", col%d %s", colIndex, "TINYINT"); len += snprintf(cols + len, COL_BUFFER_LEN - len, ", C%d %s", colIndex, "TINYINT");
lenOfOneRow += 4; lenOfOneRow += 4;
} else if (strcasecmp(dataType, "BOOL") == 0) { } else if (strcasecmp(dataType, "BOOL") == 0) {
len += snprintf(cols + len, STRING_LEN - len, ", col%d %s", colIndex, "BOOL"); len += snprintf(cols + len, COL_BUFFER_LEN - len, ", C%d %s", colIndex, "BOOL");
lenOfOneRow += 6; lenOfOneRow += 6;
} else if (strcasecmp(dataType, "FLOAT") == 0) { } else if (strcasecmp(dataType, "FLOAT") == 0) {
if (g_args.demo_mode) { if (g_args.demo_mode) {
if (colIndex == 0) { if (colIndex == 0) {
len += snprintf(cols + len, STRING_LEN - len, ", CURRENT FLOAT"); len += snprintf(cols + len, COL_BUFFER_LEN - len, ", CURRENT FLOAT");
} else if (colIndex == 2) { } else if (colIndex == 2) {
len += snprintf(cols + len, STRING_LEN - len, ", PHASE FLOAT"); len += snprintf(cols + len, COL_BUFFER_LEN - len, ", PHASE FLOAT");
} }
} else { } else {
len += snprintf(cols + len, STRING_LEN - len, ", col%d %s", colIndex, "FLOAT"); len += snprintf(cols + len, COL_BUFFER_LEN - len, ", C%d %s", colIndex, "FLOAT");
} }
lenOfOneRow += 22; lenOfOneRow += 22;
} else if (strcasecmp(dataType, "DOUBLE") == 0) { } else if (strcasecmp(dataType, "DOUBLE") == 0) {
len += snprintf(cols + len, STRING_LEN - len, ", col%d %s", len += snprintf(cols + len, COL_BUFFER_LEN - len, ", C%d %s",
colIndex, "DOUBLE"); colIndex, "DOUBLE");
lenOfOneRow += 42; lenOfOneRow += 42;
} else if (strcasecmp(dataType, "TIMESTAMP") == 0) { } else if (strcasecmp(dataType, "TIMESTAMP") == 0) {
len += snprintf(cols + len, STRING_LEN - len, ", col%d %s", len += snprintf(cols + len, COL_BUFFER_LEN - len, ", C%d %s",
colIndex, "TIMESTAMP"); colIndex, "TIMESTAMP");
lenOfOneRow += 21; lenOfOneRow += 21;
} else { } else {
...@@ -2806,60 +2805,63 @@ static int createSuperTable( ...@@ -2806,60 +2805,63 @@ static int createSuperTable(
return -1; return -1;
} }
char tags[STRING_LEN] = "\0"; char tags[TSDB_MAX_TAGS_LEN] = "\0";
int tagIndex; int tagIndex;
len = 0; len = 0;
int lenOfTagOfOneRow = 0; int lenOfTagOfOneRow = 0;
len += snprintf(tags + len, STRING_LEN - len, "("); len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len, "(");
for (tagIndex = 0; tagIndex < superTbl->tagCount; tagIndex++) { for (tagIndex = 0; tagIndex < superTbl->tagCount; tagIndex++) {
char* dataType = superTbl->tags[tagIndex].dataType; char* dataType = superTbl->tags[tagIndex].dataType;
if (strcasecmp(dataType, "BINARY") == 0) { if (strcasecmp(dataType, "BINARY") == 0) {
if ((g_args.demo_mode) && (tagIndex == 1)) { if ((g_args.demo_mode) && (tagIndex == 1)) {
len += snprintf(tags + len, STRING_LEN - len, len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len,
"location BINARY(%d), ", "location BINARY(%d), ",
superTbl->tags[tagIndex].dataLen); superTbl->tags[tagIndex].dataLen);
} else { } else {
len += snprintf(tags + len, STRING_LEN - len, "t%d %s(%d), ", len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len,
tagIndex, "BINARY", superTbl->tags[tagIndex].dataLen); "t%d %s(%d), ", tagIndex, "BINARY",
superTbl->tags[tagIndex].dataLen);
} }
lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 3; lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 3;
} else if (strcasecmp(dataType, "NCHAR") == 0) { } else if (strcasecmp(dataType, "NCHAR") == 0) {
len += snprintf(tags + len, STRING_LEN - len, "t%d %s(%d), ", tagIndex, len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len,
"t%d %s(%d), ", tagIndex,
"NCHAR", superTbl->tags[tagIndex].dataLen); "NCHAR", superTbl->tags[tagIndex].dataLen);
lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 3; lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 3;
} else if (strcasecmp(dataType, "INT") == 0) { } else if (strcasecmp(dataType, "INT") == 0) {
if ((g_args.demo_mode) && (tagIndex == 0)) { if ((g_args.demo_mode) && (tagIndex == 0)) {
len += snprintf(tags + len, STRING_LEN - len, "groupId INT, "); len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len,
"groupId INT, ");
} else { } else {
len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex, len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len,
"INT"); "t%d %s, ", tagIndex, "INT");
} }
lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 11; lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 11;
} else if (strcasecmp(dataType, "BIGINT") == 0) { } else if (strcasecmp(dataType, "BIGINT") == 0) {
len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex, len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len,
"BIGINT"); "t%d %s, ", tagIndex, "BIGINT");
lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 21; lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 21;
} else if (strcasecmp(dataType, "SMALLINT") == 0) { } else if (strcasecmp(dataType, "SMALLINT") == 0) {
len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex, len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len,
"SMALLINT"); "t%d %s, ", tagIndex, "SMALLINT");
lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 6; lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 6;
} else if (strcasecmp(dataType, "TINYINT") == 0) { } else if (strcasecmp(dataType, "TINYINT") == 0) {
len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex, len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len,
"TINYINT"); "t%d %s, ", tagIndex, "TINYINT");
lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 4; lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 4;
} else if (strcasecmp(dataType, "BOOL") == 0) { } else if (strcasecmp(dataType, "BOOL") == 0) {
len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex, len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len,
"BOOL"); "t%d %s, ", tagIndex, "BOOL");
lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 6; lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 6;
} else if (strcasecmp(dataType, "FLOAT") == 0) { } else if (strcasecmp(dataType, "FLOAT") == 0) {
len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex, len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len,
"FLOAT"); "t%d %s, ", tagIndex, "FLOAT");
lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 22; lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 22;
} else if (strcasecmp(dataType, "DOUBLE") == 0) { } else if (strcasecmp(dataType, "DOUBLE") == 0) {
len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex, len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len,
"DOUBLE"); "t%d %s, ", tagIndex, "DOUBLE");
lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 42; lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 42;
} else { } else {
taos_close(taos); taos_close(taos);
...@@ -2870,7 +2872,7 @@ static int createSuperTable( ...@@ -2870,7 +2872,7 @@ static int createSuperTable(
} }
len -= 2; len -= 2;
len += snprintf(tags + len, STRING_LEN - len, ")"); len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len, ")");
superTbl->lenOfTagOfOneRow = lenOfTagOfOneRow; superTbl->lenOfTagOfOneRow = lenOfTagOfOneRow;
...@@ -3029,7 +3031,7 @@ static void* createTable(void *sarg) ...@@ -3029,7 +3031,7 @@ static void* createTable(void *sarg)
uint64_t lastPrintTime = taosGetTimestampMs(); uint64_t lastPrintTime = taosGetTimestampMs();
int buff_len; int buff_len;
buff_len = BUFFER_SIZE / 8; buff_len = BUFFER_SIZE;
pThreadInfo->buffer = calloc(buff_len, 1); pThreadInfo->buffer = calloc(buff_len, 1);
if (pThreadInfo->buffer == NULL) { if (pThreadInfo->buffer == NULL) {
...@@ -3191,7 +3193,7 @@ static int startMultiThreadCreateChildTable( ...@@ -3191,7 +3193,7 @@ static int startMultiThreadCreateChildTable(
} }
static void createChildTables() { static void createChildTables() {
char tblColsBuf[MAX_SQL_SIZE]; char tblColsBuf[TSDB_MAX_BYTES_PER_ROW];
int len; int len;
for (int i = 0; i < g_Dbs.dbCount; i++) { for (int i = 0; i < g_Dbs.dbCount; i++) {
...@@ -3223,21 +3225,21 @@ static void createChildTables() { ...@@ -3223,21 +3225,21 @@ static void createChildTables() {
} }
} else { } else {
// normal table // normal table
len = snprintf(tblColsBuf, MAX_SQL_SIZE, "(TS TIMESTAMP"); len = snprintf(tblColsBuf, TSDB_MAX_BYTES_PER_ROW, "(TS TIMESTAMP");
for (int j = 0; j < g_args.num_of_CPR; j++) { for (int j = 0; j < g_args.num_of_CPR; j++) {
if ((strncasecmp(g_args.datatype[j], "BINARY", strlen("BINARY")) == 0) if ((strncasecmp(g_args.datatype[j], "BINARY", strlen("BINARY")) == 0)
|| (strncasecmp(g_args.datatype[j], || (strncasecmp(g_args.datatype[j],
"NCHAR", strlen("NCHAR")) == 0)) { "NCHAR", strlen("NCHAR")) == 0)) {
snprintf(tblColsBuf + len, MAX_SQL_SIZE - len, snprintf(tblColsBuf + len, TSDB_MAX_BYTES_PER_ROW - len,
", COL%d %s(%d)", j, g_args.datatype[j], g_args.len_of_binary); ",C%d %s(%d)", j, g_args.datatype[j], g_args.len_of_binary);
} else { } else {
snprintf(tblColsBuf + len, MAX_SQL_SIZE - len, snprintf(tblColsBuf + len, TSDB_MAX_BYTES_PER_ROW - len,
", COL%d %s", j, g_args.datatype[j]); ",C%d %s", j, g_args.datatype[j]);
} }
len = strlen(tblColsBuf); len = strlen(tblColsBuf);
} }
snprintf(tblColsBuf + len, MAX_SQL_SIZE - len, ")"); snprintf(tblColsBuf + len, TSDB_MAX_BYTES_PER_ROW - len, ")");
verbosePrint("%s() LN%d: dbName: %s num of tb: %"PRId64" schema: %s\n", verbosePrint("%s() LN%d: dbName: %s num of tb: %"PRId64" schema: %s\n",
__func__, __LINE__, __func__, __LINE__,
...@@ -7989,7 +7991,7 @@ static void initOfQueryMeta() { ...@@ -7989,7 +7991,7 @@ static void initOfQueryMeta() {
tstrncpy(g_queryInfo.password, TSDB_DEFAULT_PASS, MAX_PASSWORD_SIZE); tstrncpy(g_queryInfo.password, TSDB_DEFAULT_PASS, MAX_PASSWORD_SIZE);
} }
static void setParaFromArg(){ static void setParaFromArg() {
if (g_args.host) { if (g_args.host) {
tstrncpy(g_Dbs.host, g_args.host, MAX_HOSTNAME_SIZE); tstrncpy(g_Dbs.host, g_args.host, MAX_HOSTNAME_SIZE);
} else { } else {
...@@ -8025,10 +8027,10 @@ static void setParaFromArg(){ ...@@ -8025,10 +8027,10 @@ static void setParaFromArg(){
g_Dbs.do_aggreFunc = true; g_Dbs.do_aggreFunc = true;
char dataString[STRING_LEN]; char dataString[TSDB_MAX_BYTES_PER_ROW];
char **data_type = g_args.datatype; char **data_type = g_args.datatype;
memset(dataString, 0, STRING_LEN); memset(dataString, 0, TSDB_MAX_BYTES_PER_ROW);
if (strcasecmp(data_type[0], "BINARY") == 0 if (strcasecmp(data_type[0], "BINARY") == 0
|| strcasecmp(data_type[0], "BOOL") == 0 || strcasecmp(data_type[0], "BOOL") == 0
...@@ -8146,7 +8148,7 @@ static void querySqlFile(TAOS* taos, char* sqlFile) ...@@ -8146,7 +8148,7 @@ static void querySqlFile(TAOS* taos, char* sqlFile)
} }
int read_len = 0; int read_len = 0;
char * cmd = calloc(1, MAX_SQL_SIZE); char * cmd = calloc(1, TSDB_MAX_BYTES_PER_ROW);
size_t cmd_len = 0; size_t cmd_len = 0;
char * line = NULL; char * line = NULL;
size_t line_len = 0; size_t line_len = 0;
...@@ -8154,7 +8156,7 @@ static void querySqlFile(TAOS* taos, char* sqlFile) ...@@ -8154,7 +8156,7 @@ static void querySqlFile(TAOS* taos, char* sqlFile)
double t = taosGetTimestampMs(); double t = taosGetTimestampMs();
while((read_len = tgetline(&line, &line_len, fp)) != -1) { while((read_len = tgetline(&line, &line_len, fp)) != -1) {
if (read_len >= MAX_SQL_SIZE) continue; if (read_len >= TSDB_MAX_BYTES_PER_ROW) continue;
line[--read_len] = '\0'; line[--read_len] = '\0';
if (read_len == 0 || isCommentLine(line)) { // line starts with # if (read_len == 0 || isCommentLine(line)) { // line starts with #
...@@ -8177,7 +8179,7 @@ static void querySqlFile(TAOS* taos, char* sqlFile) ...@@ -8177,7 +8179,7 @@ static void querySqlFile(TAOS* taos, char* sqlFile)
tmfclose(fp); tmfclose(fp);
return; return;
} }
memset(cmd, 0, MAX_SQL_SIZE); memset(cmd, 0, TSDB_MAX_BYTES_PER_ROW);
cmd_len = 0; cmd_len = 0;
} }
......
...@@ -194,12 +194,12 @@ class TDTestCase: ...@@ -194,12 +194,12 @@ class TDTestCase:
tdSql.checkRows(680) tdSql.checkRows(680)
tdSql.query( tdSql.query(
"select diff(col1) from t0 where t0.ts >= '1970-01-01 00:00:00.000' " "select diff(c1) from t0 where t0.ts >= '1970-01-01 00:00:00.000' "
) )
tdSql.checkRows(679) tdSql.checkRows(679)
tdSql.query( tdSql.query(
"select t0,col1 from stb2 where stb2.ts < '1970-01-01 00:00:00.000' order by ts" "select t0,c1 from stb2 where stb2.ts < '1970-01-01 00:00:00.000' order by ts"
) )
tdSql.checkRows(43200) tdSql.checkRows(43200)
......
...@@ -76,7 +76,7 @@ class TDTestCase: ...@@ -76,7 +76,7 @@ class TDTestCase:
% (1600000000000 + i, i, -10000+i, i)) % (1600000000000 + i, i, -10000+i, i))
tdSql.execute('''insert into stb00_100 values(%d, %d, %d,'test90.%s')''' tdSql.execute('''insert into stb00_100 values(%d, %d, %d,'test90.%s')'''
% (1600000000000 + i, i, -10000+i, i)) % (1600000000000 + i, i, -10000+i, i))
tdSql.query("select * from stb0 where col2 like 'test99%' ") tdSql.query("select * from stb0 where c2 like 'test99%' ")
tdSql.checkRows(1000) tdSql.checkRows(1000)
tdSql.query("select * from stb0 where tbname like 'stb00_9999' limit 10" ) tdSql.query("select * from stb0 where tbname like 'stb00_9999' limit 10" )
tdSql.checkData(0, 1, 0) tdSql.checkData(0, 1, 0)
...@@ -86,7 +86,7 @@ class TDTestCase: ...@@ -86,7 +86,7 @@ class TDTestCase:
tdSql.checkData(0, 1, 5) tdSql.checkData(0, 1, 5)
tdSql.checkData(1, 1, 6) tdSql.checkData(1, 1, 6)
tdSql.checkData(2, 1, 7) tdSql.checkData(2, 1, 7)
tdSql.query("select * from stb0 where col2 like 'test98%' ") tdSql.query("select * from stb0 where c2 like 'test98%' ")
tdSql.checkRows(1000) tdSql.checkRows(1000)
tdSql.query("select * from stb0 where tbname like 'stb00_8888' limit 10" ) tdSql.query("select * from stb0 where tbname like 'stb00_8888' limit 10" )
tdSql.checkData(0, 1, 0) tdSql.checkData(0, 1, 0)
...@@ -96,7 +96,7 @@ class TDTestCase: ...@@ -96,7 +96,7 @@ class TDTestCase:
tdSql.checkData(0, 1, 5) tdSql.checkData(0, 1, 5)
tdSql.checkData(1, 1, 6) tdSql.checkData(1, 1, 6)
tdSql.checkData(2, 1, 7) tdSql.checkData(2, 1, 7)
tdSql.query("select * from stb0 where col2 like 'test97%' ") tdSql.query("select * from stb0 where c2 like 'test97%' ")
tdSql.checkRows(1000) tdSql.checkRows(1000)
tdSql.query("select * from stb0 where tbname like 'stb00_7777' limit 10" ) tdSql.query("select * from stb0 where tbname like 'stb00_7777' limit 10" )
tdSql.checkData(0, 1, 0) tdSql.checkData(0, 1, 0)
...@@ -106,7 +106,7 @@ class TDTestCase: ...@@ -106,7 +106,7 @@ class TDTestCase:
tdSql.checkData(0, 1, 5) tdSql.checkData(0, 1, 5)
tdSql.checkData(1, 1, 6) tdSql.checkData(1, 1, 6)
tdSql.checkData(2, 1, 7) tdSql.checkData(2, 1, 7)
tdSql.query("select * from stb0 where col2 like 'test96%' ") tdSql.query("select * from stb0 where c2 like 'test96%' ")
tdSql.checkRows(1000) tdSql.checkRows(1000)
tdSql.query("select * from stb0 where tbname like 'stb00_6666' limit 10" ) tdSql.query("select * from stb0 where tbname like 'stb00_6666' limit 10" )
tdSql.checkData(0, 1, 0) tdSql.checkData(0, 1, 0)
...@@ -116,7 +116,7 @@ class TDTestCase: ...@@ -116,7 +116,7 @@ class TDTestCase:
tdSql.checkData(0, 1, 5) tdSql.checkData(0, 1, 5)
tdSql.checkData(1, 1, 6) tdSql.checkData(1, 1, 6)
tdSql.checkData(2, 1, 7) tdSql.checkData(2, 1, 7)
tdSql.query("select * from stb0 where col2 like 'test95%' ") tdSql.query("select * from stb0 where c2 like 'test95%' ")
tdSql.checkRows(1000) tdSql.checkRows(1000)
tdSql.query("select * from stb0 where tbname like 'stb00_5555' limit 10" ) tdSql.query("select * from stb0 where tbname like 'stb00_5555' limit 10" )
tdSql.checkData(0, 1, 0) tdSql.checkData(0, 1, 0)
...@@ -126,7 +126,7 @@ class TDTestCase: ...@@ -126,7 +126,7 @@ class TDTestCase:
tdSql.checkData(0, 1, 5) tdSql.checkData(0, 1, 5)
tdSql.checkData(1, 1, 6) tdSql.checkData(1, 1, 6)
tdSql.checkData(2, 1, 7) tdSql.checkData(2, 1, 7)
tdSql.query("select * from stb0 where col2 like 'test94%' ") tdSql.query("select * from stb0 where c2 like 'test94%' ")
tdSql.checkRows(1000) tdSql.checkRows(1000)
tdSql.query("select * from stb0 where tbname like 'stb00_4444' limit 10" ) tdSql.query("select * from stb0 where tbname like 'stb00_4444' limit 10" )
tdSql.checkData(0, 1, 0) tdSql.checkData(0, 1, 0)
...@@ -136,7 +136,7 @@ class TDTestCase: ...@@ -136,7 +136,7 @@ class TDTestCase:
tdSql.checkData(0, 1, 5) tdSql.checkData(0, 1, 5)
tdSql.checkData(1, 1, 6) tdSql.checkData(1, 1, 6)
tdSql.checkData(2, 1, 7) tdSql.checkData(2, 1, 7)
tdSql.query("select * from stb0 where col2 like 'test93%' ") tdSql.query("select * from stb0 where c2 like 'test93%' ")
tdSql.checkRows(1000) tdSql.checkRows(1000)
tdSql.query("select * from stb0 where tbname like 'stb00_3333' limit 100" ) tdSql.query("select * from stb0 where tbname like 'stb00_3333' limit 100" )
tdSql.checkData(0, 1, 0) tdSql.checkData(0, 1, 0)
...@@ -146,7 +146,7 @@ class TDTestCase: ...@@ -146,7 +146,7 @@ class TDTestCase:
tdSql.checkData(0, 1, 5) tdSql.checkData(0, 1, 5)
tdSql.checkData(1, 1, 6) tdSql.checkData(1, 1, 6)
tdSql.checkData(2, 1, 7) tdSql.checkData(2, 1, 7)
tdSql.query("select * from stb0 where col2 like 'test92%' ") tdSql.query("select * from stb0 where c2 like 'test92%' ")
tdSql.checkRows(1000) tdSql.checkRows(1000)
tdSql.query("select * from stb0 where tbname like 'stb00_2222' limit 100" ) tdSql.query("select * from stb0 where tbname like 'stb00_2222' limit 100" )
tdSql.checkData(0, 1, 0) tdSql.checkData(0, 1, 0)
...@@ -156,7 +156,7 @@ class TDTestCase: ...@@ -156,7 +156,7 @@ class TDTestCase:
tdSql.checkData(0, 1, 5) tdSql.checkData(0, 1, 5)
tdSql.checkData(1, 1, 6) tdSql.checkData(1, 1, 6)
tdSql.checkData(2, 1, 7) tdSql.checkData(2, 1, 7)
tdSql.query("select * from stb0 where col2 like 'test91%' ") tdSql.query("select * from stb0 where c2 like 'test91%' ")
tdSql.checkRows(1000) tdSql.checkRows(1000)
tdSql.query("select * from stb0 where tbname like 'stb00_1111' limit 100" ) tdSql.query("select * from stb0 where tbname like 'stb00_1111' limit 100" )
tdSql.checkData(0, 1, 0) tdSql.checkData(0, 1, 0)
...@@ -166,7 +166,7 @@ class TDTestCase: ...@@ -166,7 +166,7 @@ class TDTestCase:
tdSql.checkData(0, 1, 5) tdSql.checkData(0, 1, 5)
tdSql.checkData(1, 1, 6) tdSql.checkData(1, 1, 6)
tdSql.checkData(2, 1, 7) tdSql.checkData(2, 1, 7)
tdSql.query("select * from stb0 where col2 like 'test90%' ") tdSql.query("select * from stb0 where c2 like 'test90%' ")
tdSql.checkRows(1000) tdSql.checkRows(1000)
tdSql.query("select * from stb0 where tbname like 'stb00_100' limit 100" ) tdSql.query("select * from stb0 where tbname like 'stb00_100' limit 100" )
tdSql.checkData(0, 1, 0) tdSql.checkData(0, 1, 0)
...@@ -177,11 +177,8 @@ class TDTestCase: ...@@ -177,11 +177,8 @@ class TDTestCase:
tdSql.checkData(1, 1, 6) tdSql.checkData(1, 1, 6)
tdSql.checkData(2, 1, 7) tdSql.checkData(2, 1, 7)
os.system("rm -rf tools/taosdemoAllTest/TD-4985/query-limit-offset.py.sql") os.system("rm -rf tools/taosdemoAllTest/TD-4985/query-limit-offset.py.sql")
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success("%s successfully executed" % __file__) tdLog.success("%s successfully executed" % __file__)
......
...@@ -262,7 +262,7 @@ class TDTestCase: ...@@ -262,7 +262,7 @@ class TDTestCase:
# insert: sample json # insert: sample json
os.system("%staosdemo -f tools/taosdemoAllTest/insert-sample.json -y " % binPath) os.system("%staosdemo -f tools/taosdemoAllTest/insert-sample.json -y " % binPath)
tdSql.execute("use dbtest123") tdSql.execute("use dbtest123")
tdSql.query("select col2 from stb0") tdSql.query("select c2 from stb0")
tdSql.checkData(0, 0, 2147483647) tdSql.checkData(0, 0, 2147483647)
tdSql.query("select * from stb1 where t1=-127") tdSql.query("select * from stb1 where t1=-127")
tdSql.checkRows(20) tdSql.checkRows(20)
...@@ -319,8 +319,6 @@ class TDTestCase: ...@@ -319,8 +319,6 @@ class TDTestCase:
os.system("rm -rf ./insert_res.txt") os.system("rm -rf ./insert_res.txt")
os.system("rm -rf tools/taosdemoAllTest/taosdemoTestInsertWithJson.py.sql") os.system("rm -rf tools/taosdemoAllTest/taosdemoTestInsertWithJson.py.sql")
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success("%s successfully executed" % __file__) tdLog.success("%s successfully executed" % __file__)
......
...@@ -59,11 +59,11 @@ class TDTestCase: ...@@ -59,11 +59,11 @@ class TDTestCase:
tdSql.checkData(0, 0, self.numberOfTables * self.numberOfRecords) tdSql.checkData(0, 0, self.numberOfTables * self.numberOfRecords)
tdSql.query( tdSql.query(
"select sum(col1) from test.meters interval(1h) sliding(30m)") "select sum(c1) from test.meters interval(1h) sliding(30m)")
tdSql.checkRows(2) tdSql.checkRows(2)
tdSql.query( tdSql.query(
"select apercentile(col1, 1) from test.meters interval(100s)") "select apercentile(c1, 1) from test.meters interval(100s)")
tdSql.checkRows(1) tdSql.checkRows(1)
tdSql.error("select loc, count(loc) from test.meters") tdSql.error("select loc, count(loc) from test.meters")
......
...@@ -98,8 +98,8 @@ class TDTestCase: ...@@ -98,8 +98,8 @@ class TDTestCase:
break break
time.sleep(1) time.sleep(1)
print("alter table test.meters add column col10 int") print("alter table test.meters add column c10 int")
tdSql.execute("alter table test.meters add column col10 int") tdSql.execute("alter table test.meters add column c10 int")
print("insert into test.t9 values (now, 1, 2, 3, 4, 0)") print("insert into test.t9 values (now, 1, 2, 3, 4, 0)")
tdSql.execute("insert into test.t9 values (now, 1, 2, 3, 4, 0)") tdSql.execute("insert into test.t9 values (now, 1, 2, 3, 4, 0)")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册