提交 65206793 编写于 作者: G Ganlin Zhao

Merge branch 'develop' into enhance/TD-6645

......@@ -45,6 +45,7 @@ echo "version=${version}"
#docker manifest rm tdengine/tdengine:${version}
if [ "$verType" == "beta" ]; then
docker manifest inspect tdengine/tdengine-beta:latest
docker manifest create -a tdengine/tdengine-beta:latest tdengine/tdengine-amd64-beta:latest tdengine/tdengine-aarch64-beta:latest tdengine/tdengine-aarch32-beta:latest
docker manifest rm tdengine/tdengine-beta:latest
docker manifest create -a tdengine/tdengine-beta:${version} tdengine/tdengine-amd64-beta:${version} tdengine/tdengine-aarch64-beta:${version} tdengine/tdengine-aarch32-beta:${version}
docker manifest create -a tdengine/tdengine-beta:latest tdengine/tdengine-amd64-beta:latest tdengine/tdengine-aarch64-beta:latest tdengine/tdengine-aarch32-beta:latest
......@@ -54,6 +55,7 @@ if [ "$verType" == "beta" ]; then
elif [ "$verType" == "stable" ]; then
docker manifest inspect tdengine/tdengine:latest
docker manifest create -a tdengine/tdengine:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest
docker manifest rm tdengine/tdengine:latest
docker manifest create -a tdengine/tdengine:${version} tdengine/tdengine-amd64:${version} tdengine/tdengine-aarch64:${version} tdengine/tdengine-aarch32:${version}
docker manifest create -a tdengine/tdengine:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest
......
......@@ -4399,7 +4399,16 @@ static int32_t validateMatchExpr(tSqlExpr* pExpr, STableMeta* pTableMeta, int32_
regex_t regex;
char regErrBuf[256] = {0};
const char* pattern = pRight->value.pz;
//remove the quote at the begin end of original sql string.
uint32_t lenPattern = pRight->exprToken.n - 2;
char* pattern = malloc(lenPattern + 1);
strncpy(pattern, pRight->exprToken.z+1, lenPattern);
pattern[lenPattern] = '\0';
tfree(pRight->value.pz);
pRight->value.pz = pattern;
pRight->value.nLen = lenPattern;
int cflags = REG_EXTENDED;
if ((errCode = regcomp(&regex, pattern, cflags)) != 0) {
regerror(errCode, &regex, regErrBuf, sizeof(regErrBuf));
......
......@@ -79,10 +79,10 @@ extern char configDir[];
#define DEFAULT_START_TIME 1500000000000
#define MAX_PREPARED_RAND 1000000
#define INT_BUFF_LEN 11
#define INT_BUFF_LEN 12
#define BIGINT_BUFF_LEN 21
#define SMALLINT_BUFF_LEN 6
#define TINYINT_BUFF_LEN 4
#define SMALLINT_BUFF_LEN 7
#define TINYINT_BUFF_LEN 5
#define BOOL_BUFF_LEN 6
#define FLOAT_BUFF_LEN 22
#define DOUBLE_BUFF_LEN 42
......@@ -590,16 +590,22 @@ static void init_rand_data();
/* ************ Global variables ************ */
int32_t g_randint[MAX_PREPARED_RAND];
uint32_t g_randuint[MAX_PREPARED_RAND];
int64_t g_randbigint[MAX_PREPARED_RAND];
uint64_t g_randubigint[MAX_PREPARED_RAND];
float g_randfloat[MAX_PREPARED_RAND];
double g_randdouble[MAX_PREPARED_RAND];
char *g_randbool_buff = NULL;
char *g_randint_buff = NULL;
char *g_randuint_buff = NULL;
char *g_rand_voltage_buff = NULL;
char *g_randbigint_buff = NULL;
char *g_randubigint_buff = NULL;
char *g_randsmallint_buff = NULL;
char *g_randusmallint_buff = NULL;
char *g_randtinyint_buff = NULL;
char *g_randutinyint_buff = NULL;
char *g_randfloat_buff = NULL;
char *g_rand_current_buff = NULL;
char *g_rand_phase_buff = NULL;
......@@ -1575,7 +1581,11 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
&& strcasecmp(dataType, "DOUBLE")
&& strcasecmp(dataType, "BINARY")
&& strcasecmp(dataType, "TIMESTAMP")
&& strcasecmp(dataType, "NCHAR")) {
&& strcasecmp(dataType, "NCHAR")
&& strcasecmp(dataType, "UTINYINT")
&& strcasecmp(dataType, "USMALLINT")
&& strcasecmp(dataType, "UINT")
&& strcasecmp(dataType, "UBIGINT")) {
printHelp();
errorPrint("%s", "-b: Invalid data_type!\n");
exit(EXIT_FAILURE);
......@@ -1601,6 +1611,14 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
arguments->data_type[0] = TSDB_DATA_TYPE_BOOL;
} else if (0 == strcasecmp(dataType, "TIMESTAMP")) {
arguments->data_type[0] = TSDB_DATA_TYPE_TIMESTAMP;
} else if (0 == strcasecmp(dataType, "UTINYINT")) {
arguments->data_type[0] = TSDB_DATA_TYPE_UTINYINT;
} else if (0 == strcasecmp(dataType, "USMALLINT")) {
arguments->data_type[0] = TSDB_DATA_TYPE_USMALLINT;
} else if (0 == strcasecmp(dataType, "UINT")) {
arguments->data_type[0] = TSDB_DATA_TYPE_UINT;
} else if (0 == strcasecmp(dataType, "UBIGINT")) {
arguments->data_type[0] = TSDB_DATA_TYPE_UBIGINT;
} else {
arguments->data_type[0] = TSDB_DATA_TYPE_NULL;
}
......@@ -1622,7 +1640,11 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
&& strcasecmp(token, "DOUBLE")
&& strcasecmp(token, "BINARY")
&& strcasecmp(token, "TIMESTAMP")
&& strcasecmp(token, "NCHAR")) {
&& strcasecmp(token, "NCHAR")
&& strcasecmp(token, "UTINYINT")
&& strcasecmp(token, "USMALLINT")
&& strcasecmp(token, "UINT")
&& strcasecmp(token, "UBIGINT")) {
printHelp();
free(g_dupstr);
errorPrint("%s", "-b: Invalid data_type!\n");
......@@ -1638,7 +1660,7 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
} else if (0 == strcasecmp(token, "BIGINT")) {
arguments->data_type[index] = TSDB_DATA_TYPE_BIGINT;
} else if (0 == strcasecmp(token, "DOUBLE")) {
arguments->data_type[index] = TSDB_DATA_TYPE_FLOAT;
arguments->data_type[index] = TSDB_DATA_TYPE_DOUBLE;
} else if (0 == strcasecmp(token, "TINYINT")) {
arguments->data_type[index] = TSDB_DATA_TYPE_TINYINT;
} else if (0 == strcasecmp(token, "BINARY")) {
......@@ -1649,6 +1671,14 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
arguments->data_type[index] = TSDB_DATA_TYPE_BOOL;
} else if (0 == strcasecmp(token, "TIMESTAMP")) {
arguments->data_type[index] = TSDB_DATA_TYPE_TIMESTAMP;
} else if (0 == strcasecmp(token, "UTINYINT")) {
arguments->data_type[index] = TSDB_DATA_TYPE_UTINYINT;
} else if (0 == strcasecmp(token, "USMALLINT")) {
arguments->data_type[index] = TSDB_DATA_TYPE_USMALLINT;
} else if (0 == strcasecmp(token, "UINT")) {
arguments->data_type[index] = TSDB_DATA_TYPE_UINT;
} else if (0 == strcasecmp(token, "UBIGINT")) {
arguments->data_type[index] = TSDB_DATA_TYPE_UBIGINT;
} else {
arguments->data_type[index] = TSDB_DATA_TYPE_NULL;
}
......@@ -1952,18 +1982,22 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
break;
case TSDB_DATA_TYPE_INT:
case TSDB_DATA_TYPE_UINT:
g_args.lenOfOneRow += INT_BUFF_LEN;
break;
case TSDB_DATA_TYPE_BIGINT:
case TSDB_DATA_TYPE_UBIGINT:
g_args.lenOfOneRow += BIGINT_BUFF_LEN;
break;
case TSDB_DATA_TYPE_SMALLINT:
case TSDB_DATA_TYPE_USMALLINT:
g_args.lenOfOneRow += SMALLINT_BUFF_LEN;
break;
case TSDB_DATA_TYPE_TINYINT:
case TSDB_DATA_TYPE_UTINYINT:
g_args.lenOfOneRow += TINYINT_BUFF_LEN;
break;
......@@ -2195,6 +2229,23 @@ static int32_t rand_tinyint()
return g_randint[cursor % MAX_PREPARED_RAND] % 128;
}
static char *rand_utinyint_str()
{
static int cursor;
cursor++;
if (cursor > (MAX_PREPARED_RAND - 1)) cursor = 0;
return g_randutinyint_buff +
((cursor % MAX_PREPARED_RAND) * TINYINT_BUFF_LEN);
}
static int32_t rand_utinyint()
{
static int cursor;
cursor++;
if (cursor > (MAX_PREPARED_RAND - 1)) cursor = 0;
return g_randuint[cursor % MAX_PREPARED_RAND] % 255;
}
static char *rand_smallint_str()
{
static int cursor;
......@@ -2209,7 +2260,24 @@ static int32_t rand_smallint()
static int cursor;
cursor++;
if (cursor > (MAX_PREPARED_RAND - 1)) cursor = 0;
return g_randint[cursor % MAX_PREPARED_RAND] % 32767;
return g_randint[cursor % MAX_PREPARED_RAND] % 32768;
}
static char *rand_usmallint_str()
{
static int cursor;
cursor++;
if (cursor > (MAX_PREPARED_RAND - 1)) cursor = 0;
return g_randusmallint_buff +
((cursor % MAX_PREPARED_RAND) * SMALLINT_BUFF_LEN);
}
static int32_t rand_usmallint()
{
static int cursor;
cursor++;
if (cursor > (MAX_PREPARED_RAND - 1)) cursor = 0;
return g_randuint[cursor % MAX_PREPARED_RAND] % 65535;
}
static char *rand_int_str()
......@@ -2228,6 +2296,22 @@ static int32_t rand_int()
return g_randint[cursor % MAX_PREPARED_RAND];
}
static char *rand_uint_str()
{
static int cursor;
cursor++;
if (cursor > (MAX_PREPARED_RAND - 1)) cursor = 0;
return g_randuint_buff + ((cursor % MAX_PREPARED_RAND) * INT_BUFF_LEN);
}
static int32_t rand_uint()
{
static int cursor;
cursor++;
if (cursor > (MAX_PREPARED_RAND - 1)) cursor = 0;
return g_randuint[cursor % MAX_PREPARED_RAND];
}
static char *rand_bigint_str()
{
static int cursor;
......@@ -2245,6 +2329,23 @@ static int64_t rand_bigint()
return g_randbigint[cursor % MAX_PREPARED_RAND];
}
static char *rand_ubigint_str()
{
static int cursor;
cursor++;
if (cursor > (MAX_PREPARED_RAND - 1)) cursor = 0;
return g_randubigint_buff +
((cursor % MAX_PREPARED_RAND) * BIGINT_BUFF_LEN);
}
static int64_t rand_ubigint()
{
static int cursor;
cursor++;
if (cursor > (MAX_PREPARED_RAND - 1)) cursor = 0;
return g_randubigint[cursor % MAX_PREPARED_RAND];
}
static char *rand_float_str()
{
static int cursor;
......@@ -2382,9 +2483,18 @@ static void init_rand_data() {
assert(g_rand_phase_buff);
g_randdouble_buff = calloc(1, DOUBLE_BUFF_LEN * MAX_PREPARED_RAND);
assert(g_randdouble_buff);
g_randuint_buff = calloc(1, INT_BUFF_LEN * MAX_PREPARED_RAND);
assert(g_randuint_buff);
g_randutinyint_buff = calloc(1, TINYINT_BUFF_LEN * MAX_PREPARED_RAND);
assert(g_randutinyint_buff);
g_randusmallint_buff = calloc(1, SMALLINT_BUFF_LEN * MAX_PREPARED_RAND);
assert(g_randusmallint_buff);
g_randubigint_buff = calloc(1, BIGINT_BUFF_LEN * MAX_PREPARED_RAND);
assert(g_randubigint_buff);
for (int i = 0; i < MAX_PREPARED_RAND; i++) {
g_randint[i] = (int)(taosRandom() % 65535);
g_randint[i] = (int)(taosRandom() % RAND_MAX - (RAND_MAX >> 1));
g_randuint[i] = (int)(taosRandom());
sprintf(g_randint_buff + i * INT_BUFF_LEN, "%d",
g_randint[i]);
sprintf(g_rand_voltage_buff + i * INT_BUFF_LEN, "%d",
......@@ -2393,15 +2503,24 @@ static void init_rand_data() {
sprintf(g_randbool_buff + i * BOOL_BUFF_LEN, "%s",
((g_randint[i] % 2) & 1)?"true":"false");
sprintf(g_randsmallint_buff + i * SMALLINT_BUFF_LEN, "%d",
g_randint[i] % 32767);
g_randint[i] % 32768);
sprintf(g_randtinyint_buff + i * TINYINT_BUFF_LEN, "%d",
g_randint[i] % 128);
g_randbigint[i] = (int64_t)(taosRandom() % 2147483648);
sprintf(g_randuint_buff + i * INT_BUFF_LEN, "%d",
g_randuint[i]);
sprintf(g_randusmallint_buff + i * SMALLINT_BUFF_LEN, "%d",
g_randuint[i] % 65535);
sprintf(g_randutinyint_buff + i * TINYINT_BUFF_LEN, "%d",
g_randuint[i] % 255);
g_randbigint[i] = (int64_t)(taosRandom() % RAND_MAX - (RAND_MAX >> 1));
g_randubigint[i] = (uint64_t)(taosRandom());
sprintf(g_randbigint_buff + i * BIGINT_BUFF_LEN, "%"PRId64"",
g_randbigint[i]);
sprintf(g_randubigint_buff + i * BIGINT_BUFF_LEN, "%"PRId64"",
g_randubigint[i]);
g_randfloat[i] = (float)(taosRandom() / 1000.0);
g_randfloat[i] = (float)(taosRandom() / 1000.0) * (taosRandom() % 2 > 0.5 ? 1 : -1);
sprintf(g_randfloat_buff + i * FLOAT_BUFF_LEN, "%f",
g_randfloat[i]);
sprintf(g_rand_current_buff + i * FLOAT_BUFF_LEN, "%f",
......@@ -2411,7 +2530,7 @@ static void init_rand_data() {
(float)((115 + g_randint[i] % 10
+ g_randfloat[i]/1000000000)/360));
g_randdouble[i] = (double)(taosRandom() / 1000000.0);
g_randdouble[i] = (double)(taosRandom() / 1000000.0) * (taosRandom() % 2 > 0.5 ? 1 : -1);
sprintf(g_randdouble_buff + i * DOUBLE_BUFF_LEN, "%f",
g_randdouble[i]);
}
......@@ -2974,18 +3093,34 @@ static void xDumpFieldToFile(FILE* fp, const char* val,
fprintf(fp, "%d", *((int8_t *)val));
break;
case TSDB_DATA_TYPE_UTINYINT:
fprintf(fp, "%d", *((uint8_t *)val));
break;
case TSDB_DATA_TYPE_SMALLINT:
fprintf(fp, "%d", *((int16_t *)val));
break;
case TSDB_DATA_TYPE_USMALLINT:
fprintf(fp, "%d", *((uint16_t *)val));
break;
case TSDB_DATA_TYPE_INT:
fprintf(fp, "%d", *((int32_t *)val));
break;
case TSDB_DATA_TYPE_UINT:
fprintf(fp, "%d", *((uint32_t *)val));
break;
case TSDB_DATA_TYPE_BIGINT:
fprintf(fp, "%"PRId64"", *((int64_t *)val));
break;
case TSDB_DATA_TYPE_UBIGINT:
fprintf(fp, "%"PRId64"", *((uint64_t *)val));
break;
case TSDB_DATA_TYPE_FLOAT:
fprintf(fp, "%.5f", GET_FLOAT_VAL(val));
break;
......@@ -3472,7 +3607,23 @@ static char* generateTagValuesForStb(SSuperTable* stbInfo, int64_t tableSeq) {
} else if (0 == strncasecmp(stbInfo->tags[i].dataType,
"timestamp", strlen("timestamp"))) {
dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
"%"PRId64",", rand_bigint());
"%"PRId64",", rand_ubigint());
} else if (0 == strncasecmp(stbInfo->tags[i].dataType,
"utinyint", strlen("utinyint"))) {
dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
"%d,", rand_utinyint());
} else if (0 == strncasecmp(stbInfo->tags[i].dataType,
"usmallint", strlen("usmallint"))) {
dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
"%d,", rand_usmallint());
} else if (0 == strncasecmp(stbInfo->tags[i].dataType,
"uint", strlen("uint"))) {
dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
"%d,", rand_uint());
} else if (0 == strncasecmp(stbInfo->tags[i].dataType,
"ubigint", strlen("ubigint"))) {
dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
"%"PRId64",", rand_ubigint());
} else {
errorPrint2("No support data type: %s\n", stbInfo->tags[i].dataType);
tmfree(dataBuf);
......@@ -3502,18 +3653,22 @@ static int calcRowLen(SSuperTable* superTbls) {
break;
case TSDB_DATA_TYPE_INT:
case TSDB_DATA_TYPE_UINT:
lenOfOneRow += INT_BUFF_LEN;
break;
case TSDB_DATA_TYPE_BIGINT:
case TSDB_DATA_TYPE_UBIGINT:
lenOfOneRow += BIGINT_BUFF_LEN;
break;
case TSDB_DATA_TYPE_SMALLINT:
case TSDB_DATA_TYPE_USMALLINT:
lenOfOneRow += SMALLINT_BUFF_LEN;
break;
case TSDB_DATA_TYPE_TINYINT:
case TSDB_DATA_TYPE_UTINYINT:
lenOfOneRow += TINYINT_BUFF_LEN;
break;
......@@ -3544,27 +3699,41 @@ static int calcRowLen(SSuperTable* superTbls) {
int tagIndex;
int lenOfTagOfOneRow = 0;
for (tagIndex = 0; tagIndex < superTbls->tagCount; tagIndex++) {
char* dataType = superTbls->tags[tagIndex].dataType;
if (strcasecmp(dataType, "BINARY") == 0) {
char * dataType = superTbls->tags[tagIndex].dataType;
switch (superTbls->tags[tagIndex].data_type)
{
case TSDB_DATA_TYPE_BINARY:
lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 3;
} else if (strcasecmp(dataType, "NCHAR") == 0) {
break;
case TSDB_DATA_TYPE_NCHAR:
lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + 3;
} else if (strcasecmp(dataType, "INT") == 0) {
break;
case TSDB_DATA_TYPE_INT:
case TSDB_DATA_TYPE_UINT:
lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + INT_BUFF_LEN;
} else if (strcasecmp(dataType, "BIGINT") == 0) {
break;
case TSDB_DATA_TYPE_BIGINT:
case TSDB_DATA_TYPE_UBIGINT:
lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + BIGINT_BUFF_LEN;
} else if (strcasecmp(dataType, "SMALLINT") == 0) {
break;
case TSDB_DATA_TYPE_SMALLINT:
case TSDB_DATA_TYPE_USMALLINT:
lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + SMALLINT_BUFF_LEN;
} else if (strcasecmp(dataType, "TINYINT") == 0) {
break;
case TSDB_DATA_TYPE_TINYINT:
case TSDB_DATA_TYPE_UTINYINT:
lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + TINYINT_BUFF_LEN;
} else if (strcasecmp(dataType, "BOOL") == 0) {
break;
case TSDB_DATA_TYPE_BOOL:
lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + BOOL_BUFF_LEN;
} else if (strcasecmp(dataType, "FLOAT") == 0) {
break;
case TSDB_DATA_TYPE_FLOAT:
lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + FLOAT_BUFF_LEN;
} else if (strcasecmp(dataType, "DOUBLE") == 0) {
break;
case TSDB_DATA_TYPE_DOUBLE:
lenOfTagOfOneRow += superTbls->tags[tagIndex].dataLen + DOUBLE_BUFF_LEN;
} else {
break;
default:
errorPrint2("get error tag type : %s\n", dataType);
exit(EXIT_FAILURE);
}
......@@ -3697,40 +3866,60 @@ static int getSuperTableFromServer(TAOS * taos, char* dbName,
tstrncpy(superTbls->tags[tagIndex].field,
(char *)row[TSDB_DESCRIBE_METRIC_FIELD_INDEX],
fields[TSDB_DESCRIBE_METRIC_FIELD_INDEX].bytes);
tstrncpy(superTbls->tags[tagIndex].dataType,
(char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
min(DATATYPE_BUFF_LEN,
fields[TSDB_DESCRIBE_METRIC_TYPE_INDEX].bytes) + 1);
if (0 == strncasecmp(superTbls->tags[tagIndex].dataType,
if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"INT", strlen("INT"))) {
superTbls->tags[tagIndex].data_type = TSDB_DATA_TYPE_INT;
} else if (0 == strncasecmp(superTbls->tags[tagIndex].dataType,
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"TINYINT", strlen("TINYINT"))) {
superTbls->tags[tagIndex].data_type = TSDB_DATA_TYPE_TINYINT;
} else if (0 == strncasecmp(superTbls->tags[tagIndex].dataType,
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"SMALLINT", strlen("SMALLINT"))) {
superTbls->tags[tagIndex].data_type = TSDB_DATA_TYPE_SMALLINT;
} else if (0 == strncasecmp(superTbls->tags[tagIndex].dataType,
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"BIGINT", strlen("BIGINT"))) {
superTbls->tags[tagIndex].data_type = TSDB_DATA_TYPE_BIGINT;
} else if (0 == strncasecmp(superTbls->tags[tagIndex].dataType,
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"FLOAT", strlen("FLOAT"))) {
superTbls->tags[tagIndex].data_type = TSDB_DATA_TYPE_FLOAT;
} else if (0 == strncasecmp(superTbls->tags[tagIndex].dataType,
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"DOUBLE", strlen("DOUBLE"))) {
superTbls->tags[tagIndex].data_type = TSDB_DATA_TYPE_DOUBLE;
} else if (0 == strncasecmp(superTbls->tags[tagIndex].dataType,
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"BINARY", strlen("BINARY"))) {
superTbls->tags[tagIndex].data_type = TSDB_DATA_TYPE_BINARY;
} else if (0 == strncasecmp(superTbls->tags[tagIndex].dataType,
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"NCHAR", strlen("NCHAR"))) {
superTbls->tags[tagIndex].data_type = TSDB_DATA_TYPE_NCHAR;
} else if (0 == strncasecmp(superTbls->tags[tagIndex].dataType,
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"BOOL", strlen("BOOL"))) {
superTbls->tags[tagIndex].data_type = TSDB_DATA_TYPE_BOOL;
} else if (0 == strncasecmp(superTbls->tags[tagIndex].dataType,
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"TIMESTAMP", strlen("TIMESTAMP"))) {
superTbls->tags[tagIndex].data_type = TSDB_DATA_TYPE_TIMESTAMP;
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"TINYINT UNSIGNED", strlen("TINYINT UNSIGNED"))) {
superTbls->tags[tagIndex].data_type = TSDB_DATA_TYPE_UTINYINT;
tstrncpy(superTbls->tags[tagIndex].dataType,"UTINYINT",
min(DATATYPE_BUFF_LEN,
fields[TSDB_DESCRIBE_METRIC_TYPE_INDEX].bytes) + 1);
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"SMALLINT UNSIGNED", strlen("SMALLINT UNSIGNED"))) {
superTbls->tags[tagIndex].data_type = TSDB_DATA_TYPE_USMALLINT;
tstrncpy(superTbls->tags[tagIndex].dataType,"USMALLINT",
min(DATATYPE_BUFF_LEN,
fields[TSDB_DESCRIBE_METRIC_TYPE_INDEX].bytes) + 1);
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"INT UNSIGNED", strlen("INT UNSIGNED"))) {
superTbls->tags[tagIndex].data_type = TSDB_DATA_TYPE_UINT;
tstrncpy(superTbls->tags[tagIndex].dataType,"UINT",
min(DATATYPE_BUFF_LEN,
fields[TSDB_DESCRIBE_METRIC_TYPE_INDEX].bytes) + 1);
}else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"BIGINT UNSIGNED", strlen("BIGINT UNSIGNED"))) {
superTbls->tags[tagIndex].data_type = TSDB_DATA_TYPE_UBIGINT;
tstrncpy(superTbls->tags[tagIndex].dataType,"UBIGINT",
min(DATATYPE_BUFF_LEN,
fields[TSDB_DESCRIBE_METRIC_TYPE_INDEX].bytes) + 1);
} else {
superTbls->tags[tagIndex].data_type = TSDB_DATA_TYPE_NULL;
}
......@@ -3740,46 +3929,78 @@ static int getSuperTableFromServer(TAOS * taos, char* dbName,
(char *)row[TSDB_DESCRIBE_METRIC_NOTE_INDEX],
min(NOTE_BUFF_LEN,
fields[TSDB_DESCRIBE_METRIC_NOTE_INDEX].bytes) + 1);
if (strstr((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX], "UNSIGNED") == NULL)
{
tstrncpy(superTbls->tags[tagIndex].dataType,
(char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
min(DATATYPE_BUFF_LEN,
fields[TSDB_DESCRIBE_METRIC_TYPE_INDEX].bytes) + 1);
}
tagIndex++;
} else {
tstrncpy(superTbls->columns[columnIndex].field,
(char *)row[TSDB_DESCRIBE_METRIC_FIELD_INDEX],
fields[TSDB_DESCRIBE_METRIC_FIELD_INDEX].bytes);
tstrncpy(superTbls->columns[columnIndex].dataType,
(char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
min(DATATYPE_BUFF_LEN,
fields[TSDB_DESCRIBE_METRIC_TYPE_INDEX].bytes) + 1);
if (0 == strncasecmp(superTbls->columns[columnIndex].dataType,
"INT", strlen("INT"))) {
if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"INT", strlen("INT")) &&
strstr((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX], "UNSIGNED") == NULL) {
superTbls->columns[columnIndex].data_type = TSDB_DATA_TYPE_INT;
} else if (0 == strncasecmp(superTbls->columns[columnIndex].dataType,
"TINYINT", strlen("TINYINT"))) {
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"TINYINT", strlen("TINYINT")) &&
strstr((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX], "UNSIGNED") == NULL) {
superTbls->columns[columnIndex].data_type = TSDB_DATA_TYPE_TINYINT;
} else if (0 == strncasecmp(superTbls->columns[columnIndex].dataType,
"SMALLINT", strlen("SMALLINT"))) {
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"SMALLINT", strlen("SMALLINT")) &&
strstr((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX], "UNSIGNED") == NULL) {
superTbls->columns[columnIndex].data_type = TSDB_DATA_TYPE_SMALLINT;
} else if (0 == strncasecmp(superTbls->columns[columnIndex].dataType,
"BIGINT", strlen("BIGINT"))) {
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"BIGINT", strlen("BIGINT")) &&
strstr((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX], "UNSIGNED") == NULL) {
superTbls->columns[columnIndex].data_type = TSDB_DATA_TYPE_BIGINT;
} else if (0 == strncasecmp(superTbls->columns[columnIndex].dataType,
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"FLOAT", strlen("FLOAT"))) {
superTbls->columns[columnIndex].data_type = TSDB_DATA_TYPE_FLOAT;
} else if (0 == strncasecmp(superTbls->columns[columnIndex].dataType,
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"DOUBLE", strlen("DOUBLE"))) {
superTbls->columns[columnIndex].data_type = TSDB_DATA_TYPE_DOUBLE;
} else if (0 == strncasecmp(superTbls->columns[columnIndex].dataType,
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"BINARY", strlen("BINARY"))) {
superTbls->columns[columnIndex].data_type = TSDB_DATA_TYPE_BINARY;
} else if (0 == strncasecmp(superTbls->columns[columnIndex].dataType,
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"NCHAR", strlen("NCHAR"))) {
superTbls->columns[columnIndex].data_type = TSDB_DATA_TYPE_NCHAR;
} else if (0 == strncasecmp(superTbls->columns[columnIndex].dataType,
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"BOOL", strlen("BOOL"))) {
superTbls->columns[columnIndex].data_type = TSDB_DATA_TYPE_BOOL;
} else if (0 == strncasecmp(superTbls->columns[columnIndex].dataType,
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"TIMESTAMP", strlen("TIMESTAMP"))) {
superTbls->columns[columnIndex].data_type = TSDB_DATA_TYPE_TIMESTAMP;
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"TINYINT UNSIGNED", strlen("TINYINT UNSIGNED"))) {
superTbls->columns[columnIndex].data_type = TSDB_DATA_TYPE_UTINYINT;
tstrncpy(superTbls->columns[columnIndex].dataType,"UTINYINT",
min(DATATYPE_BUFF_LEN,
fields[TSDB_DESCRIBE_METRIC_TYPE_INDEX].bytes) + 1);
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"SMALLINT UNSIGNED", strlen("SMALLINT UNSIGNED"))) {
superTbls->columns[columnIndex].data_type = TSDB_DATA_TYPE_USMALLINT;
tstrncpy(superTbls->columns[columnIndex].dataType,"USMALLINT",
min(DATATYPE_BUFF_LEN,
fields[TSDB_DESCRIBE_METRIC_TYPE_INDEX].bytes) + 1);
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"INT UNSIGNED", strlen("INT UNSIGNED"))) {
superTbls->columns[columnIndex].data_type = TSDB_DATA_TYPE_UINT;
tstrncpy(superTbls->columns[columnIndex].dataType,"UINT",
min(DATATYPE_BUFF_LEN,
fields[TSDB_DESCRIBE_METRIC_TYPE_INDEX].bytes) + 1);
} else if (0 == strncasecmp((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
"BIGINT UNSIGNED", strlen("BIGINT UNSIGNED"))) {
superTbls->columns[columnIndex].data_type = TSDB_DATA_TYPE_UBIGINT;
tstrncpy(superTbls->columns[columnIndex].dataType,"UBIGINT",
min(DATATYPE_BUFF_LEN,
fields[TSDB_DESCRIBE_METRIC_TYPE_INDEX].bytes) + 1);
} else {
superTbls->columns[columnIndex].data_type = TSDB_DATA_TYPE_NULL;
}
......@@ -3790,6 +4011,13 @@ static int getSuperTableFromServer(TAOS * taos, char* dbName,
min(NOTE_BUFF_LEN,
fields[TSDB_DESCRIBE_METRIC_NOTE_INDEX].bytes) + 1);
if (strstr((char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX], "UNSIGNED") == NULL) {
tstrncpy(superTbls->columns[columnIndex].dataType,
(char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
min(DATATYPE_BUFF_LEN,
fields[TSDB_DESCRIBE_METRIC_TYPE_INDEX].bytes) + 1);
}
columnIndex++;
}
count++;
......@@ -3913,6 +4141,30 @@ static int createSuperTable(
lenOfOneRow += TIMESTAMP_BUFF_LEN;
break;
case TSDB_DATA_TYPE_UTINYINT:
len += snprintf(cols + len, COL_BUFFER_LEN - len, ",C%d %s",
colIndex, "TINYINT UNSIGNED");
lenOfOneRow += TINYINT_BUFF_LEN;
break;
case TSDB_DATA_TYPE_USMALLINT:
len += snprintf(cols + len, COL_BUFFER_LEN - len, ",C%d %s",
colIndex, "SMALLINT UNSIGNED");
lenOfOneRow += SMALLINT_BUFF_LEN;
break;
case TSDB_DATA_TYPE_UINT:
len += snprintf(cols + len, COL_BUFFER_LEN - len, ",C%d %s",
colIndex, "INT UNSIGNED");
lenOfOneRow += INT_BUFF_LEN;
break;
case TSDB_DATA_TYPE_UBIGINT:
len += snprintf(cols + len, COL_BUFFER_LEN - len, ",C%d %s",
colIndex, "BIGINT UNSIGNED");
lenOfOneRow += BIGINT_BUFF_LEN;
break;
default:
taos_close(taos);
free(command);
......@@ -4003,6 +4255,22 @@ static int createSuperTable(
len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len,
"T%d %s,", tagIndex, "DOUBLE");
lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + DOUBLE_BUFF_LEN;
} else if (strcasecmp(dataType, "UTINYINT") == 0) {
len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len,
"T%d %s,", tagIndex, "TINYINT UNSIGNED");
lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + TINYINT_BUFF_LEN;
} else if (strcasecmp(dataType, "USMALLINT") == 0) {
len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len,
"T%d %s,", tagIndex, "SMALLINT UNSIGNED");
lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + SMALLINT_BUFF_LEN;
} else if (strcasecmp(dataType, "UINT") == 0) {
len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len,
"T%d %s,", tagIndex, "INT UNSIGNED");
lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + INT_BUFF_LEN;
} else if (strcasecmp(dataType, "UBIGINT") == 0) {
len += snprintf(tags + len, TSDB_MAX_TAGS_LEN - len,
"T%d %s,", tagIndex, "BIGINT UNSIGNED");
lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + BIGINT_BUFF_LEN;
} else {
taos_close(taos);
free(command);
......@@ -4158,8 +4426,7 @@ int createDatabasesAndStables(char *command) {
errorPrint("create super table %"PRIu64" failed!\n\n", j);
continue;
}
}
} else {
ret = getSuperTableFromServer(taos, g_Dbs.db[i].dbName,
&g_Dbs.db[i].superTbls[j]);
if (0 != ret) {
......@@ -4167,10 +4434,9 @@ int createDatabasesAndStables(char *command) {
g_Dbs.db[i].dbName, g_Dbs.db[i].superTbls[j].stbName);
continue;
}
}
validStbCount ++;
}
g_Dbs.db[i].superTblCount = validStbCount;
}
......@@ -4663,6 +4929,18 @@ static bool getColumnAndTagTypeFromInsertJsonFile(
} else if (0 == strncasecmp(superTbls->columns[c].dataType,
"TIMESTAMP", strlen("TIMESTAMP"))) {
superTbls->columns[c].data_type = TSDB_DATA_TYPE_TIMESTAMP;
} else if (0 == strncasecmp(superTbls->columns[c].dataType,
"UTINYINT", strlen("UTINYINT"))) {
superTbls->columns[c].data_type = TSDB_DATA_TYPE_UTINYINT;
} else if (0 == strncasecmp(superTbls->columns[c].dataType,
"USMALLINT", strlen("USMALLINT"))) {
superTbls->columns[c].data_type = TSDB_DATA_TYPE_USMALLINT;
} else if (0 == strncasecmp(superTbls->columns[c].dataType,
"UINT", strlen("UINT"))) {
superTbls->columns[c].data_type = TSDB_DATA_TYPE_UINT;
} else if (0 == strncasecmp(superTbls->columns[c].dataType,
"UBIGINT", strlen("UBIGINT"))) {
superTbls->columns[c].data_type = TSDB_DATA_TYPE_UBIGINT;
} else {
superTbls->columns[c].data_type = TSDB_DATA_TYPE_NULL;
}
......@@ -4768,6 +5046,18 @@ static bool getColumnAndTagTypeFromInsertJsonFile(
} else if (0 == strncasecmp(superTbls->tags[t].dataType,
"TIMESTAMP", strlen("TIMESTAMP"))) {
superTbls->tags[t].data_type = TSDB_DATA_TYPE_TIMESTAMP;
} else if (0 == strncasecmp(superTbls->tags[t].dataType,
"UTINYINT", strlen("UTINYINT"))) {
superTbls->tags[t].data_type = TSDB_DATA_TYPE_UTINYINT;
} else if (0 == strncasecmp(superTbls->tags[t].dataType,
"USMALLINT", strlen("USMALLINT"))) {
superTbls->tags[t].data_type = TSDB_DATA_TYPE_USMALLINT;
} else if (0 == strncasecmp(superTbls->tags[t].dataType,
"UINT", strlen("UINT"))) {
superTbls->tags[t].data_type = TSDB_DATA_TYPE_UINT;
} else if (0 == strncasecmp(superTbls->tags[t].dataType,
"UBIGINT", strlen("UBIGINT"))) {
superTbls->tags[t].data_type = TSDB_DATA_TYPE_UBIGINT;
} else {
superTbls->tags[t].data_type = TSDB_DATA_TYPE_NULL;
}
......@@ -6185,9 +6475,22 @@ static int64_t generateStbRowData(
tstrncpy(pstr + dataLen, tmp, min(tmpLen + 1, INT_BUFF_LEN));
break;
case TSDB_DATA_TYPE_UINT:
tmp = rand_uint_str();
tmpLen = strlen(tmp);
tstrncpy(pstr + dataLen, tmp, min(tmpLen + 1, INT_BUFF_LEN));
break;
case TSDB_DATA_TYPE_BIGINT:
tmp = rand_bigint_str();
tstrncpy(pstr + dataLen, tmp, BIGINT_BUFF_LEN);
tmpLen = strlen(tmp);
tstrncpy(pstr + dataLen, tmp, min(tmpLen + 1, BIGINT_BUFF_LEN));
break;
case TSDB_DATA_TYPE_UBIGINT:
tmp = rand_ubigint_str();
tmpLen = strlen(tmp);
tstrncpy(pstr + dataLen, tmp, min(tmpLen + 1, BIGINT_BUFF_LEN));
break;
case TSDB_DATA_TYPE_FLOAT:
......@@ -6201,38 +6504,49 @@ static int64_t generateStbRowData(
tmp = rand_float_str();
}
tmpLen = strlen(tmp);
tstrncpy(pstr + dataLen, tmp, min(tmpLen +1, FLOAT_BUFF_LEN));
tstrncpy(pstr + dataLen, tmp, min(tmpLen + 1, FLOAT_BUFF_LEN));
break;
case TSDB_DATA_TYPE_DOUBLE:
tmp = rand_double_str();
tmpLen = strlen(tmp);
tstrncpy(pstr + dataLen, tmp, min(tmpLen +1, DOUBLE_BUFF_LEN));
tstrncpy(pstr + dataLen, tmp, min(tmpLen + 1, DOUBLE_BUFF_LEN));
break;
case TSDB_DATA_TYPE_SMALLINT:
tmp = rand_smallint_str();
tmpLen = strlen(tmp);
tstrncpy(pstr + dataLen, tmp,
min(tmpLen + 1, SMALLINT_BUFF_LEN));
tstrncpy(pstr + dataLen, tmp, min(tmpLen + 1, SMALLINT_BUFF_LEN));
break;
case TSDB_DATA_TYPE_USMALLINT:
tmp = rand_usmallint_str();
tmpLen = strlen(tmp);
tstrncpy(pstr + dataLen, tmp, min(tmpLen + 1, SMALLINT_BUFF_LEN));
break;
case TSDB_DATA_TYPE_TINYINT:
tmp = rand_tinyint_str();
tmpLen = strlen(tmp);
tstrncpy(pstr + dataLen, tmp, min(tmpLen +1, TINYINT_BUFF_LEN));
tstrncpy(pstr + dataLen, tmp, min(tmpLen + 1, TINYINT_BUFF_LEN));
break;
case TSDB_DATA_TYPE_UTINYINT:
tmp = rand_utinyint_str();
tmpLen = strlen(tmp);
tstrncpy(pstr + dataLen, tmp, min(tmpLen + 1, TINYINT_BUFF_LEN));
break;
case TSDB_DATA_TYPE_BOOL:
tmp = rand_bool_str();
tmpLen = strlen(tmp);
tstrncpy(pstr + dataLen, tmp, min(tmpLen +1, BOOL_BUFF_LEN));
tstrncpy(pstr + dataLen, tmp, min(tmpLen + 1, BOOL_BUFF_LEN));
break;
case TSDB_DATA_TYPE_TIMESTAMP:
tmp = rand_bigint_str();
tmpLen = strlen(tmp);
tstrncpy(pstr + dataLen, tmp, min(tmpLen +1, BIGINT_BUFF_LEN));
tstrncpy(pstr + dataLen, tmp, min(tmpLen + 1, BIGINT_BUFF_LEN));
break;
case TSDB_DATA_TYPE_NULL:
......@@ -6243,9 +6557,8 @@ static int64_t generateStbRowData(
stbInfo->columns[i].dataType);
exit(EXIT_FAILURE);
}
if (tmp) {
dataLen += strlen(tmp);
dataLen += tmpLen;
}
}
......@@ -6253,7 +6566,7 @@ static int64_t generateStbRowData(
return 0;
}
tstrncpy(pstr + dataLen, ")", 2);
dataLen += snprintf(pstr + dataLen, 2, ")");
verbosePrint("%s() LN%d, dataLen:%"PRId64"\n", __func__, __LINE__, dataLen);
verbosePrint("%s() LN%d, recBuf:\n\t%s\n", __func__, __LINE__, recBuf);
......@@ -6330,6 +6643,22 @@ static int64_t generateData(char *recBuf, char *data_type,
free(s);
break;
case TSDB_DATA_TYPE_UTINYINT:
pstr += sprintf(pstr, ",%d", rand_utinyint() );
break;
case TSDB_DATA_TYPE_USMALLINT:
pstr += sprintf(pstr, ",%d", rand_usmallint());
break;
case TSDB_DATA_TYPE_UINT:
pstr += sprintf(pstr, ",%d", rand_uint());
break;
case TSDB_DATA_TYPE_UBIGINT:
pstr += sprintf(pstr, ",%"PRId64"", rand_ubigint());
break;
case TSDB_DATA_TYPE_NULL:
break;
......@@ -6401,10 +6730,18 @@ static int generateSampleFromRand(
pos += sprintf(buff + pos, "%s,", tmp);
break;
case TSDB_DATA_TYPE_UINT:
pos += sprintf(buff + pos, "%s,", rand_uint_str());
break;
case TSDB_DATA_TYPE_BIGINT:
pos += sprintf(buff + pos, "%s,", rand_bigint_str());
break;
case TSDB_DATA_TYPE_UBIGINT:
pos += sprintf(buff + pos, "%s,", rand_ubigint_str());
break;
case TSDB_DATA_TYPE_FLOAT:
if (g_args.demo_mode) {
if (c == 0) {
......@@ -6426,10 +6763,18 @@ static int generateSampleFromRand(
pos += sprintf(buff + pos, "%s,", rand_smallint_str());
break;
case TSDB_DATA_TYPE_USMALLINT:
pos += sprintf(buff + pos, "%s,", rand_usmallint_str());
break;
case TSDB_DATA_TYPE_TINYINT:
pos += sprintf(buff + pos, "%s,", rand_tinyint_str());
break;
case TSDB_DATA_TYPE_UTINYINT:
pos += sprintf(buff + pos, "%s,", rand_utinyint_str());
break;
case TSDB_DATA_TYPE_BOOL:
pos += sprintf(buff + pos, "%s,", rand_bool_str());
break;
......@@ -6953,13 +7298,17 @@ static int32_t prepareStmtBindArrayByType(
char *value)
{
int32_t *bind_int;
uint32_t *bind_uint;
int64_t *bind_bigint;
uint64_t *bind_ubigint;
float *bind_float;
double *bind_double;
int8_t *bind_bool;
int64_t *bind_ts2;
int16_t *bind_smallint;
uint16_t *bind_usmallint;
int8_t *bind_tinyint;
uint8_t *bind_utinyint;
switch(data_type) {
case TSDB_DATA_TYPE_BINARY:
......@@ -7025,6 +7374,22 @@ static int32_t prepareStmtBindArrayByType(
bind->is_null = NULL;
break;
case TSDB_DATA_TYPE_UINT:
bind_uint = malloc(sizeof(uint32_t));
assert(bind_uint);
if (value) {
*bind_uint = atoi(value);
} else {
*bind_uint = rand_int();
}
bind->buffer_type = TSDB_DATA_TYPE_UINT;
bind->buffer_length = sizeof(uint32_t);
bind->buffer = bind_uint;
bind->length = &bind->buffer_length;
bind->is_null = NULL;
break;
case TSDB_DATA_TYPE_BIGINT:
bind_bigint = malloc(sizeof(int64_t));
assert(bind_bigint);
......@@ -7041,6 +7406,22 @@ static int32_t prepareStmtBindArrayByType(
bind->is_null = NULL;
break;
case TSDB_DATA_TYPE_UBIGINT:
bind_ubigint = malloc(sizeof(uint64_t));
assert(bind_ubigint);
if (value) {
*bind_ubigint = atoll(value);
} else {
*bind_ubigint = rand_bigint();
}
bind->buffer_type = TSDB_DATA_TYPE_UBIGINT;
bind->buffer_length = sizeof(uint64_t);
bind->buffer = bind_ubigint;
bind->length = &bind->buffer_length;
bind->is_null = NULL;
break;
case TSDB_DATA_TYPE_FLOAT:
bind_float = malloc(sizeof(float));
assert(bind_float);
......@@ -7089,6 +7470,22 @@ static int32_t prepareStmtBindArrayByType(
bind->is_null = NULL;
break;
case TSDB_DATA_TYPE_USMALLINT:
bind_usmallint = malloc(sizeof(uint16_t));
assert(bind_usmallint);
if (value) {
*bind_usmallint = (uint16_t)atoi(value);
} else {
*bind_usmallint = rand_smallint();
}
bind->buffer_type = TSDB_DATA_TYPE_SMALLINT;
bind->buffer_length = sizeof(uint16_t);
bind->buffer = bind_usmallint;
bind->length = &bind->buffer_length;
bind->is_null = NULL;
break;
case TSDB_DATA_TYPE_TINYINT:
bind_tinyint = malloc(sizeof(int8_t));
assert(bind_tinyint);
......@@ -7105,6 +7502,22 @@ static int32_t prepareStmtBindArrayByType(
bind->is_null = NULL;
break;
case TSDB_DATA_TYPE_UTINYINT:
bind_utinyint = malloc(sizeof(uint8_t));
assert(bind_utinyint);
if (value) {
*bind_utinyint = (int8_t)atoi(value);
} else {
*bind_utinyint = rand_tinyint();
}
bind->buffer_type = TSDB_DATA_TYPE_UTINYINT;
bind->buffer_length = sizeof(uint8_t);
bind->buffer = bind_utinyint;
bind->length = &bind->buffer_length;
bind->is_null = NULL;
break;
case TSDB_DATA_TYPE_BOOL:
bind_bool = malloc(sizeof(int8_t));
assert(bind_bool);
......@@ -7179,11 +7592,15 @@ static int32_t prepareStmtBindArrayByTypeForRand(
char *value)
{
int32_t *bind_int;
uint32_t *bind_uint;
int64_t *bind_bigint;
uint64_t *bind_ubigint;
float *bind_float;
double *bind_double;
int16_t *bind_smallint;
uint16_t *bind_usmallint;
int8_t *bind_tinyint;
uint8_t *bind_utinyint;
int8_t *bind_bool;
int64_t *bind_ts2;
......@@ -7253,6 +7670,23 @@ static int32_t prepareStmtBindArrayByTypeForRand(
*ptr += bind->buffer_length;
break;
case TSDB_DATA_TYPE_UINT:
bind_uint = (uint32_t *)*ptr;
if (value) {
*bind_uint = atoi(value);
} else {
*bind_uint = rand_int();
}
bind->buffer_type = TSDB_DATA_TYPE_UINT;
bind->buffer_length = sizeof(uint32_t);
bind->buffer = bind_uint;
bind->length = &bind->buffer_length;
bind->is_null = NULL;
*ptr += bind->buffer_length;
break;
case TSDB_DATA_TYPE_BIGINT:
bind_bigint = (int64_t *)*ptr;
......@@ -7270,6 +7704,23 @@ static int32_t prepareStmtBindArrayByTypeForRand(
*ptr += bind->buffer_length;
break;
case TSDB_DATA_TYPE_UBIGINT:
bind_ubigint = (uint64_t *)*ptr;
if (value) {
*bind_ubigint = atoll(value);
} else {
*bind_ubigint = rand_bigint();
}
bind->buffer_type = TSDB_DATA_TYPE_UBIGINT;
bind->buffer_length = sizeof(uint64_t);
bind->buffer = bind_ubigint;
bind->length = &bind->buffer_length;
bind->is_null = NULL;
*ptr += bind->buffer_length;
break;
case TSDB_DATA_TYPE_FLOAT:
bind_float = (float *)*ptr;
......@@ -7321,6 +7772,23 @@ static int32_t prepareStmtBindArrayByTypeForRand(
*ptr += bind->buffer_length;
break;
case TSDB_DATA_TYPE_USMALLINT:
bind_usmallint = (uint16_t *)*ptr;
if (value) {
*bind_usmallint = (uint16_t)atoi(value);
} else {
*bind_usmallint = rand_smallint();
}
bind->buffer_type = TSDB_DATA_TYPE_USMALLINT;
bind->buffer_length = sizeof(uint16_t);
bind->buffer = bind_usmallint;
bind->length = &bind->buffer_length;
bind->is_null = NULL;
*ptr += bind->buffer_length;
break;
case TSDB_DATA_TYPE_TINYINT:
bind_tinyint = (int8_t *)*ptr;
......@@ -7338,6 +7806,23 @@ static int32_t prepareStmtBindArrayByTypeForRand(
*ptr += bind->buffer_length;
break;
case TSDB_DATA_TYPE_UTINYINT:
bind_utinyint = (uint8_t *)*ptr;
if (value) {
*bind_utinyint = (uint8_t)atoi(value);
} else {
*bind_utinyint = rand_tinyint();
}
bind->buffer_type = TSDB_DATA_TYPE_UTINYINT;
bind->buffer_length = sizeof(uint8_t);
bind->buffer = bind_utinyint;
bind->length = &bind->buffer_length;
bind->is_null = NULL;
*ptr += bind->buffer_length;
break;
case TSDB_DATA_TYPE_BOOL:
bind_bool = (int8_t *)*ptr;
......@@ -7733,6 +8218,7 @@ static int execBindParamBatch(
break;
case TSDB_DATA_TYPE_INT:
case TSDB_DATA_TYPE_UINT:
param->buffer_length = sizeof(int32_t);
param->buffer = (stbInfo)?
(void *)((uintptr_t)*(uintptr_t*)(stbInfo->sampleBindBatchArray+sizeof(char*)*(c-1))
......@@ -7742,6 +8228,7 @@ static int execBindParamBatch(
break;
case TSDB_DATA_TYPE_TINYINT:
case TSDB_DATA_TYPE_UTINYINT:
param->buffer_length = sizeof(int8_t);
param->buffer = (stbInfo)?
(void *)((uintptr_t)*(uintptr_t*)(
......@@ -7754,6 +8241,7 @@ static int execBindParamBatch(
break;
case TSDB_DATA_TYPE_SMALLINT:
case TSDB_DATA_TYPE_USMALLINT:
param->buffer_length = sizeof(int16_t);
param->buffer = (stbInfo)?
(void *)((uintptr_t)*(uintptr_t*)(stbInfo->sampleBindBatchArray+sizeof(char*)*(c-1))
......@@ -7763,6 +8251,7 @@ static int execBindParamBatch(
break;
case TSDB_DATA_TYPE_BIGINT:
case TSDB_DATA_TYPE_UBIGINT:
param->buffer_length = sizeof(int64_t);
param->buffer = (stbInfo)?
(void *)((uintptr_t)*(uintptr_t*)(stbInfo->sampleBindBatchArray+sizeof(char*)*(c-1))
......@@ -7909,24 +8398,28 @@ static int parseSamplefileToStmtBatch(
switch(data_type) {
case TSDB_DATA_TYPE_INT:
case TSDB_DATA_TYPE_UINT:
tmpP = calloc(1, sizeof(int) * MAX_SAMPLES);
assert(tmpP);
*(uintptr_t*)(sampleBindBatchArray+ sizeof(uintptr_t*)*c) = (uintptr_t)tmpP;
break;
case TSDB_DATA_TYPE_TINYINT:
case TSDB_DATA_TYPE_UTINYINT:
tmpP = calloc(1, sizeof(int8_t) * MAX_SAMPLES);
assert(tmpP);
*(uintptr_t*)(sampleBindBatchArray+ sizeof(uintptr_t*)*c) = (uintptr_t)tmpP;
break;
case TSDB_DATA_TYPE_SMALLINT:
case TSDB_DATA_TYPE_USMALLINT:
tmpP = calloc(1, sizeof(int16_t) * MAX_SAMPLES);
assert(tmpP);
*(uintptr_t*)(sampleBindBatchArray+ sizeof(uintptr_t*)*c) = (uintptr_t)tmpP;
break;
case TSDB_DATA_TYPE_BIGINT:
case TSDB_DATA_TYPE_UBIGINT:
tmpP = calloc(1, sizeof(int64_t) * MAX_SAMPLES);
assert(tmpP);
*(uintptr_t*)(sampleBindBatchArray+ sizeof(uintptr_t*)*c) = (uintptr_t)tmpP;
......@@ -8005,6 +8498,7 @@ static int parseSamplefileToStmtBatch(
switch(data_type) {
case TSDB_DATA_TYPE_INT:
case TSDB_DATA_TYPE_UINT:
*((int32_t*)((uintptr_t)*(uintptr_t*)(sampleBindBatchArray
+sizeof(char*)*c)+sizeof(int32_t)*i)) =
atoi(tmpStr);
......@@ -8023,18 +8517,21 @@ static int parseSamplefileToStmtBatch(
break;
case TSDB_DATA_TYPE_TINYINT:
case TSDB_DATA_TYPE_UTINYINT:
*((int8_t*)((uintptr_t)*(uintptr_t*)(sampleBindBatchArray
+sizeof(char*)*c)+sizeof(int8_t)*i)) =
(int8_t)atoi(tmpStr);
break;
case TSDB_DATA_TYPE_SMALLINT:
case TSDB_DATA_TYPE_USMALLINT:
*((int16_t*)((uintptr_t)*(uintptr_t*)(sampleBindBatchArray
+sizeof(char*)*c)+sizeof(int16_t)*i)) =
(int16_t)atoi(tmpStr);
break;
case TSDB_DATA_TYPE_BIGINT:
case TSDB_DATA_TYPE_UBIGINT:
*((int64_t*)((uintptr_t)*(uintptr_t*)(sampleBindBatchArray
+sizeof(char*)*c)+sizeof(int64_t)*i)) =
(int64_t)atol(tmpStr);
......
......@@ -273,6 +273,7 @@ python3 ./test.py -f query/queryCnameDisplay.py
# python3 ./test.py -f query/operator_cost.py
# python3 ./test.py -f query/long_where_query.py
python3 test.py -f query/nestedQuery/queryWithSpread.py
python3 ./test.py -f query/bug6586.py
#stream
python3 ./test.py -f stream/metric_1.py
......@@ -391,7 +392,7 @@ python3 test.py -f alter/alter_cacheLastRow.py
python3 ./test.py -f query/querySession.py
python3 test.py -f alter/alter_create_exception.py
python3 ./test.py -f insert/flushwhiledrop.py
python3 ./test.py -f insert/schemalessInsert.py
#python3 ./test.py -f insert/schemalessInsert.py
python3 ./test.py -f alter/alterColMultiTimes.py
python3 ./test.py -f query/queryWildcardLength.py
python3 ./test.py -f query/queryTbnameUpperLower.py
......
......@@ -13,9 +13,8 @@
import traceback
import random
from taos.error import LinesError
from taos.error import TelnetLinesError
import time
from copy import deepcopy
import numpy as np
from util.log import *
from util.cases import *
......@@ -39,13 +38,13 @@ class TDTestCase:
tdSql.execute(f'use {name}')
def timeTrans(self, time_value):
if time_value.endswith("ns"):
if time_value.lower().endswith("ns"):
ts = int(''.join(list(filter(str.isdigit, time_value))))/1000000000
elif time_value.endswith("us") or time_value.isdigit() and int(time_value) != 0:
elif time_value.lower().endswith("us") or time_value.isdigit() and int(time_value) != 0:
ts = int(''.join(list(filter(str.isdigit, time_value))))/1000000
elif time_value.endswith("ms"):
elif time_value.lower().endswith("ms"):
ts = int(''.join(list(filter(str.isdigit, time_value))))/1000
elif time_value.endswith("s") and list(time_value)[-1] not in "num":
elif time_value.lower().endswith("s") and list(time_value)[-1] not in "num":
ts = int(''.join(list(filter(str.isdigit, time_value))))/1
elif int(time_value) == 0:
ts = time.time()
......@@ -68,42 +67,48 @@ class TDTestCase:
return int(time.mktime(time.strptime(datetime_input, "%Y-%m-%d %H:%M:%S.%f")))
def getTdTypeValue(self, value):
if value.endswith("i8"):
if value.lower().endswith("i8"):
td_type = "TINYINT"
td_tag_value = ''.join(list(value)[:-2])
elif value.endswith("i16"):
elif value.lower().endswith("i16"):
td_type = "SMALLINT"
td_tag_value = ''.join(list(value)[:-3])
elif value.endswith("i32"):
elif value.lower().endswith("i32"):
td_type = "INT"
td_tag_value = ''.join(list(value)[:-3])
elif value.endswith("i64"):
elif value.lower().endswith("i64"):
td_type = "BIGINT"
td_tag_value = ''.join(list(value)[:-3])
elif value.endswith("u64"):
elif value.lower().endswith("u64"):
td_type = "BIGINT UNSIGNED"
td_tag_value = ''.join(list(value)[:-3])
elif value.endswith("f32"):
elif value.lower().endswith("f32"):
td_type = "FLOAT"
td_tag_value = ''.join(list(value)[:-3])
td_tag_value = '{}'.format(np.float32(td_tag_value))
elif value.endswith("f64"):
elif value.lower().endswith("f64"):
td_type = "DOUBLE"
td_tag_value = ''.join(list(value)[:-3])
elif value.startswith('L"'):
elif value.lower().startswith('l"'):
td_type = "NCHAR"
td_tag_value = ''.join(list(value)[2:-1])
elif value.startswith('"') and value.endswith('"'):
td_type = "BINARY"
td_tag_value = ''.join(list(value)[1:-1])
elif value.lower() == "t" or value == "true" or value == "True" or value == "TRUE":
elif value.lower() == "t" or value.lower() == "true":
td_type = "BOOL"
td_tag_value = "True"
elif value.lower() == "f" or value == "false" or value == "False" or value == "FALSE":
elif value.lower() == "f" or value.lower() == "false":
td_type = "BOOL"
td_tag_value = "False"
elif value.isdigit():
td_type = "BIGINT"
td_tag_value = value
else:
td_type = "DOUBLE"
if "e" in value.lower():
td_tag_value = str(float(value))
else:
td_type = "FLOAT"
td_tag_value = value
return td_type, td_tag_value
......@@ -137,9 +142,7 @@ class TDTestCase:
def inputHandle(self, input_sql):
input_sql_split_list = input_sql.split(" ")
stb_name = input_sql_split_list[0]
#'stb2_5 1626006833610ms 3f64 host="host0"',
stb_tag_list = input_sql_split_list[3].split(',')
stb_tag_list = input_sql_split_list[3:]
stb_col_value = input_sql_split_list[2]
ts_value = self.timeTrans(input_sql_split_list[1])
......@@ -190,7 +193,7 @@ class TDTestCase:
t8="L\"ncharTagValue\"", ts="1626006833639000000ns",
id_noexist_tag=None, id_change_tag=None, id_upper_tag=None, id_double_tag=None,
t_add_tag=None, t_mul_tag=None, t_multi_tag=None, c_blank_tag=None, t_blank_tag=None,
chinese_tag=None, multi_field_tag=None):
chinese_tag=None, multi_field_tag=None, point_trans_tag=None):
if stb_name == "":
stb_name = tdCom.getLongName(len=6, mode="letters")
if tb_name == "":
......@@ -203,31 +206,33 @@ class TDTestCase:
id = "ID"
else:
id = "id"
sql_seq = f'{stb_name} {ts} {value} {id}=\"{tb_name}\",t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6},t7={t7},t8={t8}'
sql_seq = f'{stb_name} {ts} {value} {id}=\"{tb_name}\" t0={t0} t1={t1} t2={t2} t3={t3} t4={t4} t5={t5} t6={t6} t7={t7} t8={t8}'
if id_noexist_tag is not None:
sql_seq = f'{stb_name} {ts} {value} t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6},t7={t7},t8={t8}'
sql_seq = f'{stb_name} {ts} {value} t0={t0} t1={t1} t2={t2} t3={t3} t4={t4} t5={t5} t6={t6} t7={t7} t8={t8}'
if t_add_tag is not None:
sql_seq = f'{stb_name} {ts} {value} t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6},t7={t7},t8={t8},t9={t8}'
sql_seq = f'{stb_name} {ts} {value} t0={t0} t1={t1} t2={t2} t3={t3} t4={t4} t5={t5} t6={t6} t7={t7} t8={t8} t9={t8}'
if id_change_tag is not None:
sql_seq = f'{stb_name} {ts} {value} t0={t0},{id}=\"{tb_name}\",t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6},t7={t7},t8={t8}'
sql_seq = f'{stb_name} {ts} {value} t0={t0} {id}=\"{tb_name}\" t1={t1} t2={t2} t3={t3} t4={t4} t5={t5} t6={t6} t7={t7} t8={t8}'
if id_double_tag is not None:
sql_seq = f'{stb_name} {ts} {value} {id}=\"{tb_name}_1\",t0={t0},t1={t1},{id}=\"{tb_name}_2\",t2={t2},t3={t3},t4={t4},t5={t5},t6={t6},t7={t7},t8={t8}'
sql_seq = f'{stb_name} {ts} {value} {id}=\"{tb_name}_1\" t0={t0} t1={t1} {id}=\"{tb_name}_2\" t2={t2} t3={t3} t4={t4} t5={t5} t6={t6} t7={t7} t8={t8}'
if t_add_tag is not None:
sql_seq = f'{stb_name} {ts} {value} {id}=\"{tb_name}\",t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6},t7={t7},t8={t8},t11={t1},t10={t8}'
sql_seq = f'{stb_name} {ts} {value} {id}=\"{tb_name}\" t0={t0} t1={t1} t2={t2} t3={t3} t4={t4} t5={t5} t6={t6} t7={t7} t8={t8} t11={t1} t10={t8}'
if t_mul_tag is not None:
sql_seq = f'{stb_name} {ts} {value} {id}=\"{tb_name}\",t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6}'
sql_seq = f'{stb_name} {ts} {value} {id}=\"{tb_name}\" t0={t0} t1={t1} t2={t2} t3={t3} t4={t4} t5={t5} t6={t6}'
if id_noexist_tag is not None:
sql_seq = f'{stb_name} {ts} {value} t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6}'
sql_seq = f'{stb_name} {ts} {value} t0={t0} t1={t1} t2={t2} t3={t3} t4={t4} t5={t5} t6={t6}'
if t_multi_tag is not None:
sql_seq = f'{stb_name} {ts} {value},{value} {id}=\"{tb_name}\",t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6}'
sql_seq = f'{stb_name} {ts} {value} {value} {id}=\"{tb_name}\" t0={t0} t1={t1} t2={t2} t3={t3} t4={t4} t5={t5} t6={t6}'
if c_blank_tag is not None:
sql_seq = f'{stb_name} {ts} {id}=\"{tb_name}\",t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6},t7={t7},t8={t8}'
sql_seq = f'{stb_name} {ts} {id}=\"{tb_name}\" t0={t0} t1={t1} t2={t2} t3={t3} t4={t4} t5={t5} t6={t6} t7={t7} t8={t8}'
if t_blank_tag is not None:
sql_seq = f'{stb_name} {ts} {value} {id}=\"{tb_name}\"'
if chinese_tag is not None:
sql_seq = f'{stb_name} {ts} L"涛思数据" t0={t0},t1=L"涛思数据"'
sql_seq = f'{stb_name} {ts} L"涛思数据" t0={t0} t1=L"涛思数据"'
if multi_field_tag is not None:
sql_seq = f'{stb_name} {ts} {value} {id}=\"{tb_name}\",t0={t0} t1={t1}'
sql_seq = f'{stb_name} {ts} {value} {id}=\"{tb_name}\" t0={t0} {value}'
if point_trans_tag is not None:
sql_seq = f'point.trans.test {ts} {value} t0={t0}'
return sql_seq, stb_name
def genMulTagColStr(self, genType, count=1):
......@@ -239,7 +244,7 @@ class TDTestCase:
if genType == "tag":
for i in range(0, count):
if i < (count-1):
tag_str += f't{i}=f,'
tag_str += f't{i}=f '
else:
tag_str += f't{i}=f'
return tag_str
......@@ -253,7 +258,7 @@ class TDTestCase:
tag_str = self.genMulTagColStr("tag", tag_count)
col_str = self.genMulTagColStr("col")
ts = "1626006833640000000ns"
long_sql = stb_name + ' ' + ts + ' ' + col_str + ' ' + f'id=\"{tb_name}\"' + ',' + tag_str
long_sql = stb_name + ' ' + ts + ' ' + col_str + ' ' + f'id=\"{tb_name}\"' + ' ' + tag_str
return long_sql, stb_name
def getNoIdTbName(self, stb_name):
......@@ -299,7 +304,6 @@ class TDTestCase:
tdSql.checkEqual(res_field_list_without_ts, expect_list[1])
for i in range(len(res_type_list)):
tdSql.checkEqual(res_type_list[i], expect_list[2][i])
# tdSql.checkEqual(res_type_list, expect_list[2])
def initCheckCase(self):
"""
......@@ -328,19 +332,16 @@ class TDTestCase:
binary_symbols = '\"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"\'\'"\"'
'''
tdCom.cleanTb()
binary_symbols = '"aaa"'
# binary_symbols = '"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"'
binary_symbols = '"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"'
nchar_symbols = f'L{binary_symbols}'
input_sql1, stb_name1 = self.genFullTypeSql(value=binary_symbols, t7=binary_symbols, t8=nchar_symbols)
# input_sql2, stb_name2 = self.genFullTypeSql(value=nchar_symbols, t7=binary_symbols, t8=nchar_symbols)
input_sql2, stb_name2 = self.genFullTypeSql(value=nchar_symbols, t7=binary_symbols, t8=nchar_symbols)
self.resCmp(input_sql1, stb_name1)
# self.resCmp(input_sql2, stb_name2)
self.resCmp(input_sql2, stb_name2)
def tsCheckCase(self):
"""
test ts list --> ["1626006833639000000ns", "1626006833639019us", "1626006833640ms", "1626006834s", "1626006822639022"]
# ! us级时间戳都为0时,数据库中查询显示,但python接口拿到的结果不显示 .000000的情况请确认,目前修改时间处理代码可以通过
"""
tdCom.cleanTb()
ts_list = ["1626006833639000000ns", "1626006833639019us", "1626006833640ms", "1626006834s", "1626006822639022", 0]
......@@ -393,8 +394,9 @@ class TDTestCase:
tdCom.cleanTb()
try:
self._conn.insert_telnet_lines([input_sql])
except LinesError:
pass
raise Exception("should not reach here")
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
def idIllegalNameCheckCase(self):
"""
......@@ -407,8 +409,9 @@ class TDTestCase:
input_sql = self.genFullTypeSql(tb_name=f"\"aaa{i}bbb\"")[0]
try:
self._conn.insert_telnet_lines([input_sql])
except LinesError:
pass
raise Exception("should not reach here")
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
def idStartWithNumCheckCase(self):
"""
......@@ -418,8 +421,9 @@ class TDTestCase:
input_sql = self.genFullTypeSql(tb_name=f"\"1aaabbb\"")[0]
try:
self._conn.insert_telnet_lines([input_sql])
except LinesError:
pass
raise Exception("should not reach here")
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
def nowTsCheckCase(self):
"""
......@@ -429,8 +433,9 @@ class TDTestCase:
input_sql = self.genFullTypeSql(ts="now")[0]
try:
self._conn.insert_telnet_lines([input_sql])
except LinesError:
pass
raise Exception("should not reach here")
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
def dateFormatTsCheckCase(self):
"""
......@@ -440,8 +445,9 @@ class TDTestCase:
input_sql = self.genFullTypeSql(ts="2021-07-21\ 19:01:46.920")[0]
try:
self._conn.insert_telnet_lines([input_sql])
except LinesError:
pass
raise Exception("should not reach here")
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
def illegalTsCheckCase(self):
"""
......@@ -451,8 +457,9 @@ class TDTestCase:
input_sql = self.genFullTypeSql(ts="16260068336390us19")[0]
try:
self._conn.insert_telnet_lines([input_sql])
except LinesError:
pass
raise Exception("should not reach here")
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
def tagValueLengthCheckCase(self):
"""
......@@ -467,8 +474,9 @@ class TDTestCase:
input_sql = self.genFullTypeSql(t1=t1)[0]
try:
self._conn.insert_telnet_lines([input_sql])
except LinesError:
pass
raise Exception("should not reach here")
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
#i16
for t2 in ["-32767i16", "32767i16"]:
......@@ -478,8 +486,9 @@ class TDTestCase:
input_sql = self.genFullTypeSql(t2=t2)[0]
try:
self._conn.insert_telnet_lines([input_sql])
except LinesError:
pass
raise Exception("should not reach here")
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
#i32
for t3 in ["-2147483647i32", "2147483647i32"]:
......@@ -489,8 +498,9 @@ class TDTestCase:
input_sql = self.genFullTypeSql(t3=t3)[0]
try:
self._conn.insert_telnet_lines([input_sql])
except LinesError:
pass
raise Exception("should not reach here")
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
#i64
for t4 in ["-9223372036854775807i64", "9223372036854775807i64"]:
......@@ -500,8 +510,9 @@ class TDTestCase:
input_sql = self.genFullTypeSql(t4=t4)[0]
try:
self._conn.insert_telnet_lines([input_sql])
except LinesError:
pass
raise Exception("should not reach here")
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
# f32
for t5 in [f"{-3.4028234663852885981170418348451692544*(10**38)}f32", f"{3.4028234663852885981170418348451692544*(10**38)}f32"]:
......@@ -513,7 +524,7 @@ class TDTestCase:
try:
self._conn.insert_telnet_lines([input_sql])
raise Exception("should not reach here")
except LinesError as err:
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
......@@ -527,32 +538,31 @@ class TDTestCase:
try:
self._conn.insert_telnet_lines([input_sql])
raise Exception("should not reach here")
except LinesError as err:
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
# binary
stb_name = tdCom.getLongName(7, "letters")
input_sql = f'{stb_name} 1626006833639000000ns t t0=t,t1="{tdCom.getLongName(16374, "letters")}"'
input_sql = f'{stb_name} 1626006833639000000ns t t0=t t1="{tdCom.getLongName(16374, "letters")}"'
self._conn.insert_telnet_lines([input_sql])
input_sql = f'{stb_name} 1626006833639000000ns t t0=t,t1="{tdCom.getLongName(16375, "letters")}"'
input_sql = f'{stb_name} 1626006833639000000ns t t0=t t1="{tdCom.getLongName(16375, "letters")}"'
try:
self._conn.insert_telnet_lines([input_sql])
raise Exception("should not reach here")
except LinesError as err:
pass
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
# nchar
# * legal nchar could not be larger than 16374/4
stb_name = tdCom.getLongName(7, "letters")
input_sql = f'{stb_name} 1626006833639000000ns t t0=t,t1=L"{tdCom.getLongName(4093, "letters")}"'
input_sql = f'{stb_name} 1626006833639000000ns t t0=t t1=L"{tdCom.getLongName(4093, "letters")}"'
self._conn.insert_telnet_lines([input_sql])
input_sql = f'{stb_name} 1626006833639000000ns t t0=t,t1=L"{tdCom.getLongName(4094, "letters")}"'
input_sql = f'{stb_name} 1626006833639000000ns t t0=t t1=L"{tdCom.getLongName(4094, "letters")}"'
try:
self._conn.insert_telnet_lines([input_sql])
raise Exception("should not reach here")
except LinesError as err:
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
def colValueLengthCheckCase(self):
......@@ -570,7 +580,7 @@ class TDTestCase:
try:
self._conn.insert_telnet_lines([input_sql])
raise Exception("should not reach here")
except LinesError as err:
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
# i16
tdCom.cleanTb()
......@@ -583,7 +593,7 @@ class TDTestCase:
try:
self._conn.insert_telnet_lines([input_sql])
raise Exception("should not reach here")
except LinesError as err:
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
# i32
......@@ -597,7 +607,7 @@ class TDTestCase:
try:
self._conn.insert_telnet_lines([input_sql])
raise Exception("should not reach here")
except LinesError as err:
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
# i64
......@@ -611,7 +621,7 @@ class TDTestCase:
try:
self._conn.insert_telnet_lines([input_sql])
raise Exception("should not reach here")
except LinesError as err:
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
# f32
......@@ -626,7 +636,7 @@ class TDTestCase:
try:
self._conn.insert_telnet_lines([input_sql])
raise Exception("should not reach here")
except LinesError as err:
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
# f64
......@@ -641,7 +651,7 @@ class TDTestCase:
try:
self._conn.insert_telnet_lines([input_sql])
raise Exception("should not reach here")
except LinesError as err:
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
# # binary
......@@ -655,7 +665,7 @@ class TDTestCase:
try:
self._conn.insert_telnet_lines([input_sql])
raise Exception("should not reach here")
except LinesError as err:
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
# nchar
......@@ -670,7 +680,7 @@ class TDTestCase:
try:
self._conn.insert_telnet_lines([input_sql])
raise Exception("should not reach here")
except LinesError as err:
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
def tagColIllegalValueCheckCase(self):
......@@ -681,18 +691,10 @@ class TDTestCase:
tdCom.cleanTb()
# bool
for i in ["TrUe", "tRue", "trUe", "truE", "FalsE", "fAlse", "faLse", "falSe", "falsE"]:
input_sql1 = self.genFullTypeSql(t0=i)[0]
try:
self._conn.insert_telnet_lines([input_sql1])
raise Exception("should not reach here")
except LinesError as err:
tdSql.checkNotEqual(err.errno, 0)
input_sql2 = self.genFullTypeSql(value=i)[0]
try:
self._conn.insert_telnet_lines([input_sql2])
raise Exception("should not reach here")
except LinesError as err:
tdSql.checkNotEqual(err.errno, 0)
input_sql1, stb_name = self.genFullTypeSql(t0=i)
self.resCmp(input_sql1, stb_name)
input_sql2, stb_name = self.genFullTypeSql(value=i)
self.resCmp(input_sql2, stb_name)
# i8 i16 i32 i64 f32 f64
for input_sql in [
......@@ -706,7 +708,7 @@ class TDTestCase:
try:
self._conn.insert_telnet_lines([input_sql])
raise Exception("should not reach here")
except LinesError as err:
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
# check binary and nchar blank
......@@ -717,17 +719,39 @@ class TDTestCase:
for input_sql in [input_sql1, input_sql2, input_sql3, input_sql4]:
try:
self._conn.insert_telnet_lines([input_sql])
except LinesError as err:
pass
raise Exception("should not reach here")
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
# check accepted binary and nchar symbols
# # * ~!@#$¥%^&*()-+={}|[]、「」:;
for symbol in list('~!@#$¥%^&*()-+={}|[]、「」:;'):
input_sql1 = f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns "abc{symbol}aaa" t0=t'
input_sql2 = f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns t t0=t,t1="abc{symbol}aaa"'
input_sql2 = f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns t t0=t t1="abc{symbol}aaa"'
self._conn.insert_telnet_lines([input_sql1])
self._conn.insert_telnet_lines([input_sql2])
def blankCheckCase(self):
'''
check blank case
'''
tdCom.cleanTb()
input_sql_list = [f'{tdCom.getLongName(7, "letters")} {tdCom.getLongName(7, "letters")} 1626006833639000000ns "abcaaa" t0=t',
f'{tdCom.getLongName(7, "letters")} 16260068336 39000000ns L"bcdaaa" t1=f',
f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns t t0="abc aaa"',
f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns t t0=L"abc aaa"',
f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns "abc aaa" t0=L"abcaaa"',
f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns L"abc aaa" t0=L"abcaaa"',
f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns L"abaaa" t0=L"abcaaa1"',
f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns L"abaaa" t0=L"abcaaa2"',
f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns L"abaaa" t0=t t1="abc t2="taa""',
f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns L"abaaa" t0=L"abcaaa3"']
for input_sql in input_sql_list:
try:
self._conn.insert_telnet_lines([input_sql])
raise Exception("should not reach here")
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
def duplicateIdTagColInsertCheckCase(self):
"""
......@@ -738,7 +762,7 @@ class TDTestCase:
try:
self._conn.insert_telnet_lines([input_sql_id])
raise Exception("should not reach here")
except LinesError as err:
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
input_sql = self.genFullTypeSql()[0]
......@@ -746,7 +770,7 @@ class TDTestCase:
try:
self._conn.insert_telnet_lines([input_sql_tag])
raise Exception("should not reach here")
except LinesError as err:
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
##### stb exist #####
......@@ -762,7 +786,6 @@ class TDTestCase:
self.resCmp(input_sql, stb_name, condition='where tbname like "t_%"')
tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(2)
# TODO cover other case
def duplicateInsertExistCheckCase(self):
"""
......@@ -857,21 +880,21 @@ class TDTestCase:
stb_name = tdCom.getLongName(7, "letters")
tb_name = f'{stb_name}_1'
input_sql = f'{stb_name} 1626006833639000000ns f id="{tb_name}",t0=t'
input_sql = f'{stb_name} 1626006833639000000ns f id="{tb_name}" t0=t'
self._conn.insert_telnet_lines([input_sql])
# * every binary and nchar must be length+2, so here is two tag, max length could not larger than 16384-2*2
input_sql = f'{stb_name} 1626006833639000000ns f t0=t,t1="{tdCom.getLongName(16374, "letters")}",t2="{tdCom.getLongName(5, "letters")}"'
input_sql = f'{stb_name} 1626006833639000000ns f t0=t t1="{tdCom.getLongName(16374, "letters")}" t2="{tdCom.getLongName(5, "letters")}"'
self._conn.insert_telnet_lines([input_sql])
tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(2)
input_sql = f'{stb_name} 1626006833639000000ns f t0=t,t1="{tdCom.getLongName(16374, "letters")}",t2="{tdCom.getLongName(6, "letters")}"'
input_sql = f'{stb_name} 1626006833639000000ns f t0=t t1="{tdCom.getLongName(16374, "letters")}" t2="{tdCom.getLongName(6, "letters")}"'
try:
self._conn.insert_telnet_lines([input_sql])
raise Exception("should not reach here")
except LinesError:
pass
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(2)
......@@ -883,19 +906,19 @@ class TDTestCase:
tdCom.cleanTb()
stb_name = tdCom.getLongName(7, "letters")
tb_name = f'{stb_name}_1'
input_sql = f'{stb_name} 1626006833639000000ns f id="{tb_name}",t0=t'
input_sql = f'{stb_name} 1626006833639000000ns f id="{tb_name}" t0=t'
self._conn.insert_telnet_lines([input_sql])
# * legal nchar could not be larger than 16374/4
input_sql = f'{stb_name} 1626006833639000000ns f t0=t,t1=L"{tdCom.getLongName(4093, "letters")}",t2=L"{tdCom.getLongName(1, "letters")}"'
input_sql = f'{stb_name} 1626006833639000000ns f t0=t t1=L"{tdCom.getLongName(4093, "letters")}" t2=L"{tdCom.getLongName(1, "letters")}"'
self._conn.insert_telnet_lines([input_sql])
tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(2)
input_sql = f'{stb_name} 1626006833639000000ns f t0=t,t1=L"{tdCom.getLongName(4093, "letters")}",t2=L"{tdCom.getLongName(2, "letters")}"'
input_sql = f'{stb_name} 1626006833639000000ns f t0=t t1=L"{tdCom.getLongName(4093, "letters")}" t2=L"{tdCom.getLongName(2, "letters")}"'
try:
self._conn.insert_telnet_lines([input_sql])
raise Exception("should not reach here")
except LinesError as err:
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(2)
......@@ -908,15 +931,15 @@ class TDTestCase:
stb_name = tdCom.getLongName(8, "letters")
tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 bigint)')
lines = ["st123456 1626006833639000000ns 1i64 t1=3i64,t2=4f64,t3=\"t3\"",
"st123456 1626006833640000000ns 2i64 t1=4i64,t3=\"t4\",t2=5f64,t4=5f64",
f'{stb_name} 1626056811823316532ns 3i64 t2=5f64,t3=L\"ste\"',
"stf567890 1626006933640000000ns 4i64 t1=4i64,t3=\"t4\",t2=5f64,t4=5f64",
"st123456 1626006833642000000ns 5i64 t1=4i64,t2=5f64,t3=\"t4\"",
f'{stb_name} 1626056811843316532ns 6i64 t2=5f64,t3=L\"ste2\"',
f'{stb_name} 1626056812843316532ns 7i64 t2=5f64,t3=L\"ste2\"',
"st123456 1626006933640000000ns 8i64 t1=4i64,t3=\"t4\",t2=5f64,t4=5f64",
"st123456 1626006933641000000ns 9i64 t1=4i64,t3=\"t4\",t2=5f64,t4=5f64"
lines = ["st123456 1626006833639000000ns 1i64 t1=3i64 t2=4f64 t3=\"t3\"",
"st123456 1626006833640000000ns 2i64 t1=4i64 t3=\"t4\" t2=5f64 t4=5f64",
f'{stb_name} 1626056811823316532ns 3i64 t2=5f64 t3=L\"ste\"',
"stf567890 1626006933640000000ns 4i64 t1=4i64 t3=\"t4\" t2=5f64 t4=5f64",
"st123456 1626006833642000000ns 5i64 t1=4i64 t2=5f64 t3=\"t4\"",
f'{stb_name} 1626056811843316532ns 6i64 t2=5f64 t3=L\"ste2\"',
f'{stb_name} 1626056812843316532ns 7i64 t2=5f64 t3=L\"ste2\"',
"st123456 1626006933640000000ns 8i64 t1=4i64 t3=\"t4\" t2=5f64 t4=5f64",
"st123456 1626006933641000000ns 9i64 t1=4i64 t3=\"t4\" t2=5f64 t4=5f64"
]
self._conn.insert_telnet_lines(lines)
tdSql.query('show stables')
......@@ -939,7 +962,7 @@ class TDTestCase:
sql_list.append(input_sql)
self._conn.insert_telnet_lines(sql_list)
tdSql.query('show tables')
tdSql.checkRows(1000)
tdSql.checkRows(count)
def batchErrorInsertCheckCase(self):
"""
......@@ -947,12 +970,12 @@ class TDTestCase:
"""
tdCom.cleanTb()
stb_name = tdCom.getLongName(8, "letters")
lines = ["st123456 1626006833639000000ns 3i64 t1=3i64,t2=4f64,t3=\"t3\"",
f"{stb_name} 1626056811823316532ns tRue t2=5f64,t3=L\"ste\""]
lines = ["st123456 1626006833639000000ns 3i 64 t1=3i64 t2=4f64 t3=\"t3\"",
f"{stb_name} 1626056811823316532ns tRue t2=5f64 t3=L\"ste\""]
try:
self._conn.insert_telnet_lines(lines)
raise Exception("should not reach here")
except LinesError as err:
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
def multiColsInsertCheckCase(self):
......@@ -964,7 +987,7 @@ class TDTestCase:
try:
self._conn.insert_telnet_lines([input_sql])
raise Exception("should not reach here")
except LinesError as err:
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
def blankColInsertCheckCase(self):
......@@ -976,7 +999,7 @@ class TDTestCase:
try:
self._conn.insert_telnet_lines([input_sql])
raise Exception("should not reach here")
except LinesError as err:
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
def blankTagInsertCheckCase(self):
......@@ -988,7 +1011,7 @@ class TDTestCase:
try:
self._conn.insert_telnet_lines([input_sql])
raise Exception("should not reach here")
except LinesError as err:
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
def chineseCheckCase(self):
......@@ -1008,24 +1031,45 @@ class TDTestCase:
try:
self._conn.insert_telnet_lines([input_sql])
raise Exception("should not reach here")
except LinesError as err:
except TelnetLinesError as err:
tdSql.checkNotEqual(err.errno, 0)
def errorTypeCheckCase(self):
stb_name = tdCom.getLongName(8, "letters")
input_sql_list = [f'{stb_name} 0 "hkgjiwdj" t0=f,t1=127I8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="vozamcts",t8=L"ncharTagValue"', \
f'{stb_name} 0 "hkgjiwdj" t0=f,t1=127i8,t2=32767I16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="vozamcts",t8=L"ncharTagValue"', \
f'{stb_name} 0 "hkgjiwdj" t0=f,t1=127i8,t2=32767i16,t3=2147483647I32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="vozamcts",t8=L"ncharTagValue"', \
f'{stb_name} 0 "hkgjiwdj" t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807I64,t5=11.12345f32,t6=22.123456789f64,t7="vozamcts",t8=L"ncharTagValue"', \
f'{stb_name} 0 "hkgjiwdj" t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345F32,t6=22.123456789f64,t7="vozamcts",t8=L"ncharTagValue"', \
f'{stb_name} 0 "hkgjiwdj" t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789F64,t7="vozamcts",t8=L"ncharTagValue"', \
f'{stb_name} 1626006833639000000NS "hkgjiwdj" t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="vozamcts",t8=L"ncharTagValue"']
input_sql_list = [f'{stb_name}_1 1626006833639000000Ns "hkgjiwdj" t0=f t1=127I8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="vozamcts" t8=L"ncharTagValue"', \
f'{stb_name}_2 1626006833639000001nS "hkgjiwdj" t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="vozamcts" t8=L"ncharTagValue"', \
f'{stb_name}_3 1626006833639000002NS "hkgjiwdj" t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="vozamcts" t8=L"ncharTagValue"', \
f'{stb_name}_4 1626006833639019Us "hkgjiwdj" t0=f t1=127i8 t2=32767I16 t3=2147483647I32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="vozamcts" t8=L"ncharTagValue"', \
f'{stb_name}_5 1626006833639018uS "hkgjiwdj" t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807I64 t5=11.12345f32 t6=22.123456789f64 t7="vozamcts" t8=L"ncharTagValue"', \
f'{stb_name}_6 1626006833639017US "hkgjiwdj" t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807I64 t5=11.12345f32 t6=22.123456789f64 t7="vozamcts" t8=L"ncharTagValue"', \
f'{stb_name}_7 1626006833640Ms "hkgjiwdj" t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789F64 t7="vozamcts" t8=L"ncharTagValue"', \
f'{stb_name}_8 1626006833641mS "hkgjiwdj" t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="vozamcts" t8=L"ncharTagValue"', \
f'{stb_name}_9 1626006833642MS "hkgjiwdj" t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="vozamcts" t8=L"ncharTagValue"', \
f'{stb_name}_10 1626006834S "hkgjiwdj" t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="vozamcts" t8=l"ncharTagValue"', \
f'{stb_name}_11 1626006834S "hkgjiwdj" t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="vozamcts" t8=L"ncharTagValue"']
for input_sql in input_sql_list:
try:
self._conn.insert_telnet_lines([input_sql])
raise Exception("should not reach here")
except LinesError as err:
tdSql.checkNotEqual(err.errno, 0)
stb_name = input_sql.split(" ")[0]
self.resCmp(input_sql, stb_name)
def pointTransCheckCase(self):
"""
metric value "." trans to "_"
"""
tdCom.cleanTb()
input_sql = self.genFullTypeSql(point_trans_tag=True)[0]
stb_name = input_sql.split(" ")[0].replace(".", "_")
self.resCmp(input_sql, stb_name)
def defaultTypeCheckCase(self):
stb_name = tdCom.getLongName(8, "letters")
input_sql_list = [f'{stb_name}_1 1626006833639000000Ns 9223372036854775807 t0=f t1=127 t2=32767i16 t3=2147483647i32 t4=9223372036854775807 t5=11.12345f32 t6=22.123456789f64 t7="vozamcts" t8=L"ncharTagValue"', \
f'{stb_name}_2 1626006834S 22.123456789 t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789 t7="vozamcts" t8=L"ncharTagValue"', \
f'{stb_name}_3 1626006834S 10e5 t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=10e5 t7="vozamcts" t8=L"ncharTagValue"', \
f'{stb_name}_4 1626006834S 10.0e5 t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=10.0e5 t7="vozamcts" t8=L"ncharTagValue"', \
f'{stb_name}_5 1626006834S -10.0e5 t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=-10.0e5 t7="vozamcts" t8=L"ncharTagValue"']
for input_sql in input_sql_list:
stb_name = input_sql.split(" ")[0]
self.resCmp(input_sql, stb_name)
def genSqlList(self, count=5, stb_name="", tb_name=""):
"""
......@@ -1166,11 +1210,11 @@ class TDTestCase:
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"")
self.resCmp(input_sql, stb_name)
s_stb_d_tb_m_tag_list = [(f'{stb_name} 1626006833639000000ns "omfdhyom" t0=F,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64', 'yzwswz'), \
(f'{stb_name} 1626006833639000000ns "vqowydbc" t0=F,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64', 'yzwswz'), \
(f'{stb_name} 1626006833639000000ns "plgkckpv" t0=F,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64', 'yzwswz'), \
(f'{stb_name} 1626006833639000000ns "cujyqvlj" t0=F,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64', 'yzwswz'), \
(f'{stb_name} 1626006833639000000ns "twjxisat" t0=T,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64', 'yzwswz')]
s_stb_d_tb_m_tag_list = [(f'{stb_name} 1626006833639000000ns "omfdhyom" t0=F t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'yzwswz'), \
(f'{stb_name} 1626006833639000000ns "vqowydbc" t0=F t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'yzwswz'), \
(f'{stb_name} 1626006833639000000ns "plgkckpv" t0=F t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'yzwswz'), \
(f'{stb_name} 1626006833639000000ns "cujyqvlj" t0=F t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'yzwswz'), \
(f'{stb_name} 1626006833639000000ns "twjxisat" t0=T t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'yzwswz')]
self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_m_tag_list))
tdSql.query(f"show tables;")
tdSql.checkRows(3)
......@@ -1195,11 +1239,11 @@ class TDTestCase:
tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"")
self.resCmp(input_sql, stb_name)
s_stb_s_tb_d_ts_list = [(f'{stb_name} 0 "hkgjiwdj" id="{tb_name}",t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="vozamcts",t8=L"ncharTagValue"', 'dwpthv'), \
(f'{stb_name} 0 "rljjrrul" id="{tb_name}",t0=False,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="bmcanhbs",t8=L"ncharTagValue"', 'dwpthv'), \
(f'{stb_name} 0 "basanglx" id="{tb_name}",t0=False,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="enqkyvmb",t8=L"ncharTagValue"', 'dwpthv'), \
(f'{stb_name} 0 "clsajzpp" id="{tb_name}",t0=F,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="eivaegjk",t8=L"ncharTagValue"', 'dwpthv'), \
(f'{stb_name} 0 "jitwseso" id="{tb_name}",t0=T,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="yhlwkddq",t8=L"ncharTagValue"', 'dwpthv')]
s_stb_s_tb_d_ts_list = [(f'{stb_name} 0 "hkgjiwdj" id="{tb_name}" t0=f t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="vozamcts" t8=L"ncharTagValue"', 'dwpthv'), \
(f'{stb_name} 0 "rljjrrul" id="{tb_name}" t0=False t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="bmcanhbs" t8=L"ncharTagValue"', 'dwpthv'), \
(f'{stb_name} 0 "basanglx" id="{tb_name}" t0=False t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="enqkyvmb" t8=L"ncharTagValue"', 'dwpthv'), \
(f'{stb_name} 0 "clsajzpp" id="{tb_name}" t0=F t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="eivaegjk" t8=L"ncharTagValue"', 'dwpthv'), \
(f'{stb_name} 0 "jitwseso" id="{tb_name}" t0=T t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="yhlwkddq" t8=L"ncharTagValue"', 'dwpthv')]
self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_d_ts_list))
tdSql.query(f"show tables;")
tdSql.checkRows(1)
......@@ -1231,11 +1275,11 @@ class TDTestCase:
tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"")
self.resCmp(input_sql, stb_name)
s_stb_s_tb_d_ts_a_tag_list = [(f'{stb_name} 0 "clummqfy" id="{tb_name}",t0=False,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="hpxzrdiw",t8=L"ncharTagValue",t11=127i8,t10=L"ncharTagValue"', 'bokaxl'), \
(f'{stb_name} 0 "yqeztggb" id="{tb_name}",t0=F,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="gdtblmrc",t8=L"ncharTagValue",t11=127i8,t10=L"ncharTagValue"', 'bokaxl'), \
(f'{stb_name} 0 "gbkinqdk" id="{tb_name}",t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="iqniuvco",t8=L"ncharTagValue",t11=127i8,t10=L"ncharTagValue"', 'bokaxl'), \
(f'{stb_name} 0 "ldxxejbd" id="{tb_name}",t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="vxkipags",t8=L"ncharTagValue",t11=127i8,t10=L"ncharTagValue"', 'bokaxl'), \
(f'{stb_name} 0 "tlvzwjes" id="{tb_name}",t0=true,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="enwrlrtj",t8=L"ncharTagValue",t11=127i8,t10=L"ncharTagValue"', 'bokaxl')]
s_stb_s_tb_d_ts_a_tag_list = [(f'{stb_name} 0 "clummqfy" id="{tb_name}" t0=False t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="hpxzrdiw" t8=L"ncharTagValue" t11=127i8 t10=L"ncharTagValue"', 'bokaxl'), \
(f'{stb_name} 0 "yqeztggb" id="{tb_name}" t0=F t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="gdtblmrc" t8=L"ncharTagValue" t11=127i8 t10=L"ncharTagValue"', 'bokaxl'), \
(f'{stb_name} 0 "gbkinqdk" id="{tb_name}" t0=f t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="iqniuvco" t8=L"ncharTagValue" t11=127i8 t10=L"ncharTagValue"', 'bokaxl'), \
(f'{stb_name} 0 "ldxxejbd" id="{tb_name}" t0=f t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="vxkipags" t8=L"ncharTagValue" t11=127i8 t10=L"ncharTagValue"', 'bokaxl'), \
(f'{stb_name} 0 "tlvzwjes" id="{tb_name}" t0=true t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="enwrlrtj" t8=L"ncharTagValue" t11=127i8 t10=L"ncharTagValue"', 'bokaxl')]
self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_d_ts_a_tag_list))
tdSql.query(f"show tables;")
tdSql.checkRows(1)
......@@ -1264,44 +1308,31 @@ class TDTestCase:
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"")
self.resCmp(input_sql, stb_name)
s_stb_d_tb_d_ts_m_tag_list = [(f'{stb_name} 0 "mnpmtzul" t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64', 'pcppkg'), \
(f'{stb_name} 0 "zbvwckcd" t0=True,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64', 'pcppkg'), \
(f'{stb_name} 0 "vymcjfwc" t0=F,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64', 'pcppkg'), \
(f'{stb_name} 0 "laumkwfn" t0=False,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64', 'pcppkg'), \
(f'{stb_name} 0 "nyultzxr" t0=false,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64', 'pcppkg')]
s_stb_d_tb_d_ts_m_tag_list = [(f'{stb_name} 0 "mnpmtzul" t0=f t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'pcppkg'), \
(f'{stb_name} 0 "zbvwckcd" t0=True t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'pcppkg'), \
(f'{stb_name} 0 "vymcjfwc" t0=F t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'pcppkg'), \
(f'{stb_name} 0 "laumkwfn" t0=False t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'pcppkg'), \
(f'{stb_name} 0 "nyultzxr" t0=false t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'pcppkg')]
self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_d_ts_m_tag_list))
tdSql.query(f"show tables;")
tdSql.checkRows(3)
def test(self):
# input_sql1 = "stb2_5 1626006833610ms 3f64 host=\"host0\",host2=L\"host2\""
# input_sql2 = "rfasta,id=\"rfasta_1\",t0=true,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64 c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64 1626006933640000000ns"
try:
input_sql = f'test_nchar 0 L"涛思数据" t0=f,t1=L"涛思数据",t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64'
input_sql = f'test_nchar 0 L"涛思数据" t0=f t1=L"涛思数据" t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64'
self._conn.insert_telnet_lines([input_sql])
# input_sql, stb_name = self.genFullTypeSql()
# self.resCmp(input_sql, stb_name)
except LinesError as err:
except TelnetLinesError as err:
print(err.errno)
# self._conn.insert_telnet_lines([input_sql2])
# input_sql3 = f'abcd,id="cc¥Ec",t0=True,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="ndsfdrum",t8=L"ncharTagValue" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="igwoehkm",c8=L"ncharColValue",c9=7u64 0'
# print(input_sql3)
# input_sql4 = 'hmemeb,id="kilrcrldgf",t0=F,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="fysodjql",t8=L"ncharTagValue" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="waszbfvc",c8=L"ncharColValue",c9=7u64 0'
# code = self._conn.insert_telnet_lines([input_sql3])
# print(code)
# self._conn.insert_telnet_lines([input_sql4])
def runAll(self):
self.initCheckCase()
self.boolTypeCheckCase()
# ! leave a bug
#self.symbolsCheckCase()
self.symbolsCheckCase()
self.tsCheckCase()
self.idSeqCheckCase()
self.idUpperCheckCase()
self.noIdCheckCase()
self.maxColTagCheckCase()
self.idIllegalNameCheckCase()
self.idStartWithNumCheckCase()
self.nowTsCheckCase()
......@@ -1310,6 +1341,7 @@ class TDTestCase:
self.tagValueLengthCheckCase()
self.colValueLengthCheckCase()
self.tagColIllegalValueCheckCase()
self.blankCheckCase()
self.duplicateIdTagColInsertCheckCase()
self.noIdStbExistCheckCase()
self.duplicateInsertExistCheckCase()
......@@ -1319,9 +1351,8 @@ class TDTestCase:
self.tagMd5Check()
self.tagColBinaryMaxLengthCheckCase()
self.tagColNcharMaxLengthCheckCase()
self.batchInsertCheckCase()
self.multiInsertCheckCase(1000)
self.multiInsertCheckCase(10)
self.batchErrorInsertCheckCase()
self.multiColsInsertCheckCase()
self.blankColInsertCheckCase()
......@@ -1329,32 +1360,31 @@ class TDTestCase:
self.chineseCheckCase()
self.multiFieldCheckCase()
self.errorTypeCheckCase()
# MultiThreads
# self.stbInsertMultiThreadCheckCase()
# self.sStbStbDdataInsertMultiThreadCheckCase()
# self.sStbStbDdataAtInsertMultiThreadCheckCase()
# self.sStbStbDdataMtInsertMultiThreadCheckCase()
# self.sStbDtbDdataInsertMultiThreadCheckCase()
# self.sStbDtbDdataMtInsertMultiThreadCheckCase()
# self.sStbDtbDdataAtInsertMultiThreadCheckCase()
# self.sStbStbDdataDtsInsertMultiThreadCheckCase()
# self.sStbStbDdataDtsMtInsertMultiThreadCheckCase()
# self.sStbStbDdataDtsAtInsertMultiThreadCheckCase()
# self.sStbDtbDdataDtsInsertMultiThreadCheckCase()
# self.sStbDtbDdataDtsMtInsertMultiThreadCheckCase()
self.pointTransCheckCase()
self.defaultTypeCheckCase()
# # MultiThreads
self.stbInsertMultiThreadCheckCase()
self.sStbStbDdataInsertMultiThreadCheckCase()
self.sStbStbDdataAtInsertMultiThreadCheckCase()
self.sStbStbDdataMtInsertMultiThreadCheckCase()
self.sStbDtbDdataInsertMultiThreadCheckCase()
self.sStbDtbDdataMtInsertMultiThreadCheckCase()
self.sStbDtbDdataAtInsertMultiThreadCheckCase()
self.sStbStbDdataDtsInsertMultiThreadCheckCase()
self.sStbStbDdataDtsMtInsertMultiThreadCheckCase()
self.sStbStbDdataDtsAtInsertMultiThreadCheckCase()
self.sStbDtbDdataDtsInsertMultiThreadCheckCase()
self.sStbDtbDdataDtsMtInsertMultiThreadCheckCase()
def run(self):
print("running {}".format(__file__))
self.createDb()
try:
# self.symbolsCheckCase()
self.runAll()
# self.test()
except Exception as err:
print(''.join(traceback.format_exception(None, err, err.__traceback__)))
raise err
# self.tagColIllegalValueCheckCase()
# self.test()
def stop(self):
tdSql.close()
......
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
from util.log import *
from util.cases import *
from util.sql import *
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def run(self):
# TD-6586 Binary type value return None with python connector
# PR: https://github.com/taosdata/TDengine/pull/7913/files
tdSql.execute("create database if not exists binary_convertion")
tdSql.execute("use binary_convertion")
tdSql.execute("create stable stb (ts timestamp,value binary(3)) tags (t0 bool,t1 tinyint,t2 smallint,t3 int,t4 bigint,t5 float,t6 double,t7 binary(3),t8 nchar(3))")
tdSql.execute("create table if not exists tb1 using stb(t0,t1,t2,t3,t4,t5,t6,t7,t8) tags (1,127,32767,2147483647,9223372036854775807,11.123450279,22.123456789,'aaa','aaa')")
tdSql.execute("insert into tb1 (ts,value) values (1600000000000, \"aaa\")")
res = tdSql.query('select * from stb', True)
expected_res = [(datetime.datetime(2020, 9, 13, 20, 26, 40), 'aaa', True, 127, 32767, 2147483647, 9223372036854775807, 11.12345027923584, 22.123456789, 'aaa', 'aaa')]
tdSql.checkEqual(res, expected_res)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
......@@ -49,10 +49,11 @@ class TDTestCase:
# select as cname with cname_list
sql_seq = f'select count(ts) as {cname_list[0]}, sum(pi1) as {cname_list[1]}, avg(pi2) as {cname_list[2]}, count(pf1) as {cname_list[3]}, count(pf2) as {cname_list[4]}, count(ps1) as {cname_list[5]}, min(pi3) as {cname_list[6]}, max(pi4) as {cname_list[7]}, count(pb1) as {cname_list[8]}, count(ps2) as {cname_list[9]} from regular_table_cname_check'
sql_seq_no_as = sql_seq.replace('as ', '')
sql_seq_no_as = sql_seq.replace(' as ', ' ')
print(sql_seq)
print(sql_seq_no_as)
res = tdSql.getColNameList(sql_seq)
res_no_as = tdSql.getColNameList(sql_seq_no_as)
# cname[1] > 64, it is expected to be equal to 64
cname_list_1_expected = cname_list[1][:-1]
cname_list[1] = cname_list_1_expected
......@@ -79,7 +80,7 @@ class TDTestCase:
# select as cname with cname_list
sql_seq = f'select count(ts) as {cname_list[0]}, sum(pi1) as {cname_list[1]}, avg(pi2) as {cname_list[2]}, count(pf1) as {cname_list[3]}, count(pf2) as {cname_list[4]}, count(ps1) as {cname_list[5]}, min(pi3) as {cname_list[6]}, max(pi4) as {cname_list[7]}, count(pb1) as {cname_list[8]}, count(ps2) as {cname_list[9]}, count(si1) as {cname_list[10]}, count(si2) as {cname_list[11]}, count(sf1) as {cname_list[12]}, count(sf2) as {cname_list[13]}, count(ss1) as {cname_list[14]}, count(si3) as {cname_list[15]}, count(si4) as {cname_list[16]}, count(sb1) as {cname_list[17]}, count(ss2) as {cname_list[18]} from super_table_cname_check'
sql_seq_no_as = sql_seq.replace('as ', '')
sql_seq_no_as = sql_seq.replace(' as ', ' ')
res = tdSql.getColNameList(sql_seq)
res_no_as = tdSql.getColNameList(sql_seq_no_as)
......
......@@ -14,7 +14,7 @@
import random
import string
from util.sql import tdSql
from util.dnodes import tdDnodes
class TDCom:
def init(self, conn, logSql):
tdSql.init(conn.cursor(), logSql)
......@@ -47,6 +47,42 @@ class TDCom:
chars = ''.join(random.choice(string.ascii_letters.lower() + string.digits) for i in range(len))
return chars
def restartTaosd(self, index=1, db_name="db"):
tdDnodes.stop(index)
tdDnodes.startWithoutSleep(index)
tdSql.execute(f"use {db_name}")
def typeof(self, variate):
v_type=None
if type(variate) is int:
v_type = "int"
elif type(variate) is str:
v_type = "str"
elif type(variate) is float:
v_type = "float"
elif type(variate) is bool:
v_type = "bool"
elif type(variate) is list:
v_type = "list"
elif type(variate) is tuple:
v_type = "tuple"
elif type(variate) is dict:
v_type = "dict"
elif type(variate) is set:
v_type = "set"
return v_type
def splitNumLetter(self, input_mix_str):
nums, letters = "", ""
for i in input_mix_str:
if i.isdigit():
nums += i
elif i.isspace():
pass
else:
letters += i
return nums, letters
def close(self):
self.cursor.close()
......
......@@ -79,6 +79,23 @@ if $rows != 1 then
return -1
endi
sql select c1b from $st_name where c1b match '\\.\\*'
if $rows != 0 then
return -1
endi
sql select c1b from $st_name where c1b match '\\\\'
if $rows != 0 then
return -1
endi
sql insert into $ct1_name values(now+3s, '\\this is engine')
sql select c1b from $st_name where c1b match '\\'
if $rows != 1 then
return -1
endi
sql_error select c1b from $st_name where c1b match e;
sql_error select c1b from $st_name where c1b nmatch e;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册