diff --git a/Jenkinsfile b/Jenkinsfile index 28f1cb0bc0e652bcb546995c569f572096afbf28..e6e8a1df322ab4d529c1f7d44664717d278ba194 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -41,6 +41,7 @@ def pre_test(){ sh ''' killall -9 taosd ||echo "no taosd running" killall -9 gdb || echo "no gdb running" + killall -9 python3.8 || echo "no python program running" cd ${WKC} git reset --hard HEAD~10 >/dev/null ''' @@ -223,24 +224,27 @@ pipeline { steps { pre_test() catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh ''' - cd ${WKC}/tests/pytest - ./crash_gen.sh -a -p -t 4 -s 2000 - ''' + timeout(time: 60, unit: 'MINUTES'){ + sh ''' + cd ${WKC}/tests/pytest + ./crash_gen.sh -a -p -t 4 -s 2000 + ''' + } + } + timeout(time: 60, unit: 'MINUTES'){ + sh ''' + cd ${WKC}/tests/pytest + rm -rf /var/lib/taos/* + rm -rf /var/log/taos/* + ./handle_crash_gen_val_log.sh + ''' + sh ''' + cd ${WKC}/tests/pytest + rm -rf /var/lib/taos/* + rm -rf /var/log/taos/* + ./handle_taosd_val_log.sh + ''' } - - sh ''' - cd ${WKC}/tests/pytest - rm -rf /var/lib/taos/* - rm -rf /var/log/taos/* - ./handle_crash_gen_val_log.sh - ''' - sh ''' - cd ${WKC}/tests/pytest - rm -rf /var/lib/taos/* - rm -rf /var/log/taos/* - ./handle_taosd_val_log.sh - ''' timeout(time: 45, unit: 'MINUTES'){ sh ''' date diff --git a/src/client/src/tscParseLineProtocol.c b/src/client/src/tscParseLineProtocol.c index 69e55fd3339c7dac3de80872dbb3a0f09fc38a6e..2a16f1aad6525a25da652f643dc7b7f91debd432 100644 --- a/src/client/src/tscParseLineProtocol.c +++ b/src/client/src/tscParseLineProtocol.c @@ -1417,7 +1417,7 @@ static bool isTimeStamp(char *pVal, uint16_t len, SMLTimeStampType *tsType) { return false; } -static bool convertStrToNumber(TAOS_SML_KV *pVal, char*str) { +static bool convertStrToNumber(TAOS_SML_KV *pVal, char*str, SSmlLinesInfo* info) { errno = 0; uint8_t type = pVal->type; int16_t length = pVal->length; @@ -1436,7 +1436,7 @@ static bool convertStrToNumber(TAOS_SML_KV *pVal, char*str) { } if (errno == ERANGE) { - tscError("Converted number out of range"); + tscError("SML:0x%"PRIx64" Convert number(%s) out of range", info->id, str); return false; } @@ -1518,7 +1518,7 @@ static bool convertStrToNumber(TAOS_SML_KV *pVal, char*str) { } //len does not include '\0' from value. static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, - uint16_t len) { + uint16_t len, SSmlLinesInfo* info) { if (len <= 0) { return false; } @@ -1528,7 +1528,7 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, pVal->type = TSDB_DATA_TYPE_TINYINT; pVal->length = (int16_t)tDataTypes[pVal->type].bytes; value[len - 2] = '\0'; - if (!isValidInteger(value) || !convertStrToNumber(pVal, value)) { + if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) { return false; } return true; @@ -1537,7 +1537,7 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, pVal->type = TSDB_DATA_TYPE_UTINYINT; pVal->length = (int16_t)tDataTypes[pVal->type].bytes; value[len - 2] = '\0'; - if (!isValidInteger(value) || !convertStrToNumber(pVal, value)) { + if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) { return false; } return true; @@ -1546,7 +1546,7 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, pVal->type = TSDB_DATA_TYPE_SMALLINT; pVal->length = (int16_t)tDataTypes[pVal->type].bytes; value[len - 3] = '\0'; - if (!isValidInteger(value) || !convertStrToNumber(pVal, value)) { + if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) { return false; } return true; @@ -1555,7 +1555,7 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, pVal->type = TSDB_DATA_TYPE_USMALLINT; pVal->length = (int16_t)tDataTypes[pVal->type].bytes; value[len - 3] = '\0'; - if (!isValidInteger(value) || !convertStrToNumber(pVal, value)) { + if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) { return false; } return true; @@ -1564,7 +1564,7 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, pVal->type = TSDB_DATA_TYPE_INT; pVal->length = (int16_t)tDataTypes[pVal->type].bytes; value[len - 3] = '\0'; - if (!isValidInteger(value) || !convertStrToNumber(pVal, value)) { + if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) { return false; } return true; @@ -1573,7 +1573,7 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, pVal->type = TSDB_DATA_TYPE_UINT; pVal->length = (int16_t)tDataTypes[pVal->type].bytes; value[len - 3] = '\0'; - if (!isValidInteger(value) || !convertStrToNumber(pVal, value)) { + if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) { return false; } return true; @@ -1582,7 +1582,7 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, pVal->type = TSDB_DATA_TYPE_BIGINT; pVal->length = (int16_t)tDataTypes[pVal->type].bytes; value[len - 3] = '\0'; - if (!isValidInteger(value) || !convertStrToNumber(pVal, value)) { + if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) { return false; } return true; @@ -1591,7 +1591,7 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, pVal->type = TSDB_DATA_TYPE_UBIGINT; pVal->length = (int16_t)tDataTypes[pVal->type].bytes; value[len - 3] = '\0'; - if (!isValidInteger(value) || !convertStrToNumber(pVal, value)) { + if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) { return false; } return true; @@ -1601,7 +1601,7 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, pVal->type = TSDB_DATA_TYPE_FLOAT; pVal->length = (int16_t)tDataTypes[pVal->type].bytes; value[len - 3] = '\0'; - if (!isValidFloat(value) || !convertStrToNumber(pVal, value)) { + if (!isValidFloat(value) || !convertStrToNumber(pVal, value, info)) { return false; } return true; @@ -1610,7 +1610,7 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, pVal->type = TSDB_DATA_TYPE_DOUBLE; pVal->length = (int16_t)tDataTypes[pVal->type].bytes; value[len - 3] = '\0'; - if (!isValidFloat(value) || !convertStrToNumber(pVal, value)) { + if (!isValidFloat(value) || !convertStrToNumber(pVal, value, info)) { return false; } return true; @@ -1646,7 +1646,7 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, if (isValidInteger(value) || isValidFloat(value)) { pVal->type = TSDB_DATA_TYPE_FLOAT; pVal->length = (int16_t)tDataTypes[pVal->type].bytes; - if (!convertStrToNumber(pVal, value)) { + if (!convertStrToNumber(pVal, value, info)) { return false; } return true; @@ -1702,7 +1702,7 @@ static int32_t getTimeStampValue(char *value, uint16_t len, } static int32_t convertSmlTimeStamp(TAOS_SML_KV *pVal, char *value, - uint16_t len) { + uint16_t len, SSmlLinesInfo* info) { int32_t ret; SMLTimeStampType type; int64_t tsVal; @@ -1715,7 +1715,7 @@ static int32_t convertSmlTimeStamp(TAOS_SML_KV *pVal, char *value, if (ret) { return ret; } - tscDebug("Timestamp after conversion:%"PRId64, tsVal); + tscDebug("SML:0x%"PRIx64"Timestamp after conversion:%"PRId64, info->id, tsVal); pVal->type = TSDB_DATA_TYPE_TIMESTAMP; pVal->length = (int16_t)tDataTypes[pVal->type].bytes; @@ -1724,7 +1724,7 @@ static int32_t convertSmlTimeStamp(TAOS_SML_KV *pVal, char *value, return TSDB_CODE_SUCCESS; } -static int32_t parseSmlTimeStamp(TAOS_SML_KV **pTS, const char **index) { +static int32_t parseSmlTimeStamp(TAOS_SML_KV **pTS, const char **index, SSmlLinesInfo* info) { const char *start, *cur; int32_t ret = TSDB_CODE_SUCCESS; int len = 0; @@ -1744,7 +1744,7 @@ static int32_t parseSmlTimeStamp(TAOS_SML_KV **pTS, const char **index) { memcpy(value, start, len); } - ret = convertSmlTimeStamp(*pTS, value, len); + ret = convertSmlTimeStamp(*pTS, value, len, info); if (ret) { free(value); free(*pTS); @@ -1757,7 +1757,7 @@ static int32_t parseSmlTimeStamp(TAOS_SML_KV **pTS, const char **index) { return ret; } -static bool checkDuplicateKey(char *key, SHashObj *pHash) { +static bool checkDuplicateKey(char *key, SHashObj *pHash, SSmlLinesInfo* info) { char *val = NULL; char *cur = key; char keyLower[TSDB_COL_NAME_LEN]; @@ -1771,7 +1771,7 @@ static bool checkDuplicateKey(char *key, SHashObj *pHash) { val = taosHashGet(pHash, keyLower, keyLen); if (val) { - tscError("Duplicate key:%s", keyLower); + tscError("SML:0x%"PRIx64" Duplicate key detected:%s", info->id, keyLower); return true; } @@ -1781,19 +1781,19 @@ static bool checkDuplicateKey(char *key, SHashObj *pHash) { return false; } -static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash) { +static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash, SSmlLinesInfo* info) { const char *cur = *index; char key[TSDB_COL_NAME_LEN + 1]; // +1 to avoid key[len] over write uint16_t len = 0; //key field cannot start with digit if (isdigit(*cur)) { - tscError("Tag key cannnot start with digit\n"); + tscError("SML:0x%"PRIx64" Tag key cannnot start with digit", info->id); return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; } while (*cur != '\0') { if (len > TSDB_COL_NAME_LEN) { - tscDebug("Key field cannot exceeds 65 characters"); + tscError("SML:0x%"PRIx64" Key field cannot exceeds 65 characters", info->id); return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; } //unescaped '=' identifies a tag key @@ -1810,20 +1810,20 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash } key[len] = '\0'; - if (checkDuplicateKey(key, pHash)) { + if (checkDuplicateKey(key, pHash, info)) { return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; } pKV->key = calloc(len + 1, 1); memcpy(pKV->key, key, len + 1); - //tscDebug("Key:%s|len:%d", pKV->key, len); + //tscDebug("SML:0x%"PRIx64" Key:%s|len:%d", info->id, pKV->key, len); *index = cur + 1; return TSDB_CODE_SUCCESS; } static bool parseSmlValue(TAOS_SML_KV *pKV, const char **index, - bool *is_last_kv) { + bool *is_last_kv, SSmlLinesInfo* info) { const char *start, *cur; char *value = NULL; uint16_t len = 0; @@ -1847,7 +1847,9 @@ static bool parseSmlValue(TAOS_SML_KV *pKV, const char **index, value = calloc(len + 1, 1); memcpy(value, start, len); value[len] = '\0'; - if (!convertSmlValueType(pKV, value, len)) { + if (!convertSmlValueType(pKV, value, len, info)) { + tscError("SML:0x%"PRIx64" Failed to convert sml value string(%s) to any type", + info->id, value); //free previous alocated key field free(pKV->key); pKV->key = NULL; @@ -1861,7 +1863,7 @@ static bool parseSmlValue(TAOS_SML_KV *pKV, const char **index, } static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index, - uint8_t *has_tags) { + uint8_t *has_tags, SSmlLinesInfo* info) { const char *cur = *index; uint16_t len = 0; @@ -1870,7 +1872,7 @@ static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index return TSDB_CODE_TSC_OUT_OF_MEMORY; } if (isdigit(*cur)) { - tscError("Measurement field cannnot start with digit"); + tscError("SML:0x%"PRIx64" Measurement field cannnot start with digit", info->id); free(pSml->stableName); pSml->stableName = NULL; return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; @@ -1878,7 +1880,7 @@ static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index while (*cur != '\0') { if (len > TSDB_TABLE_NAME_LEN) { - tscError("Measurement field cannot exceeds 193 characters"); + tscError("SML:0x%"PRIx64" Measurement field cannot exceeds 193 characters", info->id); free(pSml->stableName); pSml->stableName = NULL; return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; @@ -1902,7 +1904,7 @@ static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index } pSml->stableName[len] = '\0'; *index = cur + 1; - tscDebug("Stable name in measurement:%s|len:%d", pSml->stableName, len); + tscDebug("SML:0x%"PRIx64" Stable name in measurement:%s|len:%d", info->id, pSml->stableName, len); return TSDB_CODE_SUCCESS; } @@ -1921,7 +1923,8 @@ static int32_t isValidChildTableName(const char *pTbName, int16_t len) { static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs, const char **index, bool isField, - TAOS_SML_DATA_POINT* smlData, SHashObj *pHash) { + TAOS_SML_DATA_POINT* smlData, SHashObj *pHash, + SSmlLinesInfo* info) { const char *cur = *index; int32_t ret = TSDB_CODE_SUCCESS; TAOS_SML_KV *pkv; @@ -1941,14 +1944,14 @@ static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs, } while (*cur != '\0') { - ret = parseSmlKey(pkv, &cur, pHash); + ret = parseSmlKey(pkv, &cur, pHash, info); if (ret) { - tscError("Unable to parse key field"); + tscError("SML:0x%"PRIx64" Unable to parse key", info->id); goto error; } - ret = parseSmlValue(pkv, &cur, &is_last_kv); + ret = parseSmlValue(pkv, &cur, &is_last_kv, info); if (ret) { - tscError("Unable to parse value field"); + tscError("SML:0x%"PRIx64" Unable to parse value", info->id); goto error; } if (!isField && @@ -1966,7 +1969,6 @@ static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs, *num_kvs += 1; } if (is_last_kv) { - //tscDebug("last key-value field detected"); goto done; } @@ -2024,50 +2026,50 @@ static void moveTimeStampToFirstKv(TAOS_SML_DATA_POINT** smlData, TAOS_SML_KV *t free(ts); } -int32_t tscParseLine(const char* sql, TAOS_SML_DATA_POINT* smlData) { +int32_t tscParseLine(const char* sql, TAOS_SML_DATA_POINT* smlData, SSmlLinesInfo* info) { const char* index = sql; int32_t ret = TSDB_CODE_SUCCESS; uint8_t has_tags = 0; TAOS_SML_KV *timestamp = NULL; SHashObj *keyHashTable = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, false); - ret = parseSmlMeasurement(smlData, &index, &has_tags); + ret = parseSmlMeasurement(smlData, &index, &has_tags, info); if (ret) { - tscError("Unable to parse measurement"); + tscError("SML:0x%"PRIx64" Unable to parse measurement", info->id); taosHashCleanup(keyHashTable); return ret; } - tscDebug("Parse measurement finished, has_tags:%d", has_tags); + tscDebug("SML:0x%"PRIx64" Parse measurement finished, has_tags:%d", info->id, has_tags); //Parse Tags if (has_tags) { - ret = parseSmlKvPairs(&smlData->tags, &smlData->tagNum, &index, false, smlData, keyHashTable); + ret = parseSmlKvPairs(&smlData->tags, &smlData->tagNum, &index, false, smlData, keyHashTable, info); if (ret) { - tscError("Unable to parse tag"); + tscError("SML:0x%"PRIx64" Unable to parse tag", info->id); taosHashCleanup(keyHashTable); return ret; } } - tscDebug("Parse tags finished, num of tags:%d", smlData->tagNum); + tscDebug("SML:0x%"PRIx64" Parse tags finished, num of tags:%d", info->id, smlData->tagNum); //Parse fields - ret = parseSmlKvPairs(&smlData->fields, &smlData->fieldNum, &index, true, smlData, keyHashTable); + ret = parseSmlKvPairs(&smlData->fields, &smlData->fieldNum, &index, true, smlData, keyHashTable, info); if (ret) { - tscError("Unable to parse field"); + tscError("SML:0x%"PRIx64" Unable to parse field", info->id); taosHashCleanup(keyHashTable); return ret; } - tscDebug("Parse fields finished, num of fields:%d", smlData->fieldNum); + tscDebug("SML:0x%"PRIx64" Parse fields finished, num of fields:%d", info->id, smlData->fieldNum); taosHashCleanup(keyHashTable); //Parse timestamp - ret = parseSmlTimeStamp(×tamp, &index); + ret = parseSmlTimeStamp(×tamp, &index, info); if (ret) { - tscError("Unable to parse timestamp"); + tscError("SML:0x%"PRIx64" Unable to parse timestamp", info->id); return ret; } moveTimeStampToFirstKv(&smlData, timestamp); - tscDebug("Parse timestamp finished"); + tscDebug("SML:0x%"PRIx64" Parse timestamp finished", info->id); return TSDB_CODE_SUCCESS; } @@ -2104,7 +2106,7 @@ void destroySmlDataPoint(TAOS_SML_DATA_POINT* point) { int32_t tscParseLines(char* lines[], int numLines, SArray* points, SArray* failedLines, SSmlLinesInfo* info) { for (int32_t i = 0; i < numLines; ++i) { TAOS_SML_DATA_POINT point = {0}; - int32_t code = tscParseLine(lines[i], &point); + int32_t code = tscParseLine(lines[i], &point, info); if (code != TSDB_CODE_SUCCESS) { tscError("SML:0x%"PRIx64" data point line parse failed. line %d : %s", info->id, i, lines[i]); destroySmlDataPoint(&point); diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index 5ac85f87f1a7f9055241cf8f813c75b9bc72f46a..d04bb2905f0d67c8614cd7594a1aa84213752964 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -5093,7 +5093,9 @@ static int getRowDataFromSample( static int64_t generateStbRowData( SSuperTable* stbInfo, - char* recBuf, int64_t timestamp) + char* recBuf, + int64_t remainderBufLen, + int64_t timestamp) { int64_t dataLen = 0; char *pstr = recBuf; @@ -5121,6 +5123,7 @@ static int64_t generateStbRowData( rand_string(buf, stbInfo->columns[i].dataLen); dataLen += snprintf(pstr + dataLen, maxLen - dataLen, "\'%s\',", buf); tmfree(buf); + } else { char *tmp; @@ -5177,6 +5180,9 @@ static int64_t generateStbRowData( tstrncpy(pstr + dataLen, ",", 2); dataLen += 1; } + + if (dataLen > remainderBufLen) + return 0; } dataLen -= 1; @@ -5383,7 +5389,7 @@ static int32_t generateDataTailWithoutStb( int32_t k = 0; for (k = 0; k < batch;) { - char data[MAX_DATA_SIZE]; + char *data = pstr; memset(data, 0, MAX_DATA_SIZE); int64_t retLen = 0; @@ -5407,7 +5413,7 @@ static int32_t generateDataTailWithoutStb( if (len > remainderBufLen) break; - pstr += sprintf(pstr, "%s", data); + pstr += retLen; k++; len += retLen; remainderBufLen -= retLen; @@ -5463,14 +5469,14 @@ static int32_t generateStbDataTail( int32_t k; for (k = 0; k < batch;) { - char data[MAX_DATA_SIZE]; - memset(data, 0, MAX_DATA_SIZE); + char *data = pstr; int64_t lenOfRow = 0; if (tsRand) { if (superTblInfo->disorderRatio > 0) { lenOfRow = generateStbRowData(superTblInfo, data, + remainderBufLen, startTime + getTSRandTail( superTblInfo->timeStampStep, k, superTblInfo->disorderRatio, @@ -5478,6 +5484,7 @@ static int32_t generateStbDataTail( ); } else { lenOfRow = generateStbRowData(superTblInfo, data, + remainderBufLen, startTime + superTblInfo->timeStampStep * k ); } @@ -5490,11 +5497,15 @@ static int32_t generateStbDataTail( pSamplePos); } + if (lenOfRow == 0) { + data[0] = '\0'; + break; + } if ((lenOfRow + 1) > remainderBufLen) { break; } - pstr += snprintf(pstr , lenOfRow + 1, "%s", data); + pstr += lenOfRow; k++; len += lenOfRow; remainderBufLen -= lenOfRow; @@ -6246,7 +6257,7 @@ static int32_t generateStbProgressiveData( assert(buffer != NULL); char *pstr = buffer; - memset(buffer, 0, *pRemainderBufLen); + memset(pstr, 0, *pRemainderBufLen); int64_t headLen = generateStbSQLHead( superTblInfo, @@ -6640,7 +6651,7 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) { return NULL; } - int64_t remainderBufLen = maxSqlLen; + int64_t remainderBufLen = maxSqlLen - 2000; char *pstr = pThreadInfo->buffer; int len = snprintf(pstr, @@ -6822,10 +6833,14 @@ static void callBack(void *param, TAOS_RES *res, int code) { && rand_num < pThreadInfo->superTblInfo->disorderRatio) { int64_t d = pThreadInfo->lastTs - (taosRandom() % pThreadInfo->superTblInfo->disorderRange + 1); - generateStbRowData(pThreadInfo->superTblInfo, data, d); + generateStbRowData(pThreadInfo->superTblInfo, data, + MAX_DATA_SIZE, + d); } else { generateStbRowData(pThreadInfo->superTblInfo, - data, pThreadInfo->lastTs += 1000); + data, + MAX_DATA_SIZE, + pThreadInfo->lastTs += 1000); } pstr += sprintf(pstr, "%s", data); pThreadInfo->counter++; @@ -7050,6 +7065,7 @@ static void startMultiThreadInsertData(int threads, char* db_name, for (int i = 0; i < threads; i++) { threadInfo *pThreadInfo = infos + i; pThreadInfo->threadID = i; + tstrncpy(pThreadInfo->db_name, db_name, TSDB_DB_NAME_LEN); pThreadInfo->time_precision = timePrec; pThreadInfo->superTblInfo = superTblInfo; diff --git a/src/kit/taosdump/taosdump.c b/src/kit/taosdump/taosdump.c index dc36dbf6714b0f3de31e40dfc1bcebaeb2c61223..e3f3880f0cee97b3297b23d48b2229a12ff4c682 100644 --- a/src/kit/taosdump/taosdump.c +++ b/src/kit/taosdump/taosdump.c @@ -307,7 +307,7 @@ static void taosDumpCreateTableClause(STableDef *tableDes, int numOfCols, FILE *fp, char* dbName); static void taosDumpCreateMTableClause(STableDef *tableDes, char *metric, int numOfCols, FILE *fp, char* dbName); -static int32_t taosDumpTable(char *table, char *metric, +static int32_t taosDumpTable(char *tbName, char *metric, FILE *fp, TAOS* taosCon, char* dbName); static int taosDumpTableData(FILE *fp, char *tbName, TAOS* taosCon, char* dbName, @@ -340,7 +340,7 @@ struct arguments g_args = { false, // schemeonly true, // with_property false, // avro format - -INT64_MAX, // start_time + -INT64_MAX, // start_time INT64_MAX, // end_time "ms", // precision 1, // data_batch @@ -798,11 +798,11 @@ static int taosGetTableRecordInfo( tstrncpy(pTableRecordInfo->tableRecord.name, (char *)row[TSDB_SHOW_TABLES_NAME_INDEX], min(TSDB_TABLE_NAME_LEN, - fields[TSDB_SHOW_TABLES_NAME_INDEX].bytes) + 1); + fields[TSDB_SHOW_TABLES_NAME_INDEX].bytes + 1)); tstrncpy(pTableRecordInfo->tableRecord.metric, (char *)row[TSDB_SHOW_TABLES_METRIC_INDEX], min(TSDB_TABLE_NAME_LEN, - fields[TSDB_SHOW_TABLES_METRIC_INDEX].bytes) + 1); + fields[TSDB_SHOW_TABLES_METRIC_INDEX].bytes + 1)); break; } @@ -945,7 +945,7 @@ static int32_t taosSaveTableOfMetricToTempFile( int32_t numOfThread = *totalNumOfThread; int subFd = -1; - for (; numOfThread < maxThreads; numOfThread++) { + for (; numOfThread <= maxThreads; numOfThread++) { memset(tmpBuf, 0, MAX_FILE_NAME_LEN); sprintf(tmpBuf, ".tables.tmp.%d", numOfThread); subFd = open(tmpBuf, O_RDWR | O_CREAT | O_TRUNC, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH); @@ -1084,7 +1084,7 @@ _dump_db_point: } tstrncpy(g_dbInfos[count]->name, (char *)row[TSDB_SHOW_DB_NAME_INDEX], - min(TSDB_DB_NAME_LEN, fields[TSDB_SHOW_DB_NAME_INDEX].bytes) + 1); + min(TSDB_DB_NAME_LEN, fields[TSDB_SHOW_DB_NAME_INDEX].bytes + 1)); if (g_args.with_property) { g_dbInfos[count]->ntables = *((int32_t *)row[TSDB_SHOW_DB_NTABLES_INDEX]); g_dbInfos[count]->vgroups = *((int32_t *)row[TSDB_SHOW_DB_VGROUPS_INDEX]); @@ -1093,7 +1093,7 @@ _dump_db_point: g_dbInfos[count]->days = *((int16_t *)row[TSDB_SHOW_DB_DAYS_INDEX]); tstrncpy(g_dbInfos[count]->keeplist, (char *)row[TSDB_SHOW_DB_KEEP_INDEX], - min(32, fields[TSDB_SHOW_DB_KEEP_INDEX].bytes) + 1); + min(32, fields[TSDB_SHOW_DB_KEEP_INDEX].bytes + 1)); //g_dbInfos[count]->daysToKeep = *((int16_t *)row[TSDB_SHOW_DB_KEEP_INDEX]); //g_dbInfos[count]->daysToKeep1; //g_dbInfos[count]->daysToKeep2; @@ -1107,7 +1107,7 @@ _dump_db_point: g_dbInfos[count]->cachelast = (int8_t)(*((int8_t *)row[TSDB_SHOW_DB_CACHELAST_INDEX])); tstrncpy(g_dbInfos[count]->precision, (char *)row[TSDB_SHOW_DB_PRECISION_INDEX], - min(8, fields[TSDB_SHOW_DB_PRECISION_INDEX].bytes) + 1); + min(8, fields[TSDB_SHOW_DB_PRECISION_INDEX].bytes + 1)); //g_dbInfos[count]->precision = *((int8_t *)row[TSDB_SHOW_DB_PRECISION_INDEX]); g_dbInfos[count]->update = *((int8_t *)row[TSDB_SHOW_DB_UPDATE_INDEX]); } @@ -1237,7 +1237,7 @@ _exit_failure: static int taosGetTableDes( char* dbName, char *table, - STableDef *tableDes, TAOS* taosCon, bool isSuperTable) { + STableDef *stableDes, TAOS* taosCon, bool isSuperTable) { TAOS_ROW row = NULL; TAOS_RES* res = NULL; int count = 0; @@ -1256,18 +1256,18 @@ static int taosGetTableDes( TAOS_FIELD *fields = taos_fetch_fields(res); - tstrncpy(tableDes->name, table, TSDB_TABLE_NAME_LEN); + tstrncpy(stableDes->name, table, TSDB_TABLE_NAME_LEN); while ((row = taos_fetch_row(res)) != NULL) { - tstrncpy(tableDes->cols[count].field, + tstrncpy(stableDes->cols[count].field, (char *)row[TSDB_DESCRIBE_METRIC_FIELD_INDEX], min(TSDB_COL_NAME_LEN + 1, fields[TSDB_DESCRIBE_METRIC_FIELD_INDEX].bytes + 1)); - tstrncpy(tableDes->cols[count].type, + tstrncpy(stableDes->cols[count].type, (char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX], min(16, fields[TSDB_DESCRIBE_METRIC_TYPE_INDEX].bytes + 1)); - tableDes->cols[count].length = + stableDes->cols[count].length = *((int *)row[TSDB_DESCRIBE_METRIC_LENGTH_INDEX]); - tstrncpy(tableDes->cols[count].note, + tstrncpy(stableDes->cols[count].note, (char *)row[TSDB_DESCRIBE_METRIC_NOTE_INDEX], min(COL_NOTE_LEN, fields[TSDB_DESCRIBE_METRIC_NOTE_INDEX].bytes + 1)); @@ -1284,11 +1284,11 @@ static int taosGetTableDes( // if chidl-table have tag, using select tagName from table to get tagValue for (int i = 0 ; i < count; i++) { - if (strcmp(tableDes->cols[i].note, "TAG") != 0) continue; + if (strcmp(stableDes->cols[i].note, "TAG") != 0) continue; sprintf(sqlstr, "select %s from %s.%s", - tableDes->cols[i].field, dbName, table); + stableDes->cols[i].field, dbName, table); res = taos_query(taosCon, sqlstr); code = taos_errno(res); @@ -1310,7 +1310,7 @@ static int taosGetTableDes( } if (row[0] == NULL) { - sprintf(tableDes->cols[i].note, "%s", "NULL"); + sprintf(stableDes->cols[i].note, "%s", "NULL"); taos_free_result(res); res = NULL; continue; @@ -1321,47 +1321,47 @@ static int taosGetTableDes( //int32_t* length = taos_fetch_lengths(tmpResult); switch (fields[0].type) { case TSDB_DATA_TYPE_BOOL: - sprintf(tableDes->cols[i].note, "%d", + sprintf(stableDes->cols[i].note, "%d", ((((int32_t)(*((char *)row[0]))) == 1) ? 1 : 0)); break; case TSDB_DATA_TYPE_TINYINT: - sprintf(tableDes->cols[i].note, "%d", *((int8_t *)row[0])); + sprintf(stableDes->cols[i].note, "%d", *((int8_t *)row[0])); break; case TSDB_DATA_TYPE_SMALLINT: - sprintf(tableDes->cols[i].note, "%d", *((int16_t *)row[0])); + sprintf(stableDes->cols[i].note, "%d", *((int16_t *)row[0])); break; case TSDB_DATA_TYPE_INT: - sprintf(tableDes->cols[i].note, "%d", *((int32_t *)row[0])); + sprintf(stableDes->cols[i].note, "%d", *((int32_t *)row[0])); break; case TSDB_DATA_TYPE_BIGINT: - sprintf(tableDes->cols[i].note, "%" PRId64 "", *((int64_t *)row[0])); + sprintf(stableDes->cols[i].note, "%" PRId64 "", *((int64_t *)row[0])); break; case TSDB_DATA_TYPE_FLOAT: - sprintf(tableDes->cols[i].note, "%f", GET_FLOAT_VAL(row[0])); + sprintf(stableDes->cols[i].note, "%f", GET_FLOAT_VAL(row[0])); break; case TSDB_DATA_TYPE_DOUBLE: - sprintf(tableDes->cols[i].note, "%f", GET_DOUBLE_VAL(row[0])); + sprintf(stableDes->cols[i].note, "%f", GET_DOUBLE_VAL(row[0])); break; case TSDB_DATA_TYPE_BINARY: { - memset(tableDes->cols[i].note, 0, sizeof(tableDes->cols[i].note)); - tableDes->cols[i].note[0] = '\''; + memset(stableDes->cols[i].note, 0, sizeof(stableDes->cols[i].note)); + stableDes->cols[i].note[0] = '\''; char tbuf[COL_NOTE_LEN]; converStringToReadable((char *)row[0], length[0], tbuf, COL_NOTE_LEN); - char* pstr = stpcpy(&(tableDes->cols[i].note[1]), tbuf); + char* pstr = stpcpy(&(stableDes->cols[i].note[1]), tbuf); *(pstr++) = '\''; break; } case TSDB_DATA_TYPE_NCHAR: { - memset(tableDes->cols[i].note, 0, sizeof(tableDes->cols[i].note)); + memset(stableDes->cols[i].note, 0, sizeof(stableDes->cols[i].note)); char tbuf[COL_NOTE_LEN-2]; // need reserve 2 bytes for ' ' convertNCharToReadable((char *)row[0], length[0], tbuf, COL_NOTE_LEN); - sprintf(tableDes->cols[i].note, "\'%s\'", tbuf); + sprintf(stableDes->cols[i].note, "\'%s\'", tbuf); break; } case TSDB_DATA_TYPE_TIMESTAMP: - sprintf(tableDes->cols[i].note, "%" PRId64 "", *(int64_t *)row[0]); + sprintf(stableDes->cols[i].note, "%" PRId64 "", *(int64_t *)row[0]); #if 0 if (!g_args.mysqlFlag) { sprintf(tableDes->cols[i].note, "%" PRId64 "", *(int64_t *)row[0]); @@ -1386,7 +1386,7 @@ static int taosGetTableDes( return count; } -static int convertSchemaToAvroSchema(STableDef *tableDes, char **avroSchema) +static int convertSchemaToAvroSchema(STableDef *stableDes, char **avroSchema) { errorPrint("%s() LN%d TODO: covert table schema to avro schema\n", __func__, __LINE__); @@ -1394,7 +1394,7 @@ static int convertSchemaToAvroSchema(STableDef *tableDes, char **avroSchema) } static int32_t taosDumpTable( - char *table, char *metric, + char *tbName, char *metric, FILE *fp, TAOS* taosCon, char* dbName) { int count = 0; @@ -1415,7 +1415,7 @@ static int32_t taosDumpTable( memset(tableDes, 0, sizeof(STableDef) + sizeof(SColDes) * TSDB_MAX_COLUMNS); */ - count = taosGetTableDes(dbName, table, tableDes, taosCon, false); + count = taosGetTableDes(dbName, tbName, tableDes, taosCon, false); if (count < 0) { free(tableDes); @@ -1426,7 +1426,7 @@ static int32_t taosDumpTable( taosDumpCreateMTableClause(tableDes, metric, count, fp, dbName); } else { // dump table definition - count = taosGetTableDes(dbName, table, tableDes, taosCon, false); + count = taosGetTableDes(dbName, tbName, tableDes, taosCon, false); if (count < 0) { free(tableDes); @@ -1446,7 +1446,7 @@ static int32_t taosDumpTable( int32_t ret = 0; if (!g_args.schemaonly) { - ret = taosDumpTableData(fp, table, taosCon, dbName, + ret = taosDumpTableData(fp, tbName, taosCon, dbName, jsonAvroSchema); } @@ -1648,26 +1648,27 @@ static void taosStartDumpOutWorkThreads(int32_t numOfThread, char *dbName) static int32_t taosDumpStable(char *table, FILE *fp, TAOS* taosCon, char* dbName) { - uint64_t sizeOfTableDes = (uint64_t)(sizeof(STableDef) + sizeof(SColDes) * TSDB_MAX_COLUMNS); - STableDef *tableDes = (STableDef *)calloc(1, sizeOfTableDes); - if (NULL == tableDes) { + uint64_t sizeOfTableDes = + (uint64_t)(sizeof(STableDef) + sizeof(SColDes) * TSDB_MAX_COLUMNS); + STableDef *stableDes = (STableDef *)calloc(1, sizeOfTableDes); + if (NULL == stableDes) { errorPrint("%s() LN%d, failed to allocate %"PRIu64" memory\n", __func__, __LINE__, sizeOfTableDes); exit(-1); } - int count = taosGetTableDes(dbName, table, tableDes, taosCon, true); + int count = taosGetTableDes(dbName, table, stableDes, taosCon, true); if (count < 0) { - free(tableDes); + free(stableDes); errorPrint("%s() LN%d, failed to get stable[%s] schema\n", __func__, __LINE__, table); exit(-1); } - taosDumpCreateTableClause(tableDes, count, fp, dbName); + taosDumpCreateTableClause(stableDes, count, fp, dbName); - free(tableDes); + free(stableDes); return 0; } @@ -1707,7 +1708,7 @@ static int32_t taosDumpCreateSuperTableClause(TAOS* taosCon, char* dbName, FILE memset(&tableRecord, 0, sizeof(STableRecord)); tstrncpy(tableRecord.name, (char *)row[TSDB_SHOW_TABLES_NAME_INDEX], min(TSDB_TABLE_NAME_LEN, - fields[TSDB_SHOW_TABLES_NAME_INDEX].bytes) + 1); + fields[TSDB_SHOW_TABLES_NAME_INDEX].bytes + 1)); taosWrite(fd, &tableRecord, sizeof(STableRecord)); } @@ -1782,10 +1783,10 @@ static int taosDumpDb(SDbInfo *dbInfo, FILE *fp, TAOS *taosCon) { memset(&tableRecord, 0, sizeof(STableRecord)); tstrncpy(tableRecord.name, (char *)row[TSDB_SHOW_TABLES_NAME_INDEX], min(TSDB_TABLE_NAME_LEN, - fields[TSDB_SHOW_TABLES_NAME_INDEX].bytes) + 1); + fields[TSDB_SHOW_TABLES_NAME_INDEX].bytes + 1)); tstrncpy(tableRecord.metric, (char *)row[TSDB_SHOW_TABLES_METRIC_INDEX], min(TSDB_TABLE_NAME_LEN, - fields[TSDB_SHOW_TABLES_METRIC_INDEX].bytes) + 1); + fields[TSDB_SHOW_TABLES_METRIC_INDEX].bytes + 1)); taosWrite(fd, &tableRecord, sizeof(STableRecord)); @@ -1865,52 +1866,52 @@ static int taosDumpDb(SDbInfo *dbInfo, FILE *fp, TAOS *taosCon) { static void taosDumpCreateTableClause(STableDef *tableDes, int numOfCols, FILE *fp, char* dbName) { - int counter = 0; - int count_temp = 0; - char sqlstr[COMMAND_SIZE]; + int counter = 0; + int count_temp = 0; + char sqlstr[COMMAND_SIZE]; - char* pstr = sqlstr; + char* pstr = sqlstr; - pstr += sprintf(sqlstr, "CREATE TABLE IF NOT EXISTS %s.%s", - dbName, tableDes->name); + pstr += sprintf(sqlstr, "CREATE TABLE IF NOT EXISTS %s.%s", + dbName, tableDes->name); - for (; counter < numOfCols; counter++) { - if (tableDes->cols[counter].note[0] != '\0') break; + for (; counter < numOfCols; counter++) { + if (tableDes->cols[counter].note[0] != '\0') break; - if (counter == 0) { - pstr += sprintf(pstr, " (%s %s", - tableDes->cols[counter].field, tableDes->cols[counter].type); - } else { - pstr += sprintf(pstr, ", %s %s", - tableDes->cols[counter].field, tableDes->cols[counter].type); - } + if (counter == 0) { + pstr += sprintf(pstr, " (%s %s", + tableDes->cols[counter].field, tableDes->cols[counter].type); + } else { + pstr += sprintf(pstr, ", %s %s", + tableDes->cols[counter].field, tableDes->cols[counter].type); + } - if (strcasecmp(tableDes->cols[counter].type, "binary") == 0 || - strcasecmp(tableDes->cols[counter].type, "nchar") == 0) { - pstr += sprintf(pstr, "(%d)", tableDes->cols[counter].length); + if (strcasecmp(tableDes->cols[counter].type, "binary") == 0 || + strcasecmp(tableDes->cols[counter].type, "nchar") == 0) { + pstr += sprintf(pstr, "(%d)", tableDes->cols[counter].length); + } } - } - count_temp = counter; + count_temp = counter; - for (; counter < numOfCols; counter++) { - if (counter == count_temp) { - pstr += sprintf(pstr, ") TAGS (%s %s", - tableDes->cols[counter].field, tableDes->cols[counter].type); - } else { - pstr += sprintf(pstr, ", %s %s", - tableDes->cols[counter].field, tableDes->cols[counter].type); - } + for (; counter < numOfCols; counter++) { + if (counter == count_temp) { + pstr += sprintf(pstr, ") TAGS (%s %s", + tableDes->cols[counter].field, tableDes->cols[counter].type); + } else { + pstr += sprintf(pstr, ", %s %s", + tableDes->cols[counter].field, tableDes->cols[counter].type); + } - if (strcasecmp(tableDes->cols[counter].type, "binary") == 0 || - strcasecmp(tableDes->cols[counter].type, "nchar") == 0) { - pstr += sprintf(pstr, "(%d)", tableDes->cols[counter].length); + if (strcasecmp(tableDes->cols[counter].type, "binary") == 0 || + strcasecmp(tableDes->cols[counter].type, "nchar") == 0) { + pstr += sprintf(pstr, "(%d)", tableDes->cols[counter].length); + } } - } - pstr += sprintf(pstr, ");"); + pstr += sprintf(pstr, ");"); - fprintf(fp, "%s\n\n", sqlstr); + fprintf(fp, "%s\n\n", sqlstr); } static void taosDumpCreateMTableClause(STableDef *tableDes, char *metric, diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index b86e96d0bb40c43c7f39da9b372389caa4969c4e..9a0212d652425171b2ff63652ae0717ab34de236 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -148,6 +148,9 @@ python3 ./test.py -f import_merge/importTPORestart.py python3 ./test.py -f import_merge/importTRestart.py python3 ./test.py -f import_merge/importInsertThenImport.py python3 ./test.py -f import_merge/importCSV.py +python3 ./test.py -f import_merge/import_update_0.py +python3 ./test.py -f import_merge/import_update_1.py +python3 ./test.py -f import_merge/import_update_2.py #======================p1-end=============== #======================p2-start=============== # tools @@ -376,6 +379,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 #======================p4-end=============== python3 test.py -f tools/taosdemoAllTest/pytest.py diff --git a/tests/pytest/import_merge/import_update_0.py b/tests/pytest/import_merge/import_update_0.py new file mode 100644 index 0000000000000000000000000000000000000000..6466deb3704223178c4786bbdaa64d493455fed8 --- /dev/null +++ b/tests/pytest/import_merge/import_update_0.py @@ -0,0 +1,1913 @@ +################################################################### +# 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 -*- + +import sys +import taos +from util.log import tdLog +from util.cases import tdCases +from util.sql import tdSql +from util.dnodes import * +import random +import time + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + self.ts = 1600000000000 + self.num = 50 + self.num4096 = 5 + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + def run(self): + tdSql.prepare() + # test case for https://jira.taosdata.com:18080/browse/TD-5062 + + startTime = time.time() + + tdSql.execute('''drop database if exists test_updata_0 ;''') + # update 0 不更新 ; update 1 覆盖更新 ;update 2 合并更新 + tdLog.info("========== test database updata = 0 ==========") + tdSql.execute('''create database test_updata_0 update 0 minrows 10 maxrows 200 ;''') + tdSql.execute('''use test_updata_0;''') + tdSql.execute('''create stable stable_1 + (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint, + q_bool bool , q_binary binary(10) , q_nchar nchar(10) , q_float float , q_double double , q_ts timestamp) + tags(loc nchar(20) , t_int int);''') + tdSql.execute('''create table table_1 using stable_1 tags('table_1' , '1' )''') + tdSql.execute('''create table table_2 using stable_1 tags('table_2' , '2' )''') + tdSql.execute('''create table table_3 using stable_1 tags('table_3' , '3' )''') + + #regular table + tdSql.execute('''create table regular_table_1 + (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint, + q_bool bool , q_binary binary(10) , q_nchar nchar(10) , q_float float , q_double double , q_ts timestamp) ;''') + tdSql.execute('''create table regular_table_2 + (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint, + q_bool bool , q_binary binary(10) , q_nchar nchar(10) , q_float float , q_double double , q_ts timestamp) ;''') + tdSql.execute('''create table regular_table_3 + (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint, + q_bool bool , q_binary binary(10) , q_nchar nchar(10) , q_float float , q_double double , q_ts timestamp) ;''') + + + tdLog.info("========== test1.1 : insert data , check data==========") + tdLog.info("========== regular_table ==========") + tdSql.execute('''insert into regular_table_1 values( %d , 0, 0, 0, 0, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 200)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into regular_table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 200)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into regular_table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 500)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into regular_table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 500)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdLog.info("========== stable ==========") + tdSql.execute('''insert into table_1 values( %d , 0, 0, 0, 0, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 200)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 200)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 500)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 500)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + + tdLog.info("========== 4096 regular_table ==========") + sql = "create table regular_table_4096_1 (ts timestamp, " + for i in range(500): + sql += "int_%d int, " % (i + 1) + for i in range(500,1000): + sql += "smallint_%d smallint, " % (i + 1) + for i in range(1000,1500): + sql += "tinyint_%d tinyint, " % (i + 1) + for i in range(1500,2000): + sql += "double_%d double, " % (i + 1) + for i in range(2000,2500): + sql += "float_%d float, " % (i + 1) + for i in range(2500,3000): + sql += "bool_%d bool, " % (i + 1) + for i in range(3000,3500): + sql += "bigint_%d bigint, " % (i + 1) + for i in range(3500,3800): + sql += "nchar_%d nchar(4), " % (i + 1) + for i in range(3800,4090): + sql += "binary_%d binary(10), " % (i + 1) + for i in range(4090,4094): + sql += "timestamp_%d timestamp, " % (i + 1) + sql += "col4095 binary(22))" + tdLog.info(len(sql)) + tdSql.execute(sql) + + for i in range(self.num4096): + sql = "insert into regular_table_4096_1 values(%d, " + for j in range(4090): + str = "'%s', " % 'NULL' + sql += str + for j in range(4090,4094): + str = "%s, " % (self.ts + j) + sql += str + sql += "'%s')" % (self.ts + i) + tdSql.execute(sql % (self.ts + i)) + tdSql.query('''select * from regular_table_4096_1 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4095,'1600000000000') + + sql = '''insert into regular_table_4096_1 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-10 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-10 20:26:44.090','1500000000000');''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_1 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4095,'1500000000000') + + tdLog.info("========== 4096 stable ==========") + sql = "create stable stable_4096_1 (ts timestamp, " + for i in range(500): + sql += "int_%d int, " % (i + 1) + for i in range(500,1000): + sql += "smallint_%d smallint, " % (i + 1) + for i in range(1000,1500): + sql += "tinyint_%d tinyint, " % (i + 1) + for i in range(1500,2000): + sql += "double_%d double, " % (i + 1) + for i in range(2000,2500): + sql += "float_%d float, " % (i + 1) + for i in range(2500,3000): + sql += "bool_%d bool, " % (i + 1) + for i in range(3000,3500): + sql += "bigint_%d bigint, " % (i + 1) + for i in range(3500,3800): + sql += "nchar_%d nchar(4), " % (i + 1) + for i in range(3800,4090): + sql += "binary_%d binary(10), " % (i + 1) + for i in range(4090,4092): + sql += "timestamp_%d timestamp, " % (i + 1) + sql += " col4093 binary(22)) " + sql += " tags (loc nchar(20),tag_1 int) " + tdLog.info(len(sql)) + tdSql.execute(sql) + + sql = " create table table_4096_1 using stable_4096_1 tags ('table_4096_1',1); " + tdSql.execute(sql) + + for i in range(self.num4096): + sql = "insert into table_4096_1 values(%d, " + for j in range(4090): + str = "'%s', " % 'NULL' + sql += str + for j in range(4090,4092): + str = "%s, " % (self.ts + j) + sql += str + sql += "'%s')" % (self.ts + i) + tdSql.execute(sql % (self.ts + i)) + tdSql.query('''select * from table_4096_1 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4094) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + tdSql.query('''select * from stable_4096_1 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + + sql = '''insert into table_4096_1 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-10 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-10 20:26:44.090','1500000000000');''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_1 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + tdSql.query("select * from stable_4096_1 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + + # minrows 10 maxrows 200 + for i in range(self.num): + tdSql.execute('''insert into regular_table_1 values(%d, %d, %d, %d, %d, 0, 'binary.%s', 'nchar.%s', %f, %f, %d)''' + % (self.ts -100 + i, i, i, i, i, i, i, i, i, self.ts -100 + i)) + tdSql.execute('''insert into regular_table_1 values(%d, %d, %d, %d, %d, false, 'binary%s', 'nchar%s', %f, %f, %d)''' + % (self.ts + i, random.randint(-2147483647, 2147483647), + random.randint(-9223372036854775807, 9223372036854775807), random.randint(-32767, 32767), + random.randint(-127, 127), random.randint(-100, 100), random.randint(-10000, 10000), + random.uniform(-100000,100000), random.uniform(-1000000000,1000000000), self.ts + i)) + + tdSql.execute('''insert into table_1 values(%d, %d, %d, %d, %d, 0, 'binary.%s', 'nchar.%s', %f, %f, %d)''' + % (self.ts -100 + i, i, i, i, i, i, i, i, i, self.ts -100 + i)) + tdSql.execute('''insert into table_1 values(%d, %d, %d, %d, %d, false, 'binary%s', 'nchar%s', %f, %f, %d)''' + % (self.ts + i, random.randint(-2147483647, 2147483647), + random.randint(-9223372036854775807, 9223372036854775807), random.randint(-32767, 32767), + random.randint(-127, 127), random.randint(-100, 100), random.randint(-10000, 10000), + random.uniform(-100000,100000), random.uniform(-1000000000,1000000000), self.ts + i)) + + tdLog.info("========== regular_table ==========") + tdSql.execute('''insert into regular_table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 200)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into regular_table_1 values( %d , 0, 0, 0, 0, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 200)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.error('''insert into regular_table_1 values( %d , -2147483648, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_1 values( %d , -2147483647, -9223372036854775808, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_1 values( %d , -2147483647, -9223372036854775807, -32768, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_1 values( %d , -2147483647, -9223372036854775807, -32767, -128, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_1 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0123', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_1 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + + tdSql.execute('''insert into regular_table_1 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-012', 'nchar-0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.error('''insert into regular_table_1 values( %d , 2147483648, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_1 values( %d , 2147483647, 9223372036854775808, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_1 values( %d , 2147483647, 9223372036854775807, 32768, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_1 values( %d , 2147483647, 9223372036854775807, 32767, 128, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_1 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0123', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_1 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + + tdSql.execute('''insert into regular_table_1 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+012', 'nchar+0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdLog.info("========== stable ==========") + tdSql.execute('''insert into table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 200)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into table_1 values( %d , 0, 0, 0, 0, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 200)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.error('''insert into table_1 values( %d , -2147483648, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_1 values( %d , -2147483647, -9223372036854775808, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_1 values( %d , -2147483647, -9223372036854775807, -32768, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_1 values( %d , -2147483647, -9223372036854775807, -32767, -128, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_1 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0123', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_1 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + + tdSql.execute('''insert into table_1 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-012', 'nchar-0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.error('''insert into table_1 values( %d , 2147483648, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_1 values( %d , 2147483647, 9223372036854775808, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_1 values( %d , 2147483647, 9223372036854775807, 32768, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_1 values( %d , 2147483647, 9223372036854775807, 32767, 128, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_1 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0123', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_1 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + + tdSql.execute('''insert into table_1 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+012', 'nchar+0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdLog.info("========== 4096 regular_table ==========") + sql = '''insert into regular_table_4096_1 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-13 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-13 20:26:44.090','1600000000000');''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_1 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4095,'1600000000000') + + sql = '''insert into regular_table_4096_1 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-10 20:26:40.000' , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL);''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_1 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4095,'1500000000000') + + tdLog.info("========== 4096 stable ==========") + sql = '''insert into table_4096_1 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-13 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-13 20:26:44.090','1600000000000');''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_1 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + tdSql.query("select * from stable_4096_1 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + + sql = '''insert into table_4096_1 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-10 20:26:40.000' , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL);''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_1 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + tdSql.query("select * from stable_4096_1 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + + + tdLog.info("========== test1.2 : insert data , taosdemo force data dropping disk , check data==========") + tdLog.info("========== regular_table ==========") + tdSql.execute('''insert into regular_table_2 values( %d , 0, 0, 0, 0, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 200)) + sql = '''select * from regular_table_2 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into regular_table_2 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 200)) + sql = '''select * from regular_table_2 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into regular_table_2 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 500)) + sql = '''select * from regular_table_2 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into regular_table_2 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 500)) + sql = '''select * from regular_table_2 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + + tdLog.info("========== stable ==========") + tdSql.execute('''insert into table_2 values( %d , 0, 0, 0, 0, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 200)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into table_2 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 200)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into table_2 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 500)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into table_2 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 500)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + + tdLog.info("========== 4096 regular_table ==========") + sql = "create table regular_table_4096_2 (ts timestamp, " + for i in range(500): + sql += "int_%d int, " % (i + 1) + for i in range(500,1000): + sql += "smallint_%d smallint, " % (i + 1) + for i in range(1000,1500): + sql += "tinyint_%d tinyint, " % (i + 1) + for i in range(1500,2000): + sql += "double_%d double, " % (i + 1) + for i in range(2000,2500): + sql += "float_%d float, " % (i + 1) + for i in range(2500,3000): + sql += "bool_%d bool, " % (i + 1) + for i in range(3000,3500): + sql += "bigint_%d bigint, " % (i + 1) + for i in range(3500,3800): + sql += "nchar_%d nchar(4), " % (i + 1) + for i in range(3800,4090): + sql += "binary_%d binary(10), " % (i + 1) + for i in range(4090,4094): + sql += "timestamp_%d timestamp, " % (i + 1) + sql += "col4095 binary(22))" + tdLog.info(len(sql)) + tdSql.execute(sql) + + for i in range(self.num4096): + sql = "insert into regular_table_4096_2 values(%d, " + for j in range(4090): + str = "'%s', " % 'NULL' + sql += str + for j in range(4090,4094): + str = "%s, " % (self.ts + j) + sql += str + sql += "'%s')" % (self.ts + i) + tdSql.execute(sql % (self.ts + i)) + tdSql.query('''select * from regular_table_4096_2 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4095,'1600000000000') + + sql = '''insert into regular_table_4096_2 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-10 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-10 20:26:44.090','1500000000000');''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_2 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4095,'1500000000000') + + tdLog.info("========== 4096 stable ==========") + sql = "create stable stable_4096_2 (ts timestamp, " + for i in range(500): + sql += "int_%d int, " % (i + 1) + for i in range(500,1000): + sql += "smallint_%d smallint, " % (i + 1) + for i in range(1000,1500): + sql += "tinyint_%d tinyint, " % (i + 1) + for i in range(1500,2000): + sql += "double_%d double, " % (i + 1) + for i in range(2000,2500): + sql += "float_%d float, " % (i + 1) + for i in range(2500,3000): + sql += "bool_%d bool, " % (i + 1) + for i in range(3000,3500): + sql += "bigint_%d bigint, " % (i + 1) + for i in range(3500,3800): + sql += "nchar_%d nchar(4), " % (i + 1) + for i in range(3800,4090): + sql += "binary_%d binary(10), " % (i + 1) + for i in range(4090,4092): + sql += "timestamp_%d timestamp, " % (i + 1) + sql += " col4093 binary(22)) " + sql += " tags (loc nchar(20),tag_1 int) " + tdLog.info(len(sql)) + tdSql.execute(sql) + + sql = " create table table_4096_2 using stable_4096_2 tags ('table_4096_2',1); " + tdSql.execute(sql) + + for i in range(self.num4096): + sql = "insert into table_4096_2 values(%d, " + for j in range(4090): + str = "'%s', " % 'NULL' + sql += str + for j in range(4090,4092): + str = "%s, " % (self.ts + j) + sql += str + sql += "'%s')" % (self.ts + i) + tdSql.execute(sql % (self.ts + i)) + tdSql.query('''select * from table_4096_2 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4094) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + tdSql.query('''select * from stable_4096_2 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + + sql = '''insert into table_4096_2 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-10 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-10 20:26:44.090','1500000000000');''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_2 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + tdSql.query("select * from stable_4096_2 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + + + # taosdemo force data dropping disk + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + binPath = buildPath+ "/build/bin/" + os.system("%staosdemo -N -d taosdemo -t 100 -n 100 -l 1000 -y" % binPath) + + tdSql.execute('''insert into table_2 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 200)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into table_2 values( %d , 0, 0, 0, 0, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 200)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.error('''insert into table_2 values( %d , -2147483648, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_2 values( %d , -2147483647, -9223372036854775808, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_2 values( %d , -2147483647, -9223372036854775807, -32768, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_2 values( %d , -2147483647, -9223372036854775807, -32767, -128, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_2 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0123', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_2 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + + tdSql.execute('''insert into table_2 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-012', 'nchar-0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.error('''insert into table_2 values( %d , 2147483648, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_2 values( %d , 2147483647, 9223372036854775808, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_2 values( %d , 2147483647, 9223372036854775807, 32768, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_2 values( %d , 2147483647, 9223372036854775807, 32767, 128, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_2 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0123', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_2 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + + tdSql.execute('''insert into table_2 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+012', 'nchar+0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdLog.info("========== 4096 regular_table ==========") + sql = '''insert into regular_table_4096_2 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-13 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-13 20:26:44.090','1600000000000');''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_2 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4095,'1600000000000') + + sql = '''insert into regular_table_4096_2 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-10 20:26:40.000' , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL);''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_2 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4095,'1500000000000') + + tdLog.info("========== 4096 stable ==========") + sql = '''insert into table_4096_2 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-13 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-13 20:26:44.090','1600000000000');''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_2 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + tdSql.query("select * from stable_4096_2 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + + sql = '''insert into table_4096_2 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-10 20:26:40.000' , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL);''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_2 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + tdSql.query("select * from stable_4096_2 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + + tdLog.info("========== test1.3 : insert data , tdDnodes restart force data dropping disk , check data==========") + tdLog.info("========== regular_table ==========") + tdSql.execute('''insert into regular_table_3 values( %d , 0, 0, 0, 0, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 200)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into regular_table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 200)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into regular_table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 500)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into regular_table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 500)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdLog.info("========== stable ==========") + tdSql.execute('''insert into table_3 values( %d , 0, 0, 0, 0, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 200)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 200)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 500)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 500)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + + tdLog.info("========== 4096 regular_table ==========") + sql = "create table regular_table_4096_3 (ts timestamp, " + for i in range(500): + sql += "int_%d int, " % (i + 1) + for i in range(500,1000): + sql += "smallint_%d smallint, " % (i + 1) + for i in range(1000,1500): + sql += "tinyint_%d tinyint, " % (i + 1) + for i in range(1500,2000): + sql += "double_%d double, " % (i + 1) + for i in range(2000,2500): + sql += "float_%d float, " % (i + 1) + for i in range(2500,3000): + sql += "bool_%d bool, " % (i + 1) + for i in range(3000,3500): + sql += "bigint_%d bigint, " % (i + 1) + for i in range(3500,3800): + sql += "nchar_%d nchar(4), " % (i + 1) + for i in range(3800,4090): + sql += "binary_%d binary(10), " % (i + 1) + for i in range(4090,4094): + sql += "timestamp_%d timestamp, " % (i + 1) + sql += "col4095 binary(22))" + tdLog.info(len(sql)) + tdSql.execute(sql) + + for i in range(self.num4096): + sql = "insert into regular_table_4096_3 values(%d, " + for j in range(4090): + str = "'%s', " % 'NULL' + sql += str + for j in range(4090,4094): + str = "%s, " % (self.ts + j) + sql += str + sql += "'%s')" % (self.ts + i) + tdSql.execute(sql % (self.ts + i)) + tdSql.query('''select * from regular_table_4096_3 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4095,'1600000000000') + + sql = '''insert into regular_table_4096_3 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-10 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-10 20:26:44.090','1500000000000');''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_3 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4095,'1500000000000') + + tdLog.info("========== 4096 stable ==========") + sql = "create stable stable_4096_3 (ts timestamp, " + for i in range(500): + sql += "int_%d int, " % (i + 1) + for i in range(500,1000): + sql += "smallint_%d smallint, " % (i + 1) + for i in range(1000,1500): + sql += "tinyint_%d tinyint, " % (i + 1) + for i in range(1500,2000): + sql += "double_%d double, " % (i + 1) + for i in range(2000,2500): + sql += "float_%d float, " % (i + 1) + for i in range(2500,3000): + sql += "bool_%d bool, " % (i + 1) + for i in range(3000,3500): + sql += "bigint_%d bigint, " % (i + 1) + for i in range(3500,3800): + sql += "nchar_%d nchar(4), " % (i + 1) + for i in range(3800,4090): + sql += "binary_%d binary(10), " % (i + 1) + for i in range(4090,4092): + sql += "timestamp_%d timestamp, " % (i + 1) + sql += " col4093 binary(22)) " + sql += " tags (loc nchar(20),tag_1 int) " + tdLog.info(len(sql)) + tdSql.execute(sql) + + sql = " create table table_4096_3 using stable_4096_3 tags ('table_4096_3',1); " + tdSql.execute(sql) + + for i in range(self.num4096): + sql = "insert into table_4096_3 values(%d, " + for j in range(4090): + str = "'%s', " % 'NULL' + sql += str + for j in range(4090,4092): + str = "%s, " % (self.ts + j) + sql += str + sql += "'%s')" % (self.ts + i) + tdSql.execute(sql % (self.ts + i)) + tdSql.query('''select * from table_4096_3 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4094) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + tdSql.query('''select * from stable_4096_3 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + + sql = '''insert into table_4096_3 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-10 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-10 20:26:44.090','1500000000000');''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_3 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + tdSql.query("select * from stable_4096_3 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + + # tdDnodes restart force data dropping disk + tdDnodes.stop(1) + tdDnodes.start(1) + + tdLog.info("========== regular_table ==========") + tdSql.execute('''insert into regular_table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 200)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into regular_table_3 values( %d , 0, 0, 0, 0, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 200)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.error('''insert into regular_table_3 values( %d , -2147483648, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_3 values( %d , -2147483647, -9223372036854775808, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_3 values( %d , -2147483647, -9223372036854775807, -32768, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_3 values( %d , -2147483647, -9223372036854775807, -32767, -128, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_3 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0123', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_3 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + + tdSql.execute('''insert into regular_table_3 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-012', 'nchar-0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.error('''insert into regular_table_3 values( %d , 2147483648, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_3 values( %d , 2147483647, 9223372036854775808, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_3 values( %d , 2147483647, 9223372036854775807, 32768, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_3 values( %d , 2147483647, 9223372036854775807, 32767, 128, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_3 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0123', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_3 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + + tdSql.execute('''insert into regular_table_3 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+012', 'nchar+0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdLog.info("========== stable ==========") + tdSql.execute('''insert into table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 200)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into table_3 values( %d , 0, 0, 0, 0, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 200)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.error('''insert into table_3 values( %d , -2147483648, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_3 values( %d , -2147483647, -9223372036854775808, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_3 values( %d , -2147483647, -9223372036854775807, -32768, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_3 values( %d , -2147483647, -9223372036854775807, -32767, -128, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_3 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0123', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_3 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + + tdSql.execute('''insert into table_3 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-012', 'nchar-0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.error('''insert into table_3 values( %d , 2147483648, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_3 values( %d , 2147483647, 9223372036854775808, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_3 values( %d , 2147483647, 9223372036854775807, 32768, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_3 values( %d , 2147483647, 9223372036854775807, 32767, 128, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_3 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0123', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_3 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + + tdSql.execute('''insert into table_3 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+012', 'nchar+0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + + tdLog.info("========== 4096 regular_table ==========") + sql = '''insert into regular_table_4096_3 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-13 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-13 20:26:44.090','1600000000000');''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_3 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4095,'1600000000000') + + sql = '''insert into regular_table_4096_3 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-10 20:26:40.000' , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL);''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_3 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4095,'1500000000000') + + tdLog.info("========== 4096 stable ==========") + sql = '''insert into table_4096_3 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-13 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-13 20:26:44.090','1600000000000');''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_3 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + tdSql.query("select * from stable_4096_3 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + + sql = '''insert into table_4096_3 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-10 20:26:40.000' , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL);''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_3 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + tdSql.query("select * from stable_4096_3 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + + endTime = time.time() + print("total time %ds" % (endTime - startTime)) + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/pytest/import_merge/import_update_1.py b/tests/pytest/import_merge/import_update_1.py new file mode 100644 index 0000000000000000000000000000000000000000..f3137033420f831eec25f75039beeefbf2803537 --- /dev/null +++ b/tests/pytest/import_merge/import_update_1.py @@ -0,0 +1,1913 @@ +################################################################### +# 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 -*- + +import sys +import taos +from util.log import tdLog +from util.cases import tdCases +from util.sql import tdSql +from util.dnodes import * +import random +import time + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + self.ts = 1600000000000 + self.num = 50 + self.num4096 = 5 + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + def run(self): + tdSql.prepare() + # test case for https://jira.taosdata.com:18080/browse/TD-5062 + + startTime = time.time() + + tdSql.execute('''drop database if exists test_updata_1 ;''') + # update 0 不更新 ; update 1 覆盖更新 ;update 2 合并更新 + tdLog.info("========== test database updata = 1 ==========") + tdSql.execute('''create database test_updata_1 update 1 minrows 10 maxrows 200 ;''') + tdSql.execute('''use test_updata_1;''') + tdSql.execute('''create stable stable_1 + (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint, + q_bool bool , q_binary binary(10) , q_nchar nchar(10) , q_float float , q_double double , q_ts timestamp) + tags(loc nchar(20) , t_int int);''') + tdSql.execute('''create table table_1 using stable_1 tags('table_1' , '1' )''') + tdSql.execute('''create table table_2 using stable_1 tags('table_2' , '2' )''') + tdSql.execute('''create table table_3 using stable_1 tags('table_3' , '3' )''') + + #regular table + tdSql.execute('''create table regular_table_1 + (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint, + q_bool bool , q_binary binary(10) , q_nchar nchar(10) , q_float float , q_double double , q_ts timestamp) ;''') + tdSql.execute('''create table regular_table_2 + (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint, + q_bool bool , q_binary binary(10) , q_nchar nchar(10) , q_float float , q_double double , q_ts timestamp) ;''') + tdSql.execute('''create table regular_table_3 + (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint, + q_bool bool , q_binary binary(10) , q_nchar nchar(10) , q_float float , q_double double , q_ts timestamp) ;''') + + + tdLog.info("========== test1.1 : insert data , check data==========") + tdLog.info("========== regular_table ==========") + tdSql.execute('''insert into regular_table_1 values( %d , 0, 0, 0, 0, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 200)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into regular_table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 200)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into regular_table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 500)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into regular_table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 500)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdLog.info("========== stable ==========") + tdSql.execute('''insert into table_1 values( %d , 0, 0, 0, 0, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 200)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 200)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 500)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 500)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + + tdLog.info("========== 4096 regular_table ==========") + sql = "create table regular_table_4096_1 (ts timestamp, " + for i in range(500): + sql += "int_%d int, " % (i + 1) + for i in range(500,1000): + sql += "smallint_%d smallint, " % (i + 1) + for i in range(1000,1500): + sql += "tinyint_%d tinyint, " % (i + 1) + for i in range(1500,2000): + sql += "double_%d double, " % (i + 1) + for i in range(2000,2500): + sql += "float_%d float, " % (i + 1) + for i in range(2500,3000): + sql += "bool_%d bool, " % (i + 1) + for i in range(3000,3500): + sql += "bigint_%d bigint, " % (i + 1) + for i in range(3500,3800): + sql += "nchar_%d nchar(4), " % (i + 1) + for i in range(3800,4090): + sql += "binary_%d binary(10), " % (i + 1) + for i in range(4090,4094): + sql += "timestamp_%d timestamp, " % (i + 1) + sql += "col4095 binary(22))" + tdLog.info(len(sql)) + tdSql.execute(sql) + + for i in range(self.num4096): + sql = "insert into regular_table_4096_1 values(%d, " + for j in range(4090): + str = "'%s', " % 'NULL' + sql += str + for j in range(4090,4094): + str = "%s, " % (self.ts + j) + sql += str + sql += "'%s')" % (self.ts + i) + tdSql.execute(sql % (self.ts + i)) + tdSql.query('''select * from regular_table_4096_1 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4095,'1600000000000') + + sql = '''insert into regular_table_4096_1 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-10 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-10 20:26:44.090','1500000000000');''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_1 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4095,'1500000000000') + + tdLog.info("========== 4096 stable ==========") + sql = "create stable stable_4096_1 (ts timestamp, " + for i in range(500): + sql += "int_%d int, " % (i + 1) + for i in range(500,1000): + sql += "smallint_%d smallint, " % (i + 1) + for i in range(1000,1500): + sql += "tinyint_%d tinyint, " % (i + 1) + for i in range(1500,2000): + sql += "double_%d double, " % (i + 1) + for i in range(2000,2500): + sql += "float_%d float, " % (i + 1) + for i in range(2500,3000): + sql += "bool_%d bool, " % (i + 1) + for i in range(3000,3500): + sql += "bigint_%d bigint, " % (i + 1) + for i in range(3500,3800): + sql += "nchar_%d nchar(4), " % (i + 1) + for i in range(3800,4090): + sql += "binary_%d binary(10), " % (i + 1) + for i in range(4090,4092): + sql += "timestamp_%d timestamp, " % (i + 1) + sql += " col4093 binary(22)) " + sql += " tags (loc nchar(20),tag_1 int) " + tdLog.info(len(sql)) + tdSql.execute(sql) + + sql = " create table table_4096_1 using stable_4096_1 tags ('table_4096_1',1); " + tdSql.execute(sql) + + for i in range(self.num4096): + sql = "insert into table_4096_1 values(%d, " + for j in range(4090): + str = "'%s', " % 'NULL' + sql += str + for j in range(4090,4092): + str = "%s, " % (self.ts + j) + sql += str + sql += "'%s')" % (self.ts + i) + tdSql.execute(sql % (self.ts + i)) + tdSql.query('''select * from table_4096_1 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4094) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + tdSql.query('''select * from stable_4096_1 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + + sql = '''insert into table_4096_1 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-10 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-10 20:26:44.090','1500000000000');''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_1 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + tdSql.query("select * from stable_4096_1 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + + # minrows 10 maxrows 200 + for i in range(self.num): + tdSql.execute('''insert into regular_table_1 values(%d, %d, %d, %d, %d, 0, 'binary.%s', 'nchar.%s', %f, %f, %d)''' + % (self.ts -100 + i, i, i, i, i, i, i, i, i, self.ts -100 + i)) + tdSql.execute('''insert into regular_table_1 values(%d, %d, %d, %d, %d, false, 'binary%s', 'nchar%s', %f, %f, %d)''' + % (self.ts + i, random.randint(-2147483647, 2147483647), + random.randint(-9223372036854775807, 9223372036854775807), random.randint(-32767, 32767), + random.randint(-127, 127), random.randint(-100, 100), random.randint(-10000, 10000), + random.uniform(-100000,100000), random.uniform(-1000000000,1000000000), self.ts + i)) + + tdSql.execute('''insert into table_1 values(%d, %d, %d, %d, %d, 0, 'binary.%s', 'nchar.%s', %f, %f, %d)''' + % (self.ts -100 + i, i, i, i, i, i, i, i, i, self.ts -100 + i)) + tdSql.execute('''insert into table_1 values(%d, %d, %d, %d, %d, false, 'binary%s', 'nchar%s', %f, %f, %d)''' + % (self.ts + i, random.randint(-2147483647, 2147483647), + random.randint(-9223372036854775807, 9223372036854775807), random.randint(-32767, 32767), + random.randint(-127, 127), random.randint(-100, 100), random.randint(-10000, 10000), + random.uniform(-100000,100000), random.uniform(-1000000000,1000000000), self.ts + i)) + + tdLog.info("========== regular_table ==========") + tdSql.execute('''insert into regular_table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 200)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into regular_table_1 values( %d , 0, 0, 0, 0, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 200)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+0') + tdSql.checkData(0,7,'nchar+0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.error('''insert into regular_table_1 values( %d , -2147483648, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_1 values( %d , -2147483647, -9223372036854775808, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_1 values( %d , -2147483647, -9223372036854775807, -32768, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_1 values( %d , -2147483647, -9223372036854775807, -32767, -128, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_1 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0123', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_1 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + + tdSql.execute('''insert into regular_table_1 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-012', 'nchar-0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.error('''insert into regular_table_1 values( %d , 2147483648, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_1 values( %d , 2147483647, 9223372036854775808, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_1 values( %d , 2147483647, 9223372036854775807, 32768, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_1 values( %d , 2147483647, 9223372036854775807, 32767, 128, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_1 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0123', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_1 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + + tdSql.execute('''insert into regular_table_1 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+012', 'nchar+0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,2147483647) + tdSql.checkData(0,2,9223372036854775807) + tdSql.checkData(0,3,32767) + tdSql.checkData(0,4,127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+012') + tdSql.checkData(0,7,'nchar+0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdLog.info("========== stable ==========") + tdSql.execute('''insert into table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 200)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into table_1 values( %d , 0, 0, 0, 0, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 200)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+0') + tdSql.checkData(0,7,'nchar+0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+0') + tdSql.checkData(0,7,'nchar+0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.error('''insert into table_1 values( %d , -2147483648, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_1 values( %d , -2147483647, -9223372036854775808, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_1 values( %d , -2147483647, -9223372036854775807, -32768, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_1 values( %d , -2147483647, -9223372036854775807, -32767, -128, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_1 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0123', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_1 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + + tdSql.execute('''insert into table_1 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-012', 'nchar-0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.error('''insert into table_1 values( %d , 2147483648, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_1 values( %d , 2147483647, 9223372036854775808, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_1 values( %d , 2147483647, 9223372036854775807, 32768, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_1 values( %d , 2147483647, 9223372036854775807, 32767, 128, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_1 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0123', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_1 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + + tdSql.execute('''insert into table_1 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+012', 'nchar+0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,2147483647) + tdSql.checkData(0,2,9223372036854775807) + tdSql.checkData(0,3,32767) + tdSql.checkData(0,4,127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+012') + tdSql.checkData(0,7,'nchar+0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,2147483647) + tdSql.checkData(0,2,9223372036854775807) + tdSql.checkData(0,3,32767) + tdSql.checkData(0,4,127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+012') + tdSql.checkData(0,7,'nchar+0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdLog.info("========== 4096 regular_table ==========") + sql = '''insert into regular_table_4096_1 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-13 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-13 20:26:44.090','1600000000000');''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_1 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4095,'1600000000000') + + sql = '''insert into regular_table_4096_1 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-10 20:26:40.000' , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL);''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_1 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,None) + tdSql.checkData(0,3801,None) + tdSql.checkData(0,4091,None) + tdSql.checkData(0,4095,None) + + tdLog.info("========== 4096 stable ==========") + sql = '''insert into table_4096_1 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-13 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-13 20:26:44.090','1600000000000');''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_1 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + tdSql.query("select * from stable_4096_1 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + + sql = '''insert into table_4096_1 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-10 20:26:40.000' , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL);''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_1 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,None) + tdSql.checkData(0,3801,None) + tdSql.checkData(0,4091,None) + tdSql.checkData(0,4093,None) + tdSql.query("select * from stable_4096_1 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,None) + tdSql.checkData(0,3801,None) + tdSql.checkData(0,4091,None) + tdSql.checkData(0,4093,None) + + + tdLog.info("========== test1.2 : insert data , taosdemo force data dropping disk , check data==========") + tdLog.info("========== regular_table ==========") + tdSql.execute('''insert into regular_table_2 values( %d , 0, 0, 0, 0, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 200)) + sql = '''select * from regular_table_2 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into regular_table_2 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 200)) + sql = '''select * from regular_table_2 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into regular_table_2 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 500)) + sql = '''select * from regular_table_2 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into regular_table_2 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 500)) + sql = '''select * from regular_table_2 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + + tdLog.info("========== stable ==========") + tdSql.execute('''insert into table_2 values( %d , 0, 0, 0, 0, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 200)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into table_2 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 200)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into table_2 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 500)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into table_2 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 500)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + + tdLog.info("========== 4096 regular_table ==========") + sql = "create table regular_table_4096_2 (ts timestamp, " + for i in range(500): + sql += "int_%d int, " % (i + 1) + for i in range(500,1000): + sql += "smallint_%d smallint, " % (i + 1) + for i in range(1000,1500): + sql += "tinyint_%d tinyint, " % (i + 1) + for i in range(1500,2000): + sql += "double_%d double, " % (i + 1) + for i in range(2000,2500): + sql += "float_%d float, " % (i + 1) + for i in range(2500,3000): + sql += "bool_%d bool, " % (i + 1) + for i in range(3000,3500): + sql += "bigint_%d bigint, " % (i + 1) + for i in range(3500,3800): + sql += "nchar_%d nchar(4), " % (i + 1) + for i in range(3800,4090): + sql += "binary_%d binary(10), " % (i + 1) + for i in range(4090,4094): + sql += "timestamp_%d timestamp, " % (i + 1) + sql += "col4095 binary(22))" + tdLog.info(len(sql)) + tdSql.execute(sql) + + for i in range(self.num4096): + sql = "insert into regular_table_4096_2 values(%d, " + for j in range(4090): + str = "'%s', " % 'NULL' + sql += str + for j in range(4090,4094): + str = "%s, " % (self.ts + j) + sql += str + sql += "'%s')" % (self.ts + i) + tdSql.execute(sql % (self.ts + i)) + tdSql.query('''select * from regular_table_4096_2 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4095,'1600000000000') + + sql = '''insert into regular_table_4096_2 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-10 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-10 20:26:44.090','1500000000000');''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_2 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4095,'1500000000000') + + tdLog.info("========== 4096 stable ==========") + sql = "create stable stable_4096_2 (ts timestamp, " + for i in range(500): + sql += "int_%d int, " % (i + 1) + for i in range(500,1000): + sql += "smallint_%d smallint, " % (i + 1) + for i in range(1000,1500): + sql += "tinyint_%d tinyint, " % (i + 1) + for i in range(1500,2000): + sql += "double_%d double, " % (i + 1) + for i in range(2000,2500): + sql += "float_%d float, " % (i + 1) + for i in range(2500,3000): + sql += "bool_%d bool, " % (i + 1) + for i in range(3000,3500): + sql += "bigint_%d bigint, " % (i + 1) + for i in range(3500,3800): + sql += "nchar_%d nchar(4), " % (i + 1) + for i in range(3800,4090): + sql += "binary_%d binary(10), " % (i + 1) + for i in range(4090,4092): + sql += "timestamp_%d timestamp, " % (i + 1) + sql += " col4093 binary(22)) " + sql += " tags (loc nchar(20),tag_1 int) " + tdLog.info(len(sql)) + tdSql.execute(sql) + + sql = " create table table_4096_2 using stable_4096_2 tags ('table_4096_2',1); " + tdSql.execute(sql) + + for i in range(self.num4096): + sql = "insert into table_4096_2 values(%d, " + for j in range(4090): + str = "'%s', " % 'NULL' + sql += str + for j in range(4090,4092): + str = "%s, " % (self.ts + j) + sql += str + sql += "'%s')" % (self.ts + i) + tdSql.execute(sql % (self.ts + i)) + tdSql.query('''select * from table_4096_2 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4094) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + tdSql.query('''select * from stable_4096_2 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + + sql = '''insert into table_4096_2 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-10 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-10 20:26:44.090','1500000000000');''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_2 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + tdSql.query("select * from stable_4096_2 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + + + # taosdemo force data dropping disk + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + binPath = buildPath+ "/build/bin/" + os.system("%staosdemo -N -d taosdemo -t 100 -n 100 -l 1000 -y" % binPath) + + tdSql.execute('''insert into table_2 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 200)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into table_2 values( %d , 0, 0, 0, 0, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 200)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+0') + tdSql.checkData(0,7,'nchar+0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+0') + tdSql.checkData(0,7,'nchar+0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.error('''insert into table_2 values( %d , -2147483648, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_2 values( %d , -2147483647, -9223372036854775808, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_2 values( %d , -2147483647, -9223372036854775807, -32768, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_2 values( %d , -2147483647, -9223372036854775807, -32767, -128, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_2 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0123', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_2 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + + tdSql.execute('''insert into table_2 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-012', 'nchar-0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:44.090') + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:44.090') + + tdSql.error('''insert into table_2 values( %d , 2147483648, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_2 values( %d , 2147483647, 9223372036854775808, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_2 values( %d , 2147483647, 9223372036854775807, 32768, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_2 values( %d , 2147483647, 9223372036854775807, 32767, 128, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_2 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0123', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_2 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + + tdSql.execute('''insert into table_2 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+012', 'nchar+0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,2147483647) + tdSql.checkData(0,2,9223372036854775807) + tdSql.checkData(0,3,32767) + tdSql.checkData(0,4,127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+012') + tdSql.checkData(0,7,'nchar+0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:44.090') + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,2147483647) + tdSql.checkData(0,2,9223372036854775807) + tdSql.checkData(0,3,32767) + tdSql.checkData(0,4,127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+012') + tdSql.checkData(0,7,'nchar+0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:44.090') + + tdLog.info("========== 4096 regular_table ==========") + sql = '''insert into regular_table_4096_2 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-13 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-13 20:26:44.090','1600000000000');''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_2 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4095,'1600000000000') + + sql = '''insert into regular_table_4096_2 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-10 20:26:40.000' , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL);''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_2 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,None) + tdSql.checkData(0,3801,None) + tdSql.checkData(0,4091,None) + tdSql.checkData(0,4095,None) + + tdLog.info("========== 4096 stable ==========") + sql = '''insert into table_4096_2 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-13 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-13 20:26:44.090','1600000000000');''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_2 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + tdSql.query("select * from stable_4096_2 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + + sql = '''insert into table_4096_2 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-10 20:26:40.000' , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL);''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_2 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,None) + tdSql.checkData(0,3801,None) + tdSql.checkData(0,4091,None) + tdSql.checkData(0,4093,None) + tdSql.query("select * from stable_4096_2 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,None) + tdSql.checkData(0,3801,None) + tdSql.checkData(0,4091,None) + tdSql.checkData(0,4093,None) + + tdLog.info("========== test1.3 : insert data , tdDnodes restart force data dropping disk , check data==========") + tdLog.info("========== regular_table ==========") + tdSql.execute('''insert into regular_table_3 values( %d , 0, 0, 0, 0, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 200)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into regular_table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 200)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into regular_table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 500)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into regular_table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 500)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdLog.info("========== stable ==========") + tdSql.execute('''insert into table_3 values( %d , 0, 0, 0, 0, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 200)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 200)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 500)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 500)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + + tdLog.info("========== 4096 regular_table ==========") + sql = "create table regular_table_4096_3 (ts timestamp, " + for i in range(500): + sql += "int_%d int, " % (i + 1) + for i in range(500,1000): + sql += "smallint_%d smallint, " % (i + 1) + for i in range(1000,1500): + sql += "tinyint_%d tinyint, " % (i + 1) + for i in range(1500,2000): + sql += "double_%d double, " % (i + 1) + for i in range(2000,2500): + sql += "float_%d float, " % (i + 1) + for i in range(2500,3000): + sql += "bool_%d bool, " % (i + 1) + for i in range(3000,3500): + sql += "bigint_%d bigint, " % (i + 1) + for i in range(3500,3800): + sql += "nchar_%d nchar(4), " % (i + 1) + for i in range(3800,4090): + sql += "binary_%d binary(10), " % (i + 1) + for i in range(4090,4094): + sql += "timestamp_%d timestamp, " % (i + 1) + sql += "col4095 binary(22))" + tdLog.info(len(sql)) + tdSql.execute(sql) + + for i in range(self.num4096): + sql = "insert into regular_table_4096_3 values(%d, " + for j in range(4090): + str = "'%s', " % 'NULL' + sql += str + for j in range(4090,4094): + str = "%s, " % (self.ts + j) + sql += str + sql += "'%s')" % (self.ts + i) + tdSql.execute(sql % (self.ts + i)) + tdSql.query('''select * from regular_table_4096_3 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4095,'1600000000000') + + sql = '''insert into regular_table_4096_3 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-10 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-10 20:26:44.090','1500000000000');''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_3 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4095,'1500000000000') + + tdLog.info("========== 4096 stable ==========") + sql = "create stable stable_4096_3 (ts timestamp, " + for i in range(500): + sql += "int_%d int, " % (i + 1) + for i in range(500,1000): + sql += "smallint_%d smallint, " % (i + 1) + for i in range(1000,1500): + sql += "tinyint_%d tinyint, " % (i + 1) + for i in range(1500,2000): + sql += "double_%d double, " % (i + 1) + for i in range(2000,2500): + sql += "float_%d float, " % (i + 1) + for i in range(2500,3000): + sql += "bool_%d bool, " % (i + 1) + for i in range(3000,3500): + sql += "bigint_%d bigint, " % (i + 1) + for i in range(3500,3800): + sql += "nchar_%d nchar(4), " % (i + 1) + for i in range(3800,4090): + sql += "binary_%d binary(10), " % (i + 1) + for i in range(4090,4092): + sql += "timestamp_%d timestamp, " % (i + 1) + sql += " col4093 binary(22)) " + sql += " tags (loc nchar(20),tag_1 int) " + tdLog.info(len(sql)) + tdSql.execute(sql) + + sql = " create table table_4096_3 using stable_4096_3 tags ('table_4096_3',1); " + tdSql.execute(sql) + + for i in range(self.num4096): + sql = "insert into table_4096_3 values(%d, " + for j in range(4090): + str = "'%s', " % 'NULL' + sql += str + for j in range(4090,4092): + str = "%s, " % (self.ts + j) + sql += str + sql += "'%s')" % (self.ts + i) + tdSql.execute(sql % (self.ts + i)) + tdSql.query('''select * from table_4096_3 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4094) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + tdSql.query('''select * from stable_4096_3 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + + sql = '''insert into table_4096_3 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-10 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-10 20:26:44.090','1500000000000');''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_3 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + tdSql.query("select * from stable_4096_3 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + + # tdDnodes restart force data dropping disk + tdDnodes.stop(1) + tdDnodes.start(1) + + tdLog.info("========== regular_table ==========") + tdSql.execute('''insert into regular_table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 200)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into regular_table_3 values( %d , 0, 0, 0, 0, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 200)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+0') + tdSql.checkData(0,7,'nchar+0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.error('''insert into regular_table_3 values( %d , -2147483648, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_3 values( %d , -2147483647, -9223372036854775808, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_3 values( %d , -2147483647, -9223372036854775807, -32768, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_3 values( %d , -2147483647, -9223372036854775807, -32767, -128, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_3 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0123', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_3 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + + tdSql.execute('''insert into regular_table_3 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-012', 'nchar-0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:44.090') + + tdSql.error('''insert into regular_table_3 values( %d , 2147483648, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_3 values( %d , 2147483647, 9223372036854775808, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_3 values( %d , 2147483647, 9223372036854775807, 32768, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_3 values( %d , 2147483647, 9223372036854775807, 32767, 128, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_3 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0123', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_3 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + + tdSql.execute('''insert into regular_table_3 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+012', 'nchar+0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,2147483647) + tdSql.checkData(0,2,9223372036854775807) + tdSql.checkData(0,3,32767) + tdSql.checkData(0,4,127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+012') + tdSql.checkData(0,7,'nchar+0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:44.090') + + tdLog.info("========== stable ==========") + tdSql.execute('''insert into table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 200)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into table_3 values( %d , 0, 0, 0, 0, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 200)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+0') + tdSql.checkData(0,7,'nchar+0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+0') + tdSql.checkData(0,7,'nchar+0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.error('''insert into table_3 values( %d , -2147483648, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_3 values( %d , -2147483647, -9223372036854775808, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_3 values( %d , -2147483647, -9223372036854775807, -32768, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_3 values( %d , -2147483647, -9223372036854775807, -32767, -128, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_3 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0123', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_3 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + + tdSql.execute('''insert into table_3 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-012', 'nchar-0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:44.090') + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:44.090') + + tdSql.error('''insert into table_3 values( %d , 2147483648, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_3 values( %d , 2147483647, 9223372036854775808, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_3 values( %d , 2147483647, 9223372036854775807, 32768, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_3 values( %d , 2147483647, 9223372036854775807, 32767, 128, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_3 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0123', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_3 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + + tdSql.execute('''insert into table_3 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+012', 'nchar+0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,2147483647) + tdSql.checkData(0,2,9223372036854775807) + tdSql.checkData(0,3,32767) + tdSql.checkData(0,4,127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+012') + tdSql.checkData(0,7,'nchar+0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:44.090') + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,2147483647) + tdSql.checkData(0,2,9223372036854775807) + tdSql.checkData(0,3,32767) + tdSql.checkData(0,4,127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+012') + tdSql.checkData(0,7,'nchar+0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:44.090') + + + tdLog.info("========== 4096 regular_table ==========") + sql = '''insert into regular_table_4096_3 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-13 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-13 20:26:44.090','1600000000000');''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_3 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4095,'1600000000000') + + sql = '''insert into regular_table_4096_3 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-10 20:26:40.000' , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL);''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_3 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,None) + tdSql.checkData(0,3801,None) + tdSql.checkData(0,4091,None) + tdSql.checkData(0,4095,None) + + tdLog.info("========== 4096 stable ==========") + sql = '''insert into table_4096_3 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-13 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-13 20:26:44.090','1600000000000');''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_3 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + tdSql.query("select * from stable_4096_3 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + + sql = '''insert into table_4096_3 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-10 20:26:40.000' , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL);''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_3 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,None) + tdSql.checkData(0,3801,None) + tdSql.checkData(0,4091,None) + tdSql.checkData(0,4093,None) + tdSql.query("select * from stable_4096_3 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,None) + tdSql.checkData(0,3801,None) + tdSql.checkData(0,4091,None) + tdSql.checkData(0,4093,None) + + endTime = time.time() + print("total time %ds" % (endTime - startTime)) + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/pytest/import_merge/import_update_2.py b/tests/pytest/import_merge/import_update_2.py new file mode 100644 index 0000000000000000000000000000000000000000..ff2f8a5e5cf6acd93b53f131c4551a285feffb2d --- /dev/null +++ b/tests/pytest/import_merge/import_update_2.py @@ -0,0 +1,2273 @@ +################################################################### +# 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 -*- + +import sys +import taos +from util.log import tdLog +from util.cases import tdCases +from util.sql import tdSql +from util.dnodes import * +import random +import time + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + self.ts = 1600000000000 + self.num = 50 + self.num4096 = 5 + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + def run(self): + tdSql.prepare() + # test case for https://jira.taosdata.com:18080/browse/TD-5062 + + startTime = time.time() + + tdSql.execute('''drop database if exists test_updata_2 ;''') + # update 0 不更新 ; update 1 覆盖更新 ;update 2 合并更新 + tdLog.info("========== test database updata = 2 ==========") + tdSql.execute('''create database test_updata_2 update 2 minrows 10 maxrows 200 ;''') + tdSql.execute('''use test_updata_2;''') + tdSql.execute('''create stable stable_1 + (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint, + q_bool bool , q_binary binary(10) , q_nchar nchar(10) , q_float float , q_double double , q_ts timestamp) + tags(loc nchar(20) , t_int int);''') + tdSql.execute('''create table table_1 using stable_1 tags('table_1' , '1' )''') + tdSql.execute('''create table table_2 using stable_1 tags('table_2' , '2' )''') + tdSql.execute('''create table table_3 using stable_1 tags('table_3' , '3' )''') + + #regular table + tdSql.execute('''create table regular_table_1 + (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint, + q_bool bool , q_binary binary(10) , q_nchar nchar(10) , q_float float , q_double double , q_ts timestamp) ;''') + tdSql.execute('''create table regular_table_2 + (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint, + q_bool bool , q_binary binary(10) , q_nchar nchar(10) , q_float float , q_double double , q_ts timestamp) ;''') + tdSql.execute('''create table regular_table_3 + (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint, + q_bool bool , q_binary binary(10) , q_nchar nchar(10) , q_float float , q_double double , q_ts timestamp) ;''') + + + tdLog.info("========== test1.1 : insert data , check data==========") + tdLog.info("========== regular_table ==========") + tdSql.execute('''insert into regular_table_1 values( %d , 0, 0, 0, 0, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 200)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into regular_table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 200)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into regular_table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 500)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into regular_table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 500)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdLog.info("========== stable ==========") + tdSql.execute('''insert into table_1 values( %d , 0, 0, 0, 0, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 200)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 200)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 500)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 500)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + + tdLog.info("========== 4096 regular_table ==========") + sql = "create table regular_table_4096_1 (ts timestamp, " + for i in range(500): + sql += "int_%d int, " % (i + 1) + for i in range(500,1000): + sql += "smallint_%d smallint, " % (i + 1) + for i in range(1000,1500): + sql += "tinyint_%d tinyint, " % (i + 1) + for i in range(1500,2000): + sql += "double_%d double, " % (i + 1) + for i in range(2000,2500): + sql += "float_%d float, " % (i + 1) + for i in range(2500,3000): + sql += "bool_%d bool, " % (i + 1) + for i in range(3000,3500): + sql += "bigint_%d bigint, " % (i + 1) + for i in range(3500,3800): + sql += "nchar_%d nchar(4), " % (i + 1) + for i in range(3800,4090): + sql += "binary_%d binary(10), " % (i + 1) + for i in range(4090,4094): + sql += "timestamp_%d timestamp, " % (i + 1) + sql += "col4095 binary(22))" + tdLog.info(len(sql)) + tdSql.execute(sql) + + for i in range(self.num4096): + sql = "insert into regular_table_4096_1 values(%d, " + for j in range(4090): + str = "'%s', " % 'NULL' + sql += str + for j in range(4090,4094): + str = "%s, " % (self.ts + j) + sql += str + sql += "'%s')" % (self.ts + i) + tdSql.execute(sql % (self.ts + i)) + tdSql.query('''select * from regular_table_4096_1 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4095,'1600000000000') + + sql = '''insert into regular_table_4096_1 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-10 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-10 20:26:44.090','1500000000000');''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_1 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4095,'1500000000000') + + tdLog.info("========== 4096 stable ==========") + sql = "create stable stable_4096_1 (ts timestamp, " + for i in range(500): + sql += "int_%d int, " % (i + 1) + for i in range(500,1000): + sql += "smallint_%d smallint, " % (i + 1) + for i in range(1000,1500): + sql += "tinyint_%d tinyint, " % (i + 1) + for i in range(1500,2000): + sql += "double_%d double, " % (i + 1) + for i in range(2000,2500): + sql += "float_%d float, " % (i + 1) + for i in range(2500,3000): + sql += "bool_%d bool, " % (i + 1) + for i in range(3000,3500): + sql += "bigint_%d bigint, " % (i + 1) + for i in range(3500,3800): + sql += "nchar_%d nchar(4), " % (i + 1) + for i in range(3800,4090): + sql += "binary_%d binary(10), " % (i + 1) + for i in range(4090,4092): + sql += "timestamp_%d timestamp, " % (i + 1) + sql += " col4093 binary(22)) " + sql += " tags (loc nchar(20),tag_1 int) " + tdLog.info(len(sql)) + tdSql.execute(sql) + + sql = " create table table_4096_1 using stable_4096_1 tags ('table_4096_1',1); " + tdSql.execute(sql) + + for i in range(self.num4096): + sql = "insert into table_4096_1 values(%d, " + for j in range(4090): + str = "'%s', " % 'NULL' + sql += str + for j in range(4090,4092): + str = "%s, " % (self.ts + j) + sql += str + sql += "'%s')" % (self.ts + i) + tdSql.execute(sql % (self.ts + i)) + tdSql.query('''select * from table_4096_1 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4094) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + tdSql.query('''select * from stable_4096_1 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + + sql = '''insert into table_4096_1 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-10 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-10 20:26:44.090','1500000000000');''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_1 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + tdSql.query("select * from stable_4096_1 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + + # minrows 10 maxrows 200 + for i in range(self.num): + tdSql.execute('''insert into regular_table_1 values(%d, %d, %d, %d, %d, 0, 'binary.%s', 'nchar.%s', %f, %f, %d)''' + % (self.ts -100 + i, i, i, i, i, i, i, i, i, self.ts -100 + i)) + tdSql.execute('''insert into regular_table_1 values(%d, %d, %d, %d, %d, false, 'binary%s', 'nchar%s', %f, %f, %d)''' + % (self.ts + i, random.randint(-2147483647, 2147483647), + random.randint(-9223372036854775807, 9223372036854775807), random.randint(-32767, 32767), + random.randint(-127, 127), random.randint(-100, 100), random.randint(-10000, 10000), + random.uniform(-100000,100000), random.uniform(-1000000000,1000000000), self.ts + i)) + + tdSql.execute('''insert into table_1 values(%d, %d, %d, %d, %d, 0, 'binary.%s', 'nchar.%s', %f, %f, %d)''' + % (self.ts -100 + i, i, i, i, i, i, i, i, i, self.ts -100 + i)) + tdSql.execute('''insert into table_1 values(%d, %d, %d, %d, %d, false, 'binary%s', 'nchar%s', %f, %f, %d)''' + % (self.ts + i, random.randint(-2147483647, 2147483647), + random.randint(-9223372036854775807, 9223372036854775807), random.randint(-32767, 32767), + random.randint(-127, 127), random.randint(-100, 100), random.randint(-10000, 10000), + random.uniform(-100000,100000), random.uniform(-1000000000,1000000000), self.ts + i)) + + tdLog.info("========== regular_table ==========") + tdSql.execute('''insert into regular_table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 200)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into regular_table_1 values( %d , 0, 0, 0, 0, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 200)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+0') + tdSql.checkData(0,7,'nchar+0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + tdSql.execute('''insert into regular_table_1 values( %d , 1, 1, 1, 1, 1, 'binary+1', 'nchar+1', 1.000000, 1.000000, 1600000001000);''' %(self.ts + 200)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,1) + tdSql.checkData(0,2,1) + tdSql.checkData(0,3,1) + tdSql.checkData(0,4,1) + tdSql.checkData(0,5,'True') + tdSql.checkData(0,6,'binary+1') + tdSql.checkData(0,7,'nchar+1') + tdSql.checkData(0,8,1) + tdSql.checkData(0,9,1) + tdSql.checkData(0,10,'2020-09-13 20:26:41.000') + + tdSql.error('''insert into regular_table_1 values( %d , -2147483648, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_1 values( %d , -2147483647, -9223372036854775808, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_1 values( %d , -2147483647, -9223372036854775807, -32768, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_1 values( %d , -2147483647, -9223372036854775807, -32767, -128, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_1 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0123', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_1 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + + tdSql.execute('''insert into regular_table_1 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-012', 'nchar-0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.error('''insert into regular_table_1 values( %d , 2147483648, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_1 values( %d , 2147483647, 9223372036854775808, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_1 values( %d , 2147483647, 9223372036854775807, 32768, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_1 values( %d , 2147483647, 9223372036854775807, 32767, 128, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_1 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0123', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_1 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + + tdSql.execute('''insert into regular_table_1 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+012', 'nchar+0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,2147483647) + tdSql.checkData(0,2,9223372036854775807) + tdSql.checkData(0,3,32767) + tdSql.checkData(0,4,127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+012') + tdSql.checkData(0,7,'nchar+0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + tdSql.execute('''insert into regular_table_1 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-012', 'nchar-0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + sql = '''select * from regular_table_1 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdLog.info("========== stable ==========") + tdSql.execute('''insert into table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 200)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into table_1 values( %d , 0, 0, 0, 0, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 200)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+0') + tdSql.checkData(0,7,'nchar+0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+0') + tdSql.checkData(0,7,'nchar+0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into table_1 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 200)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+0') + tdSql.checkData(0,7,'nchar+0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+0') + tdSql.checkData(0,7,'nchar+0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.error('''insert into table_1 values( %d , -2147483648, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_1 values( %d , -2147483647, -9223372036854775808, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_1 values( %d , -2147483647, -9223372036854775807, -32768, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_1 values( %d , -2147483647, -9223372036854775807, -32767, -128, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_1 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0123', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_1 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + + tdSql.execute('''insert into table_1 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-012', 'nchar-0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.error('''insert into table_1 values( %d , 2147483648, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_1 values( %d , 2147483647, 9223372036854775808, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_1 values( %d , 2147483647, 9223372036854775807, 32768, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_1 values( %d , 2147483647, 9223372036854775807, 32767, 128, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_1 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0123', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_1 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + + tdSql.execute('''insert into table_1 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+012', 'nchar+0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,2147483647) + tdSql.checkData(0,2,9223372036854775807) + tdSql.checkData(0,3,32767) + tdSql.checkData(0,4,127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+012') + tdSql.checkData(0,7,'nchar+0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,2147483647) + tdSql.checkData(0,2,9223372036854775807) + tdSql.checkData(0,3,32767) + tdSql.checkData(0,4,127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+012') + tdSql.checkData(0,7,'nchar+0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + tdSql.execute('''insert into table_1 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-012', 'nchar-0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdLog.info("========== 4096 regular_table ==========") + sql = '''insert into regular_table_4096_1 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-13 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-13 20:26:44.090','1600000000000');''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_1 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4095,'1600000000000') + + sql = '''insert into regular_table_4096_1 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-10 20:26:40.000' , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL);''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_1 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4095,'1500000000000') + + sql = '''insert into regular_table_4096_1 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-13 20:26:40.000' , 2 , 502 , 102 , 1502 , 2002 , 0 , 3002 , '3502' , '3802' ,'2020-09-13 20:26:44.092','1600000002000');''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_1 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,2) + tdSql.checkData(0,501,502) + tdSql.checkData(0,1001,102) + tdSql.checkData(0,1501,1502) + tdSql.checkData(0,2001,2002) + tdSql.checkData(0,2501,'False') + tdSql.checkData(0,3001,3002) + tdSql.checkData(0,3501,'3502') + tdSql.checkData(0,3801,'3802') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.092') + tdSql.checkData(0,4095,'1600000002000') + + tdLog.info("========== 4096 stable ==========") + sql = '''insert into table_4096_1 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-13 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-13 20:26:44.090','1600000000000');''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_1 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + tdSql.query("select * from stable_4096_1 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + + sql = '''insert into table_4096_1 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-10 20:26:40.000' , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL);''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_1 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + tdSql.query("select * from stable_4096_1 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + + sql = '''insert into table_4096_1 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-13 20:26:40.000' , 2 , 502 , 102 , 1502 , 2002 , 0 , 3002 , '3502' , '3802' ,'2020-09-13 20:26:44.092','1600000002000');''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_1 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,2) + tdSql.checkData(0,501,502) + tdSql.checkData(0,1001,102) + tdSql.checkData(0,1501,1502) + tdSql.checkData(0,2001,2002) + tdSql.checkData(0,2501,'False') + tdSql.checkData(0,3001,3002) + tdSql.checkData(0,3501,'3502') + tdSql.checkData(0,3801,'3802') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.092') + tdSql.checkData(0,4093,'1600000002000') + tdSql.query("select * from stable_4096_1 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,2) + tdSql.checkData(0,501,502) + tdSql.checkData(0,1001,102) + tdSql.checkData(0,1501,1502) + tdSql.checkData(0,2001,2002) + tdSql.checkData(0,2501,'False') + tdSql.checkData(0,3001,3002) + tdSql.checkData(0,3501,'3502') + tdSql.checkData(0,3801,'3802') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.092') + tdSql.checkData(0,4093,'1600000002000') + + + tdLog.info("========== test1.2 : insert data , taosdemo force data dropping disk , check data==========") + tdLog.info("========== regular_table ==========") + tdSql.execute('''insert into regular_table_2 values( %d , 0, 0, 0, 0, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 200)) + sql = '''select * from regular_table_2 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into regular_table_2 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 200)) + sql = '''select * from regular_table_2 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into regular_table_2 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 500)) + sql = '''select * from regular_table_2 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into regular_table_2 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 500)) + sql = '''select * from regular_table_2 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + + tdLog.info("========== stable ==========") + tdSql.execute('''insert into table_2 values( %d , 0, 0, 0, 0, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 200)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into table_2 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 200)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into table_2 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 500)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into table_2 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 500)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + + tdLog.info("========== 4096 regular_table ==========") + sql = "create table regular_table_4096_2 (ts timestamp, " + for i in range(500): + sql += "int_%d int, " % (i + 1) + for i in range(500,1000): + sql += "smallint_%d smallint, " % (i + 1) + for i in range(1000,1500): + sql += "tinyint_%d tinyint, " % (i + 1) + for i in range(1500,2000): + sql += "double_%d double, " % (i + 1) + for i in range(2000,2500): + sql += "float_%d float, " % (i + 1) + for i in range(2500,3000): + sql += "bool_%d bool, " % (i + 1) + for i in range(3000,3500): + sql += "bigint_%d bigint, " % (i + 1) + for i in range(3500,3800): + sql += "nchar_%d nchar(4), " % (i + 1) + for i in range(3800,4090): + sql += "binary_%d binary(10), " % (i + 1) + for i in range(4090,4094): + sql += "timestamp_%d timestamp, " % (i + 1) + sql += "col4095 binary(22))" + tdLog.info(len(sql)) + tdSql.execute(sql) + + for i in range(self.num4096): + sql = "insert into regular_table_4096_2 values(%d, " + for j in range(4090): + str = "'%s', " % 'NULL' + sql += str + for j in range(4090,4094): + str = "%s, " % (self.ts + j) + sql += str + sql += "'%s')" % (self.ts + i) + tdSql.execute(sql % (self.ts + i)) + tdSql.query('''select * from regular_table_4096_2 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4095,'1600000000000') + + sql = '''insert into regular_table_4096_2 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-10 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-10 20:26:44.090','1500000000000');''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_2 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4095,'1500000000000') + + tdLog.info("========== 4096 stable ==========") + sql = "create stable stable_4096_2 (ts timestamp, " + for i in range(500): + sql += "int_%d int, " % (i + 1) + for i in range(500,1000): + sql += "smallint_%d smallint, " % (i + 1) + for i in range(1000,1500): + sql += "tinyint_%d tinyint, " % (i + 1) + for i in range(1500,2000): + sql += "double_%d double, " % (i + 1) + for i in range(2000,2500): + sql += "float_%d float, " % (i + 1) + for i in range(2500,3000): + sql += "bool_%d bool, " % (i + 1) + for i in range(3000,3500): + sql += "bigint_%d bigint, " % (i + 1) + for i in range(3500,3800): + sql += "nchar_%d nchar(4), " % (i + 1) + for i in range(3800,4090): + sql += "binary_%d binary(10), " % (i + 1) + for i in range(4090,4092): + sql += "timestamp_%d timestamp, " % (i + 1) + sql += " col4093 binary(22)) " + sql += " tags (loc nchar(20),tag_1 int) " + tdLog.info(len(sql)) + tdSql.execute(sql) + + sql = " create table table_4096_2 using stable_4096_2 tags ('table_4096_2',1); " + tdSql.execute(sql) + + for i in range(self.num4096): + sql = "insert into table_4096_2 values(%d, " + for j in range(4090): + str = "'%s', " % 'NULL' + sql += str + for j in range(4090,4092): + str = "%s, " % (self.ts + j) + sql += str + sql += "'%s')" % (self.ts + i) + tdSql.execute(sql % (self.ts + i)) + tdSql.query('''select * from table_4096_2 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4094) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + tdSql.query('''select * from stable_4096_2 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + + sql = '''insert into table_4096_2 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-10 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-10 20:26:44.090','1500000000000');''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_2 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + tdSql.query("select * from stable_4096_2 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + + + # taosdemo force data dropping disk + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + binPath = buildPath+ "/build/bin/" + os.system("%staosdemo -N -d taosdemo -t 100 -n 100 -l 1000 -y" % binPath) + + tdLog.info("========== stable ==========") + tdSql.execute('''insert into table_2 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 200)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into table_2 values( %d , 0, 0, 0, 0, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 200)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+0') + tdSql.checkData(0,7,'nchar+0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+0') + tdSql.checkData(0,7,'nchar+0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into table_2 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 200)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+0') + tdSql.checkData(0,7,'nchar+0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+0') + tdSql.checkData(0,7,'nchar+0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + + tdSql.error('''insert into table_2 values( %d , -2147483648, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_2 values( %d , -2147483647, -9223372036854775808, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_2 values( %d , -2147483647, -9223372036854775807, -32768, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_2 values( %d , -2147483647, -9223372036854775807, -32767, -128, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_2 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0123', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_2 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + + tdSql.execute('''insert into table_2 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-012', 'nchar-0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:44.090') + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:44.090') + + tdSql.error('''insert into table_2 values( %d , 2147483648, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_2 values( %d , 2147483647, 9223372036854775808, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_2 values( %d , 2147483647, 9223372036854775807, 32768, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_2 values( %d , 2147483647, 9223372036854775807, 32767, 128, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_2 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0123', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_2 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + + tdSql.execute('''insert into table_2 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+012', 'nchar+0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + sql = '''select * from table_2 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,2147483647) + tdSql.checkData(0,2,9223372036854775807) + tdSql.checkData(0,3,32767) + tdSql.checkData(0,4,127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+012') + tdSql.checkData(0,7,'nchar+0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:44.090') + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,2147483647) + tdSql.checkData(0,2,9223372036854775807) + tdSql.checkData(0,3,32767) + tdSql.checkData(0,4,127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+012') + tdSql.checkData(0,7,'nchar+0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:44.090') + tdSql.execute('''insert into table_2 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-012', 'nchar-0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + sql = '''select * from table_1 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where loc = 'table_2' and ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + + tdLog.info("========== 4096 regular_table ==========") + sql = '''insert into regular_table_4096_2 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-13 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-13 20:26:44.090','1600000000000');''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_2 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4095,'1600000000000') + + sql = '''insert into regular_table_4096_2 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-10 20:26:40.000' , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL);''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_2 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4095,'1500000000000') + + sql = '''insert into regular_table_4096_2 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-13 20:26:40.000' , 2 , 502 , 102 , 1502 , 2002 , 0 , 3002 , '3502' , '3802' ,'2020-09-13 20:26:44.092','1600000002000');''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_2 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,2) + tdSql.checkData(0,501,502) + tdSql.checkData(0,1001,102) + tdSql.checkData(0,1501,1502) + tdSql.checkData(0,2001,2002) + tdSql.checkData(0,2501,'False') + tdSql.checkData(0,3001,3002) + tdSql.checkData(0,3501,'3502') + tdSql.checkData(0,3801,'3802') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.092') + tdSql.checkData(0,4095,'1600000002000') + + + tdLog.info("========== 4096 stable ==========") + sql = '''insert into table_4096_2 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-13 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-13 20:26:44.090','1600000000000');''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_2 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + tdSql.query("select * from stable_4096_2 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + + sql = '''insert into table_4096_2 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-10 20:26:40.000' , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL);''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_2 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + tdSql.query("select * from stable_4096_2 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + + sql = '''insert into table_4096_2 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-13 20:26:40.000' , 2 , 502 , 102 , 1502 , 2002 , 0 , 3002 , '3502' , '3802' ,'2020-09-13 20:26:44.092','1600000002000');''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_2 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,2) + tdSql.checkData(0,501,502) + tdSql.checkData(0,1001,102) + tdSql.checkData(0,1501,1502) + tdSql.checkData(0,2001,2002) + tdSql.checkData(0,2501,'False') + tdSql.checkData(0,3001,3002) + tdSql.checkData(0,3501,'3502') + tdSql.checkData(0,3801,'3802') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.092') + tdSql.checkData(0,4093,'1600000002000') + tdSql.query("select * from stable_4096_2 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,2) + tdSql.checkData(0,501,502) + tdSql.checkData(0,1001,102) + tdSql.checkData(0,1501,1502) + tdSql.checkData(0,2001,2002) + tdSql.checkData(0,2501,'False') + tdSql.checkData(0,3001,3002) + tdSql.checkData(0,3501,'3502') + tdSql.checkData(0,3801,'3802') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.092') + tdSql.checkData(0,4093,'1600000002000') + + + tdLog.info("========== test1.3 : insert data , tdDnodes restart force data dropping disk , check data==========") + tdLog.info("========== regular_table ==========") + tdSql.execute('''insert into regular_table_3 values( %d , 0, 0, 0, 0, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 200)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into regular_table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 200)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into regular_table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 500)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into regular_table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 500)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdLog.info("========== stable ==========") + tdSql.execute('''insert into table_3 values( %d , 0, 0, 0, 0, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 200)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 200)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 500)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + tdSql.execute('''insert into table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 500)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + tdSql.checkData(0,3,None) + tdSql.checkData(0,4,None) + tdSql.checkData(0,5,None) + tdSql.checkData(0,6,None) + tdSql.checkData(0,7,None) + tdSql.checkData(0,8,None) + tdSql.checkData(0,9,None) + tdSql.checkData(0,10,None) + + + tdLog.info("========== 4096 regular_table ==========") + sql = "create table regular_table_4096_3 (ts timestamp, " + for i in range(500): + sql += "int_%d int, " % (i + 1) + for i in range(500,1000): + sql += "smallint_%d smallint, " % (i + 1) + for i in range(1000,1500): + sql += "tinyint_%d tinyint, " % (i + 1) + for i in range(1500,2000): + sql += "double_%d double, " % (i + 1) + for i in range(2000,2500): + sql += "float_%d float, " % (i + 1) + for i in range(2500,3000): + sql += "bool_%d bool, " % (i + 1) + for i in range(3000,3500): + sql += "bigint_%d bigint, " % (i + 1) + for i in range(3500,3800): + sql += "nchar_%d nchar(4), " % (i + 1) + for i in range(3800,4090): + sql += "binary_%d binary(10), " % (i + 1) + for i in range(4090,4094): + sql += "timestamp_%d timestamp, " % (i + 1) + sql += "col4095 binary(22))" + tdLog.info(len(sql)) + tdSql.execute(sql) + + for i in range(self.num4096): + sql = "insert into regular_table_4096_3 values(%d, " + for j in range(4090): + str = "'%s', " % 'NULL' + sql += str + for j in range(4090,4094): + str = "%s, " % (self.ts + j) + sql += str + sql += "'%s')" % (self.ts + i) + tdSql.execute(sql % (self.ts + i)) + tdSql.query('''select * from regular_table_4096_3 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4095,'1600000000000') + + sql = '''insert into regular_table_4096_3 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-10 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-10 20:26:44.090','1500000000000');''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_3 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4095,'1500000000000') + + tdLog.info("========== 4096 stable ==========") + sql = "create stable stable_4096_3 (ts timestamp, " + for i in range(500): + sql += "int_%d int, " % (i + 1) + for i in range(500,1000): + sql += "smallint_%d smallint, " % (i + 1) + for i in range(1000,1500): + sql += "tinyint_%d tinyint, " % (i + 1) + for i in range(1500,2000): + sql += "double_%d double, " % (i + 1) + for i in range(2000,2500): + sql += "float_%d float, " % (i + 1) + for i in range(2500,3000): + sql += "bool_%d bool, " % (i + 1) + for i in range(3000,3500): + sql += "bigint_%d bigint, " % (i + 1) + for i in range(3500,3800): + sql += "nchar_%d nchar(4), " % (i + 1) + for i in range(3800,4090): + sql += "binary_%d binary(10), " % (i + 1) + for i in range(4090,4092): + sql += "timestamp_%d timestamp, " % (i + 1) + sql += " col4093 binary(22)) " + sql += " tags (loc nchar(20),tag_1 int) " + tdLog.info(len(sql)) + tdSql.execute(sql) + + sql = " create table table_4096_3 using stable_4096_3 tags ('table_4096_3',1); " + tdSql.execute(sql) + + for i in range(self.num4096): + sql = "insert into table_4096_3 values(%d, " + for j in range(4090): + str = "'%s', " % 'NULL' + sql += str + for j in range(4090,4092): + str = "%s, " % (self.ts + j) + sql += str + sql += "'%s')" % (self.ts + i) + tdSql.execute(sql % (self.ts + i)) + tdSql.query('''select * from table_4096_3 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4094) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + tdSql.query('''select * from stable_4096_3 where ts = %d ;''' %(self.ts)) + tdSql.checkCols(4096) + tdSql.checkData(0,1,None) + tdSql.checkData(0,501,None) + tdSql.checkData(0,1001,None) + tdSql.checkData(0,1501,None) + tdSql.checkData(0,2001,None) + tdSql.checkData(0,2501,None) + tdSql.checkData(0,3001,None) + tdSql.checkData(0,3501,'NULL') + tdSql.checkData(0,3801,'NULL') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + + sql = '''insert into table_4096_3 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-10 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-10 20:26:44.090','1500000000000');''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_3 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + tdSql.query("select * from stable_4096_3 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + + # tdDnodes restart force data dropping disk + tdDnodes.stop(1) + tdDnodes.start(1) + + tdLog.info("========== regular_table ==========") + tdSql.execute('''insert into regular_table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 200)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into regular_table_3 values( %d , 0, 0, 0, 0, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 200)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+0') + tdSql.checkData(0,7,'nchar+0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + tdSql.execute('''insert into regular_table_3 values( %d , 1, 1, 1, 1, 1, 'binary+1', 'nchar+1', 1.000000, 1.000000, 1600000001000);''' %(self.ts + 200)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,1) + tdSql.checkData(0,2,1) + tdSql.checkData(0,3,1) + tdSql.checkData(0,4,1) + tdSql.checkData(0,5,'True') + tdSql.checkData(0,6,'binary+1') + tdSql.checkData(0,7,'nchar+1') + tdSql.checkData(0,8,1) + tdSql.checkData(0,9,1) + tdSql.checkData(0,10,'2020-09-13 20:26:41.000') + + tdSql.error('''insert into regular_table_3 values( %d , -2147483648, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_3 values( %d , -2147483647, -9223372036854775808, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_3 values( %d , -2147483647, -9223372036854775807, -32768, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_3 values( %d , -2147483647, -9223372036854775807, -32767, -128, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_3 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0123', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into regular_table_3 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + + tdSql.execute('''insert into regular_table_3 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-012', 'nchar-0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:44.090') + + tdSql.error('''insert into regular_table_3 values( %d , 2147483648, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_3 values( %d , 2147483647, 9223372036854775808, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_3 values( %d , 2147483647, 9223372036854775807, 32768, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_3 values( %d , 2147483647, 9223372036854775807, 32767, 128, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_3 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0123', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into regular_table_3 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + + tdSql.execute('''insert into regular_table_3 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+012', 'nchar+0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,2147483647) + tdSql.checkData(0,2,9223372036854775807) + tdSql.checkData(0,3,32767) + tdSql.checkData(0,4,127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+012') + tdSql.checkData(0,7,'nchar+0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:44.090') + tdSql.execute('''insert into regular_table_3 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-012', 'nchar-0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + sql = '''select * from regular_table_3 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdLog.info("========== stable ==========") + tdSql.execute('''insert into table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts - 200)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts - 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-0') + tdSql.checkData(0,7,'nchar-0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into table_3 values( %d , 0, 0, 0, 0, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 200)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+0') + tdSql.checkData(0,7,'nchar+0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+0') + tdSql.checkData(0,7,'nchar+0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.execute('''insert into table_3 values( %d , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);''' %(self.ts + 200)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+0') + tdSql.checkData(0,7,'nchar+0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts + 200) + tdSql.query(sql) + tdSql.checkData(0,1,0) + tdSql.checkData(0,2,0) + tdSql.checkData(0,3,0) + tdSql.checkData(0,4,0) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+0') + tdSql.checkData(0,7,'nchar+0') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + tdSql.error('''insert into table_3 values( %d , -2147483648, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_3 values( %d , -2147483647, -9223372036854775808, -32767, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_3 values( %d , -2147483647, -9223372036854775807, -32768, -127, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_3 values( %d , -2147483647, -9223372036854775807, -32767, -128, 0, 'binary-0', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_3 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0123', 'nchar-0', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + tdSql.error('''insert into table_3 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-0', 'nchar-01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + + tdSql.execute('''insert into table_3 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-012', 'nchar-0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts - 500)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:44.090') + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts - 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:44.090') + + tdSql.error('''insert into table_3 values( %d , 2147483648, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_3 values( %d , 2147483647, 9223372036854775808, 32767, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_3 values( %d , 2147483647, 9223372036854775807, 32768, 127, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_3 values( %d , 2147483647, 9223372036854775807, 32767, 128, 0, 'binary+0', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_3 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0123', 'nchar+0', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + tdSql.error('''insert into table_3 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+0', 'nchar+01234', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + + tdSql.execute('''insert into table_3 values( %d , 2147483647, 9223372036854775807, 32767, 127, 0, 'binary+012', 'nchar+0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,2147483647) + tdSql.checkData(0,2,9223372036854775807) + tdSql.checkData(0,3,32767) + tdSql.checkData(0,4,127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+012') + tdSql.checkData(0,7,'nchar+0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:44.090') + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,2147483647) + tdSql.checkData(0,2,9223372036854775807) + tdSql.checkData(0,3,32767) + tdSql.checkData(0,4,127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary+012') + tdSql.checkData(0,7,'nchar+0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:44.090') + tdSql.execute('''insert into table_3 values( %d , -2147483647, -9223372036854775807, -32767, -127, 0, 'binary-012', 'nchar-0123', 0.000000, 0.000000, 1600000000000);''' %(self.ts + 500)) + sql = '''select * from table_3 where ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + sql = '''select * from stable_1 where loc = 'table_3' and ts = %d ;''' %(self.ts + 500) + tdSql.query(sql) + tdSql.checkData(0,1,-2147483647) + tdSql.checkData(0,2,-9223372036854775807) + tdSql.checkData(0,3,-32767) + tdSql.checkData(0,4,-127) + tdSql.checkData(0,5,'False') + tdSql.checkData(0,6,'binary-012') + tdSql.checkData(0,7,'nchar-0123') + tdSql.checkData(0,8,0) + tdSql.checkData(0,9,0) + tdSql.checkData(0,10,'2020-09-13 20:26:40.000') + + + + tdLog.info("========== 4096 regular_table ==========") + sql = '''insert into regular_table_4096_3 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-13 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-13 20:26:44.090','1600000000000');''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_3 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4095,'1600000000000') + + sql = '''insert into regular_table_4096_3 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-10 20:26:40.000' , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL);''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_3 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4095,'1500000000000') + + sql = '''insert into regular_table_4096_3 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4095 ) + values('2020-09-13 20:26:40.000' , 2 , 502 , 102 , 1502 , 2002 , 0 , 3002 , '3502' , '3802' ,'2020-09-13 20:26:44.092','1600000002000');''' + tdSql.execute(sql) + tdSql.query("select * from regular_table_4096_3 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,2) + tdSql.checkData(0,501,502) + tdSql.checkData(0,1001,102) + tdSql.checkData(0,1501,1502) + tdSql.checkData(0,2001,2002) + tdSql.checkData(0,2501,'False') + tdSql.checkData(0,3001,3002) + tdSql.checkData(0,3501,'3502') + tdSql.checkData(0,3801,'3802') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.092') + tdSql.checkData(0,4095,'1600000002000') + + + tdLog.info("========== 4096 stable ==========") + sql = '''insert into table_4096_3 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-13 20:26:40.000' , 1 , 501 , 101 , 1501 , 2001 , 1 , 3001 , '3501' , '3801' ,'2020-09-13 20:26:44.090','1600000000000');''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_3 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + tdSql.query("select * from stable_4096_3 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.090') + tdSql.checkData(0,4093,'1600000000000') + + sql = '''insert into table_4096_3 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-10 20:26:40.000' , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL);''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_3 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + tdSql.query("select * from stable_4096_3 where ts ='2020-09-10 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,1) + tdSql.checkData(0,501,501) + tdSql.checkData(0,1001,101) + tdSql.checkData(0,1501,1501) + tdSql.checkData(0,2001,2001) + tdSql.checkData(0,2501,'True') + tdSql.checkData(0,3001,3001) + tdSql.checkData(0,3501,'3501') + tdSql.checkData(0,3801,'3801') + tdSql.checkData(0,4091,'2020-09-10 20:26:44.090') + tdSql.checkData(0,4093,'1500000000000') + + sql = '''insert into table_4096_3 (ts , int_1,smallint_501 , tinyint_1001 , double_1501 , float_2001 , bool_2501 , + bigint_3001 , nchar_3501 , binary_3801 , timestamp_4091 , col4093 ) + values('2020-09-13 20:26:40.000' , 2 , 502 , 102 , 1502 , 2002 , 0 , 3002 , '3502' , '3802' ,'2020-09-13 20:26:44.092','1600000002000');''' + tdSql.execute(sql) + tdSql.query("select * from table_4096_3 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4094) + tdSql.checkData(0,1,2) + tdSql.checkData(0,501,502) + tdSql.checkData(0,1001,102) + tdSql.checkData(0,1501,1502) + tdSql.checkData(0,2001,2002) + tdSql.checkData(0,2501,'False') + tdSql.checkData(0,3001,3002) + tdSql.checkData(0,3501,'3502') + tdSql.checkData(0,3801,'3802') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.092') + tdSql.checkData(0,4093,'1600000002000') + tdSql.query("select * from stable_4096_3 where ts ='2020-09-13 20:26:40.000';") + tdSql.checkCols(4096) + tdSql.checkData(0,1,2) + tdSql.checkData(0,501,502) + tdSql.checkData(0,1001,102) + tdSql.checkData(0,1501,1502) + tdSql.checkData(0,2001,2002) + tdSql.checkData(0,2501,'False') + tdSql.checkData(0,3001,3002) + tdSql.checkData(0,3501,'3502') + tdSql.checkData(0,3801,'3802') + tdSql.checkData(0,4091,'2020-09-13 20:26:44.092') + tdSql.checkData(0,4093,'1600000002000') + + + endTime = time.time() + print("total time %ds" % (endTime - startTime)) + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/pytest/insert/schemalessInsert.py b/tests/pytest/insert/schemalessInsert.py new file mode 100644 index 0000000000000000000000000000000000000000..5c93095a1ee414a1559f48595a3e2e412463e829 --- /dev/null +++ b/tests/pytest/insert/schemalessInsert.py @@ -0,0 +1,1234 @@ +################################################################### +# Copyright (c) 2021 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 -*- + +import random +import string +import time +from copy import deepcopy +import numpy as np +from util.log import * +from util.cases import * +from util.sql import * +import threading + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self._conn = conn + + def createDb(self, name="test", db_update_tag=0): + if db_update_tag == 0: + tdSql.execute(f"drop database if exists {name}") + tdSql.execute(f"create database if not exists {name} precision 'us'") + else: + tdSql.execute(f"drop database if exists {name}") + tdSql.execute(f"create database if not exists {name} precision 'us' update 1") + tdSql.execute(f'use {name}') + + def getLongName(self, len, mode = "mixed"): + """ + generate long name + mode could be numbers/letters/mixed + """ + if mode is "numbers": + chars = ''.join(random.choice(string.digits) for i in range(len)) + elif mode is "letters": + chars = ''.join(random.choice(string.ascii_letters.lower()) for i in range(len)) + else: + chars = ''.join(random.choice(string.ascii_letters.lower() + string.digits) for i in range(len)) + return chars + + def timeTrans(self, time_value): + if time_value.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: + ts = int(''.join(list(filter(str.isdigit, time_value))))/1000000 + elif time_value.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": + ts = int(''.join(list(filter(str.isdigit, time_value))))/1 + elif int(time_value) == 0: + ts = time.time() + else: + print("input ts maybe not right format") + ulsec = repr(ts).split('.')[1][:6] + if len(ulsec) < 6 and int(ulsec) != 0: + ulsec = int(ulsec) * (10 ** (6 - len(ulsec))) + elif int(ulsec) == 0: + ulsec *= 6 + # * follow two rows added for tsCheckCase + td_ts = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(ts)) + return td_ts + #td_ts = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(ts)) + td_ts = time.strftime("%Y-%m-%d %H:%M:%S.{}".format(ulsec), time.localtime(ts)) + return td_ts + #return repr(datetime.datetime.strptime(td_ts, "%Y-%m-%d %H:%M:%S.%f")) + + def dateToTs(self, datetime_input): + return int(time.mktime(time.strptime(datetime_input, "%Y-%m-%d %H:%M:%S.%f"))) + + def getTdTypeValue(self, value): + if value.endswith("i8"): + td_type = "TINYINT" + td_tag_value = ''.join(list(value)[:-2]) + elif value.endswith("i16"): + td_type = "SMALLINT" + td_tag_value = ''.join(list(value)[:-3]) + elif value.endswith("i32"): + td_type = "INT" + td_tag_value = ''.join(list(value)[:-3]) + elif value.endswith("i64"): + td_type = "BIGINT" + td_tag_value = ''.join(list(value)[:-3]) + elif value.endswith("u64"): + td_type = "BIGINT UNSIGNED" + td_tag_value = ''.join(list(value)[:-3]) + elif value.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"): + td_type = "DOUBLE" + td_tag_value = ''.join(list(value)[:-3]) + elif value.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": + td_type = "BOOL" + td_tag_value = "True" + elif value.lower() == "f" or value == "false" or value == "False": + td_type = "BOOL" + td_tag_value = "False" + else: + td_type = "FLOAT" + td_tag_value = value + return td_type, td_tag_value + + def typeTrans(self, type_list): + type_num_list = [] + for tp in type_list: + if tp.upper() == "TIMESTAMP": + type_num_list.append(9) + elif tp.upper() == "BOOL": + type_num_list.append(1) + elif tp.upper() == "TINYINT": + type_num_list.append(2) + elif tp.upper() == "SMALLINT": + type_num_list.append(3) + elif tp.upper() == "INT": + type_num_list.append(4) + elif tp.upper() == "BIGINT": + type_num_list.append(5) + elif tp.upper() == "FLOAT": + type_num_list.append(6) + elif tp.upper() == "DOUBLE": + type_num_list.append(7) + elif tp.upper() == "BINARY": + type_num_list.append(8) + elif tp.upper() == "NCHAR": + type_num_list.append(10) + elif tp.upper() == "BIGINT UNSIGNED": + type_num_list.append(14) + return type_num_list + + def inputHandle(self, input_sql): + input_sql_split_list = input_sql.split(" ") + + stb_tag_list = input_sql_split_list[0].split(',') + stb_col_list = input_sql_split_list[1].split(',') + ts_value = self.timeTrans(input_sql_split_list[2]) + + stb_name = stb_tag_list[0] + stb_tag_list.pop(0) + + tag_name_list = [] + tag_value_list = [] + td_tag_value_list = [] + td_tag_type_list = [] + + col_name_list = [] + col_value_list = [] + td_col_value_list = [] + td_col_type_list = [] + + for elm in stb_tag_list: + if "id=" in elm.lower(): + tb_name = elm.split('=')[1] + else: + tag_name_list.append(elm.split("=")[0]) + tag_value_list.append(elm.split("=")[1]) + tb_name = "" + td_tag_value_list.append(self.getTdTypeValue(elm.split("=")[1])[1]) + td_tag_type_list.append(self.getTdTypeValue(elm.split("=")[1])[0]) + + for elm in stb_col_list: + col_name_list.append(elm.split("=")[0]) + col_value_list.append(elm.split("=")[1]) + td_col_value_list.append(self.getTdTypeValue(elm.split("=")[1])[1]) + td_col_type_list.append(self.getTdTypeValue(elm.split("=")[1])[0]) + + final_field_list = [] + final_field_list.extend(col_name_list) + final_field_list.extend(tag_name_list) + + final_type_list = [] + final_type_list.append("TIMESTAMP") + final_type_list.extend(td_col_type_list) + final_type_list.extend(td_tag_type_list) + final_type_list = self.typeTrans(final_type_list) + + final_value_list = [] + final_value_list.append(ts_value) + final_value_list.extend(td_col_value_list) + final_value_list.extend(td_tag_value_list) + return final_value_list, final_field_list, final_type_list, stb_name, tb_name + + def genFullTypeSql(self, stb_name="", tb_name="", t0="", t1="127i8", t2="32767i16", t3="2147483647i32", + t4="9223372036854775807i64", t5="11.12345f32", t6="22.123456789f64", t7="\"binaryTagValue\"", + t8="L\"ncharTagValue\"", c0="", c1="127i8", c2="32767i16", c3="2147483647i32", + c4="9223372036854775807i64", c5="11.12345f32", c6="22.123456789f64", c7="\"binaryColValue\"", + c8="L\"ncharColValue\"", c9="7u64", ts="1626006833639000000ns", + id_noexist_tag=None, id_change_tag=None, id_upper_tag=None, id_double_tag=None, + ct_add_tag=None, ct_am_tag=None, ct_ma_tag=None, ct_min_tag=None): + if stb_name == "": + stb_name = self.getLongName(len=6, mode="letters") + if tb_name == "": + tb_name = f'{stb_name}_{random.randint(0, 65535)}_{random.randint(0, 65535)}' + if t0 == "": + t0 = random.choice(["f", "F", "false", "False", "t", "T", "true", "True"]) + if c0 == "": + c0 = random.choice(["f", "F", "false", "False", "t", "T", "true", "True"]) + #sql_seq = f'{stb_name},id=\"{tb_name}\",t0={t0},t1=127i8,t2=32767i16,t3=125.22f64,t4=11.321f32,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" c0={bool_value},c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"binaryValue\",c8=L\"ncharValue\" 1626006833639000000ns' + if id_upper_tag is not None: + id = "ID" + else: + id = "id" + sql_seq = f'{stb_name},{id}=\"{tb_name}\",t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6},t7={t7},t8={t8} c0={c0},c1={c1},c2={c2},c3={c3},c4={c4},c5={c5},c6={c6},c7={c7},c8={c8},c9={c9} {ts}' + if id_noexist_tag is not None: + sql_seq = f'{stb_name},t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6},t7={t7},t8={t8} c0={c0},c1={c1},c2={c2},c3={c3},c4={c4},c5={c5},c6={c6},c7={c7},c8={c8},c9={c9} {ts}' + if ct_add_tag is not None: + sql_seq = f'{stb_name},t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6},t7={t7},t8={t8},t9={t8} c0={c0},c1={c1},c2={c2},c3={c3},c4={c4},c5={c5},c6={c6},c7={c7},c8={c8},c9={c9} {ts}' + if id_change_tag is not None: + sql_seq = f'{stb_name},t0={t0},t1={t1},{id}=\"{tb_name}\",t2={t2},t3={t3},t4={t4},t5={t5},t6={t6},t7={t7},t8={t8} c0={c0},c1={c1},c2={c2},c3={c3},c4={c4},c5={c5},c6={c6},c7={c7},c8={c8},c9={c9} {ts}' + if id_double_tag is not None: + sql_seq = f'{stb_name},{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} c0={c0},c1={c1},c2={c2},c3={c3},c4={c4},c5={c5},c6={c6},c7={c7},c8={c8},c9={c9} {ts}' + if ct_add_tag is not None: + sql_seq = f'{stb_name},{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} c0={c0},c1={c1},c2={c2},c3={c3},c4={c4},c5={c5},c6={c6},c7={c7},c8={c8},c9={c9},c11={c8},c10={t0} {ts}' + if ct_am_tag is not None: + sql_seq = f'{stb_name},{id}=\"{tb_name}\",t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6} c0={c0},c1={c1},c2={c2},c3={c3},c4={c4},c5={c5},c6={c6},c7={c7},c8={c8},c9={c9},c11={c8},c10={t0} {ts}' + if id_noexist_tag is not None: + sql_seq = f'{stb_name},t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6} c0={c0},c1={c1},c2={c2},c3={c3},c4={c4},c5={c5},c6={c6},c7={c7},c8={c8},c9={c9},c11={c8},c10={t0} {ts}' + if ct_ma_tag is not None: + sql_seq = f'{stb_name},{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} c0={c0},c1={c1},c2={c2},c3={c3},c4={c4},c5={c5},c6={c6} {ts}' + if id_noexist_tag is not None: + sql_seq = f'{stb_name},t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6},t7={t7},t8={t8},t11={t1},t10={t8} c0={c0},c1={c1},c2={c2},c3={c3},c4={c4},c5={c5},c6={c6} {ts}' + if ct_min_tag is not None: + sql_seq = f'{stb_name},{id}=\"{tb_name}\",t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6} c0={c0},c1={c1},c2={c2},c3={c3},c4={c4},c5={c5},c6={c6} {ts}' + return sql_seq, stb_name + + def genMulTagColStr(self, genType, count): + """ + genType must be tag/col + """ + tag_str = "" + col_str = "" + if genType == "tag": + for i in range(0, count): + if i < (count-1): + tag_str += f't{i}=f,' + else: + tag_str += f't{i}=f ' + return tag_str + if genType == "col": + for i in range(0, count): + if i < (count-1): + col_str += f'c{i}=t,' + else: + col_str += f'c{i}=t ' + return col_str + + def genLongSql(self, tag_count, col_count): + stb_name = self.getLongName(7, mode="letters") + tb_name = f'{stb_name}_1' + tag_str = self.genMulTagColStr("tag", tag_count) + col_str = self.genMulTagColStr("col", col_count) + ts = "1626006833640000000ns" + long_sql = stb_name + ',' + f'id=\"{tb_name}\"' + ',' + tag_str + col_str + ts + return long_sql, stb_name + + def getNoIdTbName(self, stb_name): + query_sql = f"select tbname from {stb_name}" + tb_name = self.resHandle(query_sql, True)[0][0] + return tb_name + + def resHandle(self, query_sql, query_tag): + tdSql.execute('reset query cache') + row_info = tdSql.query(query_sql, query_tag) + col_info = tdSql.getColNameList(query_sql, query_tag) + res_row_list = [] + sub_list = [] + for row_mem in row_info: + for i in row_mem: + sub_list.append(str(i)) + res_row_list.append(sub_list) + res_field_list_without_ts = col_info[0][1:] + res_type_list = col_info[1] + return res_row_list, res_field_list_without_ts, res_type_list + + def resCmp(self, input_sql, stb_name, query_sql="select * from", condition="", ts=None, id=True, none_check_tag=None): + expect_list = self.inputHandle(input_sql) + self._conn.insertLines([input_sql]) + query_sql = f"{query_sql} {stb_name} {condition}" + res_row_list, res_field_list_without_ts, res_type_list = self.resHandle(query_sql, True) + if ts == 0: + res_ts = self.dateToTs(res_row_list[0][0]) + current_time = time.time() + if current_time - res_ts < 60: + tdSql.checkEqual(res_row_list[0][1:], expect_list[0][1:]) + else: + print("timeout") + tdSql.checkEqual(res_row_list[0], expect_list[0]) + else: + if none_check_tag is not None: + none_index_list = [i for i,x in enumerate(res_row_list[0]) if x=="None"] + none_index_list.reverse() + for j in none_index_list: + res_row_list[0].pop(j) + expect_list[0].pop(j) + tdSql.checkEqual(res_row_list[0], expect_list[0]) + tdSql.checkEqual(res_field_list_without_ts, expect_list[1]) + tdSql.checkEqual(res_type_list, expect_list[2]) + + def cleanStb(self): + query_sql = "show stables" + res_row_list = tdSql.query(query_sql, True) + stb_list = map(lambda x: x[0], res_row_list) + for stb in stb_list: + tdSql.execute(f'drop table if exists {stb}') + + def initCheckCase(self): + """ + normal tags and cols, one for every elm + """ + self.cleanStb() + input_sql, stb_name = self.genFullTypeSql() + self.resCmp(input_sql, stb_name) + + def boolTypeCheckCase(self): + """ + check all normal type + """ + self.cleanStb() + full_type_list = ["f", "F", "false", "False", "t", "T", "true", "True"] + for t_type in full_type_list: + input_sql, stb_name = self.genFullTypeSql(c0=t_type, t0=t_type) + self.resCmp(input_sql, stb_name) + + def symbolsCheckCase(self): + """ + check symbols = `~!@#$%^&*()_-+={[}]\|:;'\",<.>/? + """ + ''' + please test : + binary_symbols = '\"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"\'\'"\"' + ''' + self.cleanStb() + binary_symbols = '\"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"\"' + nchar_symbols = f'L{binary_symbols}' + input_sql, stb_name = self.genFullTypeSql(c7=binary_symbols, c8=nchar_symbols, t7=binary_symbols, t8=nchar_symbols) + self.resCmp(input_sql, stb_name) + + def tsCheckCase(self): + """ + test ts list --> ["1626006833639000000ns", "1626006833639019us", "1626006833640ms", "1626006834s", "1626006822639022"] + # ! us级时间戳都为0时,数据库中查询显示,但python接口拿到的结果不显示 .000000的情况请确认,目前修改时间处理代码可以通过 + """ + self.cleanStb() + ts_list = ["1626006833639000000ns", "1626006833639019us", "1626006833640ms", "1626006834s", "1626006822639022", 0] + for ts in ts_list: + input_sql, stb_name = self.genFullTypeSql(ts=ts) + self.resCmp(input_sql, stb_name, ts=ts) + + def idSeqCheckCase(self): + """ + check id.index in tags + eg: t0=**,id=**,t1=** + """ + self.cleanStb() + input_sql, stb_name = self.genFullTypeSql(id_change_tag=True) + self.resCmp(input_sql, stb_name) + + def idUpperCheckCase(self): + """ + check id param + eg: id and ID + """ + self.cleanStb() + input_sql, stb_name = self.genFullTypeSql(id_upper_tag=True) + self.resCmp(input_sql, stb_name) + input_sql, stb_name = self.genFullTypeSql(id_change_tag=True, id_upper_tag=True) + self.resCmp(input_sql, stb_name) + + def noIdCheckCase(self): + """ + id not exist + """ + self.cleanStb() + input_sql, stb_name = self.genFullTypeSql(id_noexist_tag=True) + self.resCmp(input_sql, stb_name) + query_sql = f"select tbname from {stb_name}" + res_row_list = self.resHandle(query_sql, True)[0] + if len(res_row_list[0][0]) > 0: + tdSql.checkColNameList(res_row_list, res_row_list) + else: + tdSql.checkColNameList(res_row_list, "please check noIdCheckCase") + + def maxColTagCheckCase(self): + """ + max tag count is 128 + max col count is ?? + """ + for input_sql in [self.genLongSql(128, 1)[0], self.genLongSql(1, 4094)[0]]: + self.cleanStb() + code = self._conn.insertLines([input_sql]) + tdSql.checkEqual(code, 0) + for input_sql in [self.genLongSql(129, 1)[0], self.genLongSql(1, 4095)[0]]: + self.cleanStb() + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + + def idIllegalNameCheckCase(self): + """ + test illegal id name + mix "`~!@#$¥%^&*()-+={}|[]、「」【】\:;《》<>?" + """ + self.cleanStb() + rstr = list("`~!@#$¥%^&*()-+={}|[]、「」【】\:;《》<>?") + for i in rstr: + input_sql = self.genFullTypeSql(tb_name=f"\"aaa{i}bbb\"")[0] + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + + def idStartWithNumCheckCase(self): + """ + id is start with num + """ + self.cleanStb() + input_sql = self.genFullTypeSql(tb_name=f"\"1aaabbb\"")[0] + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + + def nowTsCheckCase(self): + """ + check now unsupported + """ + self.cleanStb() + input_sql = self.genFullTypeSql(ts="now")[0] + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + + def dateFormatTsCheckCase(self): + """ + check date format ts unsupported + """ + self.cleanStb() + input_sql = self.genFullTypeSql(ts="2021-07-21\ 19:01:46.920")[0] + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + + def illegalTsCheckCase(self): + """ + check ts format like 16260068336390us19 + """ + self.cleanStb() + input_sql = self.genFullTypeSql(ts="16260068336390us19")[0] + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + + def tagValueLengthCheckCase(self): + """ + check full type tag value limit + """ + self.cleanStb() + # i8 + for t1 in ["-127i8", "127i8"]: + input_sql, stb_name = self.genFullTypeSql(t1=t1) + self.resCmp(input_sql, stb_name) + for t1 in ["-128i8", "128i8"]: + input_sql = self.genFullTypeSql(t1=t1)[0] + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + + #i16 + for t2 in ["-32767i16", "32767i16"]: + input_sql, stb_name = self.genFullTypeSql(t2=t2) + self.resCmp(input_sql, stb_name) + for t2 in ["-32768i16", "32768i16"]: + input_sql = self.genFullTypeSql(t2=t2)[0] + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + + #i32 + for t3 in ["-2147483647i32", "2147483647i32"]: + input_sql, stb_name = self.genFullTypeSql(t3=t3) + self.resCmp(input_sql, stb_name) + for t3 in ["-2147483648i32", "2147483648i32"]: + input_sql = self.genFullTypeSql(t3=t3)[0] + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + + #i64 + for t4 in ["-9223372036854775807i64", "9223372036854775807i64"]: + input_sql, stb_name = self.genFullTypeSql(t4=t4) + self.resCmp(input_sql, stb_name) + for t4 in ["-9223372036854775808i64", "9223372036854775808i64"]: + input_sql = self.genFullTypeSql(t4=t4)[0] + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + + # f32 + for t5 in [f"{-3.4028234663852885981170418348451692544*(10**38)}f32", f"{3.4028234663852885981170418348451692544*(10**38)}f32"]: + input_sql, stb_name = self.genFullTypeSql(t5=t5) + self.resCmp(input_sql, stb_name) + # * limit set to 4028234664*(10**38) + for t5 in [f"{-3.4028234664*(10**38)}f32", f"{3.4028234664*(10**38)}f32"]: + input_sql = self.genFullTypeSql(t5=t5)[0] + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + + # f64 + for t6 in [f'{-1.79769*(10**308)}f64', f'{-1.79769*(10**308)}f64']: + input_sql, stb_name = self.genFullTypeSql(t6=t6) + self.resCmp(input_sql, stb_name) + # * limit set to 1.797693134862316*(10**308) + for c6 in [f'{-1.797693134862316*(10**308)}f64', f'{-1.797693134862316*(10**308)}f64']: + input_sql = self.genFullTypeSql(c6=c6)[0] + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + + # binary + stb_name = self.getLongName(7, "letters") + input_sql = f'{stb_name},t0=t,t1="{self.getLongName(16374, "letters")}" c0=f 1626006833639000000ns' + code = self._conn.insertLines([input_sql]) + tdSql.checkEqual(code, 0) + input_sql = f'{stb_name},t0=t,t1="{self.getLongName(16375, "letters")}" c0=f 1626006833639000000ns' + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + + # nchar + # * legal nchar could not be larger than 16374/4 + stb_name = self.getLongName(7, "letters") + input_sql = f'{stb_name},t0=t,t1=L"{self.getLongName(4093, "letters")}" c0=f 1626006833639000000ns' + code = self._conn.insertLines([input_sql]) + tdSql.checkEqual(code, 0) + input_sql = f'{stb_name},t0=t,t1=L"{self.getLongName(4094, "letters")}" c0=f 1626006833639000000ns' + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + + def colValueLengthCheckCase(self): + """ + check full type col value limit + """ + self.cleanStb() + # i8 + for c1 in ["-127i8", "127i8"]: + input_sql, stb_name = self.genFullTypeSql(c1=c1) + self.resCmp(input_sql, stb_name) + + for c1 in ["-128i8", "128i8"]: + input_sql = self.genFullTypeSql(c1=c1)[0] + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + # i16 + for c2 in ["-32767i16"]: + input_sql, stb_name = self.genFullTypeSql(c2=c2) + self.resCmp(input_sql, stb_name) + for c2 in ["-32768i16", "32768i16"]: + input_sql = self.genFullTypeSql(c2=c2)[0] + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + + # i32 + for c3 in ["-2147483647i32"]: + input_sql, stb_name = self.genFullTypeSql(c3=c3) + self.resCmp(input_sql, stb_name) + for c3 in ["-2147483648i32", "2147483648i32"]: + input_sql = self.genFullTypeSql(c3=c3)[0] + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + + # i64 + for c4 in ["-9223372036854775807i64"]: + input_sql, stb_name = self.genFullTypeSql(c4=c4) + self.resCmp(input_sql, stb_name) + for c4 in ["-9223372036854775808i64", "9223372036854775808i64"]: + input_sql = self.genFullTypeSql(c4=c4)[0] + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + + # f32 + for c5 in [f"{-3.4028234663852885981170418348451692544*(10**38)}f32", f"{3.4028234663852885981170418348451692544*(10**38)}f32"]: + input_sql, stb_name = self.genFullTypeSql(c5=c5) + self.resCmp(input_sql, stb_name) + # * limit set to 4028234664*(10**38) + for c5 in [f"{-3.4028234664*(10**38)}f32", f"{3.4028234664*(10**38)}f32"]: + input_sql = self.genFullTypeSql(c5=c5)[0] + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + + # f64 + for c6 in [f'{-1.79769313486231570814527423731704356798070567525844996598917476803157260780*(10**308)}f64', f'{-1.79769313486231570814527423731704356798070567525844996598917476803157260780*(10**308)}f64']: + input_sql, stb_name = self.genFullTypeSql(c6=c6) + self.resCmp(input_sql, stb_name) + # * limit set to 1.797693134862316*(10**308) + for c6 in [f'{-1.797693134862316*(10**308)}f64', f'{-1.797693134862316*(10**308)}f64']: + input_sql = self.genFullTypeSql(c6=c6)[0] + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + + # # binary + stb_name = self.getLongName(7, "letters") + input_sql = f'{stb_name},t0=t c0=f,c1="{self.getLongName(16374, "letters")}" 1626006833639000000ns' + code = self._conn.insertLines([input_sql]) + tdSql.checkEqual(code, 0) + input_sql = f'{stb_name},t0=t c0=f,c1="{self.getLongName(16375, "letters")}" 1626006833639000000ns' + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + + # nchar + # * legal nchar could not be larger than 16374/4 + stb_name = self.getLongName(7, "letters") + input_sql = f'{stb_name},t0=t c0=f,c1=L"{self.getLongName(4093, "letters")}" 1626006833639000000ns' + code = self._conn.insertLines([input_sql]) + tdSql.checkEqual(code, 0) + input_sql = f'{stb_name},t0=t c0=f,c1=L"{self.getLongName(4094, "letters")}" 1626006833639000000ns' + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + + def tagColIllegalValueCheckCase(self): + + """ + test illegal tag col value + """ + self.cleanStb() + # bool + for i in ["TrUe", "tRue", "trUe", "truE", "FalsE", "fAlse", "faLse", "falSe", "falsE"]: + input_sql1 = self.genFullTypeSql(t0=i)[0] + code = self._conn.insertLines([input_sql1]) + tdSql.checkNotEqual(code, 0) + input_sql2 = self.genFullTypeSql(c0=i)[0] + code = self._conn.insertLines([input_sql2]) + tdSql.checkNotEqual(code, 0) + + # i8 i16 i32 i64 f32 f64 + for input_sql in [ + self.genFullTypeSql(t1="1s2i8")[0], + self.genFullTypeSql(t2="1s2i16")[0], + self.genFullTypeSql(t3="1s2i32")[0], + self.genFullTypeSql(t4="1s2i64")[0], + self.genFullTypeSql(t5="11.1s45f32")[0], + self.genFullTypeSql(t6="11.1s45f64")[0], + self.genFullTypeSql(c1="1s2i8")[0], + self.genFullTypeSql(c2="1s2i16")[0], + self.genFullTypeSql(c3="1s2i32")[0], + self.genFullTypeSql(c4="1s2i64")[0], + self.genFullTypeSql(c5="11.1s45f32")[0], + self.genFullTypeSql(c6="11.1s45f64")[0], + self.genFullTypeSql(c9="1s1u64")[0] + ]: + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + + # check binary and nchar blank + stb_name = self.getLongName(7, "letters") + input_sql1 = f'{stb_name},t0=t c0=f,c1="abc aaa" 1626006833639000000ns' + input_sql2 = f'{stb_name},t0=t c0=f,c1=L"abc aaa" 1626006833639000000ns' + input_sql3 = f'{stb_name},t0=t,t1="abc aaa" c0=f 1626006833639000000ns' + input_sql4 = f'{stb_name},t0=t,t1=L"abc aaa" c0=f 1626006833639000000ns' + for input_sql in [input_sql1, input_sql2, input_sql3, input_sql4]: + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + + # check accepted binary and nchar symbols + # # * ~!@#$¥%^&*()-+={}|[]、「」:; + for symbol in list('~!@#$¥%^&*()-+={}|[]、「」:;'): + input_sql1 = f'{stb_name},t0=t c0=f,c1="abc{symbol}aaa" 1626006833639000000ns' + input_sql2 = f'{stb_name},t0=t,t1="abc{symbol}aaa" c0=f 1626006833639000000ns' + code = self._conn.insertLines([input_sql1]) + tdSql.checkEqual(code, 0) + code = self._conn.insertLines([input_sql2]) + tdSql.checkEqual(code, 0) + + + def duplicateIdTagColInsertCheckCase(self): + """ + check duplicate Id Tag Col + """ + self.cleanStb() + input_sql_id = self.genFullTypeSql(id_double_tag=True)[0] + code = self._conn.insertLines([input_sql_id]) + tdSql.checkNotEqual(code, 0) + + input_sql = self.genFullTypeSql()[0] + input_sql_tag = input_sql.replace("t5", "t6") + code = self._conn.insertLines([input_sql_tag]) + tdSql.checkNotEqual(code, 0) + + input_sql = self.genFullTypeSql()[0] + input_sql_col = input_sql.replace("c5", "c6") + code = self._conn.insertLines([input_sql_col]) + tdSql.checkNotEqual(code, 0) + + input_sql = self.genFullTypeSql()[0] + input_sql_col = input_sql.replace("c5", "C6") + code = self._conn.insertLines([input_sql_col]) + tdSql.checkNotEqual(code, 0) + + ##### stb exist ##### + def noIdStbExistCheckCase(self): + """ + case no id when stb exist + """ + self.cleanStb() + input_sql, stb_name = self.genFullTypeSql(t0="f", c0="f") + self.resCmp(input_sql, stb_name) + input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, id_noexist_tag=True, t0="f", c0="f") + 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): + """ + check duplicate insert when stb exist + """ + self.cleanStb() + input_sql, stb_name = self.genFullTypeSql() + self.resCmp(input_sql, stb_name) + code = self._conn.insertLines([input_sql]) + tdSql.checkEqual(code, 0) + self.resCmp(input_sql, stb_name) + + def tagColBinaryNcharLengthCheckCase(self): + """ + check length increase + """ + self.cleanStb() + input_sql, stb_name = self.genFullTypeSql() + self.resCmp(input_sql, stb_name) + tb_name = self.getLongName(5, "letters") + input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name,t7="\"binaryTagValuebinaryTagValue\"", t8="L\"ncharTagValuencharTagValue\"", c7="\"binaryTagValuebinaryTagValue\"", c8="L\"ncharTagValuencharTagValue\"") + self.resCmp(input_sql, stb_name, condition=f'where tbname like "{tb_name}"') + + def tagColAddDupIDCheckCase(self): + """ + check column and tag count add, stb and tb duplicate + * tag: alter table ... + * col: when update==0 and ts is same, unchange + * so this case tag&&value will be added, + * col is added without value when update==0 + * col is added with value when update==1 + """ + self.cleanStb() + tb_name = self.getLongName(7, "letters") + for db_update_tag in [0, 1]: + if db_update_tag == 1 : + self.createDb("test_update", db_update_tag=db_update_tag) + input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, t0="f", c0="f") + self.resCmp(input_sql, stb_name) + self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t0="f", c0="f", ct_add_tag=True) + if db_update_tag == 1 : + self.resCmp(input_sql, stb_name, condition=f'where tbname like "{tb_name}"') + else: + self.resCmp(input_sql, stb_name, condition=f'where tbname like "{tb_name}"', none_check_tag=True) + + def tagColAddCheckCase(self): + """ + check column and tag count add + """ + self.cleanStb() + tb_name = self.getLongName(7, "letters") + input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, t0="f", c0="f") + self.resCmp(input_sql, stb_name) + tb_name_1 = self.getLongName(7, "letters") + input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name_1, t0="f", c0="f", ct_add_tag=True) + self.resCmp(input_sql, stb_name, condition=f'where tbname like "{tb_name_1}"') + res_row_list = self.resHandle(f"select c10,c11,t10,t11 from {tb_name}", True)[0] + tdSql.checkEqual(res_row_list[0], ['None', 'None', 'None', 'None']) + self.resCmp(input_sql, stb_name, condition=f'where tbname like "{tb_name}"', none_check_tag=True) + + def tagMd5Check(self): + """ + condition: stb not change + insert two table, keep tag unchange, change col + """ + self.cleanStb() + input_sql, stb_name = self.genFullTypeSql(t0="f", c0="f", id_noexist_tag=True) + self.resCmp(input_sql, stb_name) + tb_name1 = self.getNoIdTbName(stb_name) + input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, t0="f", c0="f", id_noexist_tag=True) + self.resCmp(input_sql, stb_name) + tb_name2 = self.getNoIdTbName(stb_name) + tdSql.query(f"select * from {stb_name}") + tdSql.checkRows(1) + tdSql.checkEqual(tb_name1, tb_name2) + input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, t0="f", c0="f", id_noexist_tag=True, ct_add_tag=True) + self._conn.insertLines([input_sql]) + tb_name3 = self.getNoIdTbName(stb_name) + tdSql.query(f"select * from {stb_name}") + tdSql.checkRows(2) + tdSql.checkNotEqual(tb_name1, tb_name3) + + # * tag binary max is 16384, col+ts binary max 49151 + def tagColBinaryMaxLengthCheckCase(self): + """ + every binary and nchar must be length+2 + """ + self.cleanStb() + stb_name = self.getLongName(7, "letters") + tb_name = f'{stb_name}_1' + input_sql = f'{stb_name},id="{tb_name}",t0=t c0=f 1626006833639000000ns' + code = self._conn.insertLines([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},t0=t,t1="{self.getLongName(16374, "letters")}",t2="{self.getLongName(5, "letters")}" c0=f 1626006833639000000ns' + code = self._conn.insertLines([input_sql]) + tdSql.checkEqual(code, 0) + tdSql.query(f"select * from {stb_name}") + tdSql.checkRows(2) + input_sql = f'{stb_name},t0=t,t1="{self.getLongName(16374, "letters")}",t2="{self.getLongName(6, "letters")}" c0=f 1626006833639000000ns' + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + tdSql.query(f"select * from {stb_name}") + tdSql.checkRows(2) + + # # * check col,col+ts max in describe ---> 16143 + input_sql = f'{stb_name},t0=t c0=f,c1="{self.getLongName(16374, "letters")}",c2="{self.getLongName(16374, "letters")}",c3="{self.getLongName(16374, "letters")}",c4="{self.getLongName(12, "letters")}" 1626006833639000000ns' + code = self._conn.insertLines([input_sql]) + tdSql.checkEqual(code, 0) + tdSql.query(f"select * from {stb_name}") + tdSql.checkRows(3) + input_sql = f'{stb_name},t0=t c0=f,c1="{self.getLongName(16374, "letters")}",c2="{self.getLongName(16374, "letters")}",c3="{self.getLongName(16374, "letters")}",c4="{self.getLongName(13, "letters")}" 1626006833639000000ns' + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + tdSql.query(f"select * from {stb_name}") + tdSql.checkRows(3) + + # * tag nchar max is 16374/4, col+ts nchar max 49151 + def tagColNcharMaxLengthCheckCase(self): + """ + check nchar length limit + """ + self.cleanStb() + stb_name = self.getLongName(7, "letters") + tb_name = f'{stb_name}_1' + input_sql = f'{stb_name},id="{tb_name}",t0=t c0=f 1626006833639000000ns' + code = self._conn.insertLines([input_sql]) + + # * legal nchar could not be larger than 16374/4 + input_sql = f'{stb_name},t0=t,t1=L"{self.getLongName(4093, "letters")}",t2=L"{self.getLongName(1, "letters")}" c0=f 1626006833639000000ns' + code = self._conn.insertLines([input_sql]) + tdSql.checkEqual(code, 0) + tdSql.query(f"select * from {stb_name}") + tdSql.checkRows(2) + input_sql = f'{stb_name},t0=t,t1=L"{self.getLongName(4093, "letters")}",t2=L"{self.getLongName(2, "letters")}" c0=f 1626006833639000000ns' + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + tdSql.query(f"select * from {stb_name}") + tdSql.checkRows(2) + + input_sql = f'{stb_name},t0=t c0=f,c1=L"{self.getLongName(4093, "letters")}",c2=L"{self.getLongName(4093, "letters")}",c3=L"{self.getLongName(4093, "letters")}",c4=L"{self.getLongName(4, "letters")}" 1626006833639000000ns' + code = self._conn.insertLines([input_sql]) + tdSql.checkEqual(code, 0) + tdSql.query(f"select * from {stb_name}") + tdSql.checkRows(3) + input_sql = f'{stb_name},t0=t c0=f,c1=L"{self.getLongName(4093, "letters")}",c2=L"{self.getLongName(4093, "letters")}",c3=L"{self.getLongName(4093, "letters")}",c4=L"{self.getLongName(5, "letters")}" 1626006833639000000ns' + code = self._conn.insertLines([input_sql]) + tdSql.checkNotEqual(code, 0) + tdSql.query(f"select * from {stb_name}") + tdSql.checkRows(3) + + def batchInsertCheckCase(self): + """ + test batch insert + """ + self.cleanStb() + stb_name = self.getLongName(8, "letters") + tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 bigint)') + lines = ["st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns", + "st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833640000000ns", + f"{stb_name},t2=5f64,t3=L\"ste\" c1=true,c2=4i64,c3=\"iam\" 1626056811823316532ns", + "stf567890,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64,c6=7u64 1626006933640000000ns", + "st123456,t1=4i64,t2=5f64,t3=\"t4\" c1=3i64,c3=L\"passitagain\",c2=true,c4=5f64 1626006833642000000ns", + f"{stb_name},t2=5f64,t3=L\"ste2\" c3=\"iamszhou\",c4=false 1626056811843316532ns", + f"{stb_name},t2=5f64,t3=L\"ste2\" c3=\"iamszhou\",c4=false,c5=32i8,c6=64i16,c7=32i32,c8=88.88f32 1626056812843316532ns", + "st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64,c6=7u64 1626006933640000000ns", + "st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933641000000ns" + ] + code = self._conn.insertLines(lines) + tdSql.checkEqual(code, 0) + + def multiInsertCheckCase(self, count): + """ + test multi insert + """ + self.cleanStb() + sql_list = [] + stb_name = self.getLongName(8, "letters") + tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 bigint)') + for i in range(count): + input_sql = self.genFullTypeSql(stb_name=stb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', id_noexist_tag=True)[0] + sql_list.append(input_sql) + code = self._conn.insertLines(sql_list) + tdSql.checkEqual(code, 0) + + def batchErrorInsertCheckCase(self): + """ + test batch error insert + """ + self.cleanStb() + stb_name = self.getLongName(8, "letters") + lines = ["st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns", + f"{stb_name},t2=5f64,t3=L\"ste\" c1=tRue,c2=4i64,c3=\"iam\" 1626056811823316532ns"] + code = self._conn.insertLines(lines) + tdSql.checkNotEqual(code, 0) + + def genSqlList(self, count=5, stb_name="", tb_name=""): + """ + stb --> supertable + tb --> table + ts --> timestamp, same default + col --> column, same default + tag --> tag, same default + d --> different + s --> same + a --> add + m --> minus + """ + d_stb_d_tb_list = list() + s_stb_s_tb_list = list() + s_stb_s_tb_a_col_a_tag_list = list() + s_stb_s_tb_m_col_m_tag_list = list() + s_stb_d_tb_list = list() + s_stb_d_tb_a_col_m_tag_list = list() + s_stb_d_tb_a_tag_m_col_list = list() + s_stb_s_tb_d_ts_list = list() + s_stb_s_tb_d_ts_a_col_m_tag_list = list() + s_stb_s_tb_d_ts_a_tag_m_col_list = list() + s_stb_d_tb_d_ts_list = list() + s_stb_d_tb_d_ts_a_col_m_tag_list = list() + s_stb_d_tb_d_ts_a_tag_m_col_list = list() + for i in range(count): + d_stb_d_tb_list.append(self.genFullTypeSql(t0="f", c0="f")) + s_stb_s_tb_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"')) + s_stb_s_tb_a_col_a_tag_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', ct_add_tag=True)) + s_stb_s_tb_m_col_m_tag_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', ct_min_tag=True)) + s_stb_d_tb_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', id_noexist_tag=True)) + s_stb_d_tb_a_col_m_tag_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', id_noexist_tag=True, ct_am_tag=True)) + s_stb_d_tb_a_tag_m_col_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', id_noexist_tag=True, ct_ma_tag=True)) + s_stb_s_tb_d_ts_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', ts=0)) + s_stb_s_tb_d_ts_a_col_m_tag_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', ts=0, ct_am_tag=True)) + s_stb_s_tb_d_ts_a_tag_m_col_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', ts=0, ct_ma_tag=True)) + s_stb_d_tb_d_ts_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', id_noexist_tag=True, ts=0)) + s_stb_d_tb_d_ts_a_col_m_tag_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', id_noexist_tag=True, ts=0, ct_am_tag=True)) + s_stb_d_tb_d_ts_a_tag_m_col_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', id_noexist_tag=True, ts=0, ct_ma_tag=True)) + + return d_stb_d_tb_list, s_stb_s_tb_list, s_stb_s_tb_a_col_a_tag_list, s_stb_s_tb_m_col_m_tag_list, \ + s_stb_d_tb_list, s_stb_d_tb_a_col_m_tag_list, s_stb_d_tb_a_tag_m_col_list, s_stb_s_tb_d_ts_list, \ + s_stb_s_tb_d_ts_a_col_m_tag_list, s_stb_s_tb_d_ts_a_tag_m_col_list, s_stb_d_tb_d_ts_list, \ + s_stb_d_tb_d_ts_a_col_m_tag_list, s_stb_d_tb_d_ts_a_tag_m_col_list + + + def genMultiThreadSeq(self, sql_list): + tlist = list() + for insert_sql in sql_list: + t = threading.Thread(target=self._conn.insertLines,args=([insert_sql[0]],)) + tlist.append(t) + return tlist + + def multiThreadRun(self, tlist): + for t in tlist: + t.start() + for t in tlist: + t.join() + + def stbInsertMultiThreadCheckCase(self): + """ + thread input different stb + """ + self.cleanStb() + input_sql = self.genSqlList()[0] + self.multiThreadRun(self.genMultiThreadSeq(input_sql)) + tdSql.query(f"show tables;") + tdSql.checkRows(5) + + def sStbStbDdataInsertMultiThreadCheckCase(self): + """ + thread input same stb tb, different data, result keep first data + """ + self.cleanStb() + tb_name = self.getLongName(7, "letters") + input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name) + self.resCmp(input_sql, stb_name) + s_stb_s_tb_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[1] + self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_list)) + tdSql.query(f"show tables;") + tdSql.checkRows(1) + expected_tb_name = self.getNoIdTbName(stb_name)[0] + tdSql.checkEqual(tb_name, expected_tb_name) + tdSql.query(f"select * from {stb_name};") + tdSql.checkRows(1) + + def sStbStbDdataAtcInsertMultiThreadCheckCase(self): + """ + thread input same stb tb, different data, add columes and tags, result keep first data + """ + self.cleanStb() + tb_name = self.getLongName(7, "letters") + input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name) + self.resCmp(input_sql, stb_name) + s_stb_s_tb_a_col_a_tag_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[2] + self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_a_col_a_tag_list)) + tdSql.query(f"show tables;") + tdSql.checkRows(1) + expected_tb_name = self.getNoIdTbName(stb_name)[0] + tdSql.checkEqual(tb_name, expected_tb_name) + tdSql.query(f"select * from {stb_name};") + tdSql.checkRows(1) + + def sStbStbDdataMtcInsertMultiThreadCheckCase(self): + """ + thread input same stb tb, different data, minus columes and tags, result keep first data + """ + self.cleanStb() + tb_name = self.getLongName(7, "letters") + input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name) + self.resCmp(input_sql, stb_name) + s_stb_s_tb_m_col_m_tag_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[3] + self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_m_col_m_tag_list)) + tdSql.query(f"show tables;") + tdSql.checkRows(1) + expected_tb_name = self.getNoIdTbName(stb_name)[0] + tdSql.checkEqual(tb_name, expected_tb_name) + tdSql.query(f"select * from {stb_name};") + tdSql.checkRows(1) + + def sStbDtbDdataInsertMultiThreadCheckCase(self): + """ + thread input same stb, different tb, different data + """ + self.cleanStb() + input_sql, stb_name = self.genFullTypeSql() + self.resCmp(input_sql, stb_name) + s_stb_d_tb_list = self.genSqlList(stb_name=stb_name)[4] + self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_list)) + tdSql.query(f"show tables;") + tdSql.checkRows(6) + + def sStbDtbDdataAcMtInsertMultiThreadCheckCase(self): + """ + #! concurrency conflict + """ + """ + thread input same stb, different tb, different data, add col, mul tag + """ + self.cleanStb() + input_sql, stb_name = self.genFullTypeSql() + self.resCmp(input_sql, stb_name) + s_stb_d_tb_a_col_m_tag_list = self.genSqlList(stb_name=stb_name)[5] + self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_a_col_m_tag_list)) + tdSql.query(f"show tables;") + tdSql.checkRows(6) + + def sStbDtbDdataAtMcInsertMultiThreadCheckCase(self): + """ + #! concurrency conflict + """ + """ + thread input same stb, different tb, different data, add tag, mul col + """ + self.cleanStb() + input_sql, stb_name = self.genFullTypeSql() + self.resCmp(input_sql, stb_name) + s_stb_d_tb_a_tag_m_col_list = self.genSqlList(stb_name=stb_name)[6] + self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_a_tag_m_col_list)) + tdSql.query(f"show tables;") + tdSql.checkRows(6) + + def sStbStbDdataDtsInsertMultiThreadCheckCase(self): + """ + thread input same stb tb, different ts + """ + self.cleanStb() + tb_name = self.getLongName(7, "letters") + input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name) + self.resCmp(input_sql, stb_name) + s_stb_s_tb_d_ts_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[7] + self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_d_ts_list)) + tdSql.query(f"show tables;") + tdSql.checkRows(1) + tdSql.query(f"select * from {stb_name}") + tdSql.checkRows(6) + + def sStbStbDdataDtsAcMtInsertMultiThreadCheckCase(self): + """ + thread input same stb tb, different ts, add col, mul tag + """ + self.cleanStb() + tb_name = self.getLongName(7, "letters") + input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name) + self.resCmp(input_sql, stb_name) + s_stb_s_tb_d_ts_a_col_m_tag_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[8] + self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_d_ts_a_col_m_tag_list)) + tdSql.query(f"show tables;") + tdSql.checkRows(1) + tdSql.query(f"select * from {stb_name}") + tdSql.checkRows(6) + tdSql.query(f"select * from {stb_name} where t8 is not NULL") + tdSql.checkRows(6) + tdSql.query(f"select * from {tb_name} where c11 is not NULL;") + tdSql.checkRows(5) + + def sStbStbDdataDtsAtMcInsertMultiThreadCheckCase(self): + """ + thread input same stb tb, different ts, add tag, mul col + """ + self.cleanStb() + tb_name = self.getLongName(7, "letters") + input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name) + self.resCmp(input_sql, stb_name) + s_stb_s_tb_d_ts_a_tag_m_col_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[9] + self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_d_ts_a_tag_m_col_list)) + tdSql.query(f"show tables;") + tdSql.checkRows(1) + tdSql.query(f"select * from {stb_name}") + tdSql.checkRows(6) + for c in ["c7", "c8", "c9"]: + tdSql.query(f"select * from {stb_name} where {c} is NULL") + tdSql.checkRows(5) + for t in ["t10", "t11"]: + tdSql.query(f"select * from {stb_name} where {t} is not NULL;") + tdSql.checkRows(6) + + def sStbDtbDdataDtsInsertMultiThreadCheckCase(self): + """ + thread input same stb, different tb, data, ts + """ + self.cleanStb() + input_sql, stb_name = self.genFullTypeSql() + self.resCmp(input_sql, stb_name) + s_stb_d_tb_d_ts_list = self.genSqlList(stb_name=stb_name)[10] + self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_d_ts_list)) + tdSql.query(f"show tables;") + tdSql.checkRows(6) + + def sStbDtbDdataDtsAcMtInsertMultiThreadCheckCase(self): + """ + # ! concurrency conflict + """ + """ + thread input same stb, different tb, data, ts, add col, mul tag + """ + self.cleanStb() + input_sql, stb_name = self.genFullTypeSql() + self.resCmp(input_sql, stb_name) + s_stb_d_tb_d_ts_a_col_m_tag_list = self.genSqlList(stb_name=stb_name)[11] + self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_d_ts_a_col_m_tag_list)) + tdSql.query(f"show tables;") + tdSql.checkRows(6) + + def test(self): + input_sql1 = "rfasta,id=\"rfasta_1\",t0=true,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"ddzhiksj\",t8=L\"ncharTagValue\" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"bnhwlgvj\",c8=L\"ncharTagValue\",c9=7u64 1626006933640000000ns" + 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" + code = self._conn.insertLines([input_sql1]) + code = self._conn.insertLines([input_sql2]) + print(code) + # self._conn.insertLines([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.insertLines([input_sql3]) + # print(code) + # self._conn.insertLines([input_sql4]) + + def runAll(self): + self.initCheckCase() + self.boolTypeCheckCase() + self.symbolsCheckCase() + self.tsCheckCase() + self.idSeqCheckCase() + self.idUpperCheckCase() + self.noIdCheckCase() + self.maxColTagCheckCase() + self.idIllegalNameCheckCase() + self.idStartWithNumCheckCase() + self.nowTsCheckCase() + self.dateFormatTsCheckCase() + self.illegalTsCheckCase() + self.tagValueLengthCheckCase() + self.colValueLengthCheckCase() + self.tagColIllegalValueCheckCase() + self.duplicateIdTagColInsertCheckCase() + self.noIdStbExistCheckCase() + self.duplicateInsertExistCheckCase() + self.tagColBinaryNcharLengthCheckCase() + self.tagColAddDupIDCheckCase() + self.tagColAddCheckCase() + self.tagMd5Check() + self.tagColBinaryMaxLengthCheckCase() + # self.tagColNcharMaxLengthCheckCase() + self.batchInsertCheckCase() + self.multiInsertCheckCase(1000) + self.batchErrorInsertCheckCase() + # MultiThreads + self.stbInsertMultiThreadCheckCase() + self.sStbStbDdataInsertMultiThreadCheckCase() + self.sStbStbDdataAtcInsertMultiThreadCheckCase() + self.sStbStbDdataMtcInsertMultiThreadCheckCase() + self.sStbDtbDdataInsertMultiThreadCheckCase() + + # # ! concurrency conflict + # self.sStbDtbDdataAcMtInsertMultiThreadCheckCase() + # self.sStbDtbDdataAtMcInsertMultiThreadCheckCase() + + self.sStbStbDdataDtsInsertMultiThreadCheckCase() + + # # ! concurrency conflict + # self.sStbStbDdataDtsAcMtInsertMultiThreadCheckCase() + # self.sStbStbDdataDtsAtMcInsertMultiThreadCheckCase() + + self.sStbDtbDdataDtsInsertMultiThreadCheckCase() + + # ! concurrency conflict + # self.sStbDtbDdataDtsAcMtInsertMultiThreadCheckCase() + + + + def run(self): + print("running {}".format(__file__)) + self.createDb() + self.runAll() + # self.tagColIllegalValueCheckCase() + # self.test() + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py index 4a0455220637d0b2b99430008a62727a6ee70e30..b42af27d063aa9c8b08ac58374878a7153912142 100644 --- a/tests/pytest/util/sql.py +++ b/tests/pytest/util/sql.py @@ -65,7 +65,7 @@ class TDSql: self.queryResult = None tdLog.info("sql:%s, expect error occured" % (sql)) - def query(self, sql): + def query(self, sql, row_tag=None): self.sql = sql try: self.cursor.execute(sql) @@ -77,21 +77,27 @@ class TDSql: args = (caller.filename, caller.lineno, sql, repr(e)) tdLog.notice("%s(%d) failed: sql:%s, %s" % args) raise Exception(repr(e)) + if row_tag: + return self.queryResult return self.queryRows - def getColNameList(self, sql): + def getColNameList(self, sql, col_tag=None): self.sql = sql try: col_name_list = [] + col_type_list = [] self.cursor.execute(sql) self.queryCols = self.cursor.description for query_col in self.queryCols: col_name_list.append(query_col[0]) + col_type_list.append(query_col[1]) except Exception as e: caller = inspect.getframeinfo(inspect.stack()[1][0]) args = (caller.filename, caller.lineno, sql, repr(e)) tdLog.notice("%s(%d) failed: sql:%s, %s" % args) raise Exception(repr(e)) + if col_tag: + return col_name_list, col_type_list return col_name_list def waitedQuery(self, sql, expectRows, timeout): @@ -245,6 +251,22 @@ class TDSql: args = (caller.filename, caller.lineno, self.sql, col_name_list, expect_col_name_list) tdLog.exit("%s(%d) failed: sql:%s, col_name_list:%s != expect_col_name_list:%s" % args) + def checkEqual(self, elm, expect_elm): + if elm == expect_elm: + tdLog.info("sql:%s, elm:%s == expect_elm:%s" % (self.sql, elm, expect_elm)) + else: + caller = inspect.getframeinfo(inspect.stack()[1][0]) + args = (caller.filename, caller.lineno, self.sql, elm, expect_elm) + tdLog.exit("%s(%d) failed: sql:%s, elm:%s != expect_elm:%s" % args) + + def checkNotEqual(self, elm, expect_elm): + if elm != expect_elm: + tdLog.info("sql:%s, elm:%s != expect_elm:%s" % (self.sql, elm, expect_elm)) + else: + caller = inspect.getframeinfo(inspect.stack()[1][0]) + args = (caller.filename, caller.lineno, self.sql, elm, expect_elm) + tdLog.exit("%s(%d) failed: sql:%s, elm:%s == expect_elm:%s" % args) + def taosdStatus(self, state): tdLog.sleep(5) pstate = 0 diff --git a/tests/script/general/field/2.sim b/tests/script/general/field/2.sim index dc39e5ad602276e52bda3cce0e823a3deb3f124d..cc6889fd75441c9fa4913f8219ebc1b50710b0cb 100644 --- a/tests/script/general/field/2.sim +++ b/tests/script/general/field/2.sim @@ -30,7 +30,7 @@ while $i < 5 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 0, 0 ) + sql insert into $tb values (1626739200000 + $ms , 0, 0 ) $x = $x + 1 endw $i = $i + 1 @@ -41,7 +41,7 @@ while $i < 10 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 1, 1 ) + sql insert into $tb values (1626739200000 + $ms , 1, 1 ) $x = $x + 1 endw $i = $i + 1 @@ -116,103 +116,104 @@ if $rows != 100 then endi print =============== step4 -sql select * from $mt where ts > now + 4m and tbcol = 1 +# sql select * from $mt where ts > 1626739440001 and tbcol = 1 +sql select * from $mt where ts > 1626739440001 and tbcol = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol = 0 +sql select * from $mt where ts < 1626739440001 and tbcol = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 +sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001 and tbcol <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m +sql select * from $mt where ts >= 1626739440001 and tbcol <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi print =============== step5 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol2 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol2 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 +sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001 and tbcol2 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m +sql select * from $mt where ts >= 1626739440001 and tbcol2 <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi print =============== step6 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 and tbcol = 1 +sql select * from $mt where ts > 1626739440001 and tbcol2 = 1 and tbcol = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 and tbcol <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol2 <> 1 and tbcol <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 and tbcol = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0 and tbcol = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 and tbcol <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0 and tbcol <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 and tbcol = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0 and tbcol = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 and tbcol <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0 and tbcol <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 and tbcol <> 0 +sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m and ts < now + 5m and tbcol <> 0 +sql select * from $mt where ts >= 1626739440001 and tbcol2 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol <> 0 if $rows != 5 then return -1 endi @@ -246,7 +247,7 @@ if $data00 != 100 then endi print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts <= 1626739440001 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 50 then return -1 @@ -272,7 +273,7 @@ if $data00 != 100 then endi print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts <= 1626739440001 and tbcol = 1 group by tgcol print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 diff --git a/tests/script/general/field/3.sim b/tests/script/general/field/3.sim index b45e3a005b4af41494ef24cf93b130d2b41c8dc1..cb3c6621ac3723b09fba489d894657a457e12af1 100644 --- a/tests/script/general/field/3.sim +++ b/tests/script/general/field/3.sim @@ -30,7 +30,7 @@ while $i < 5 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 0, 0, 0 ) + sql insert into $tb values (1626739200000 + $ms , 0, 0, 0 ) $x = $x + 1 endw $i = $i + 1 @@ -41,7 +41,7 @@ while $i < 10 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 1, 1, 1 ) + sql insert into $tb values (1626739200000 + $ms , 1, 1, 1 ) $x = $x + 1 endw $i = $i + 1 @@ -53,19 +53,19 @@ if $rows != $totalNum then return -1 endi -sql select * from $mt where ts < now + 4m +sql select * from $mt where ts <= 1626739440001 if $rows != 50 then return -1 endi -sql select * from $mt where ts > now + 4m +sql select * from $mt where ts > 1626739440001 if $rows != 150 then return -1 endi -sql select * from $mt where ts = now + 4m +sql select * from $mt where ts = 1626739440001 if $rows != 0 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m +sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001 if $rows != 10 then return -1 endi @@ -141,239 +141,239 @@ if $rows != 100 then endi print =============== step6 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol1 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol1 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 +sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001 and tbcol1 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m +sql select * from $mt where ts >= 1626739440001 and tbcol1 <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi print =============== step7 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol2 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol2 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 +sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001 and tbcol2 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m +sql select * from $mt where ts >= 1626739440001 and tbcol2 <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi print =============== step8 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 +sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m +sql select * from $mt where ts >= 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi print =============== step9 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 and tbcol1 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol2 = 1 and tbcol1 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 and tbcol1 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol2 <> 1 and tbcol1 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 and tbcol1 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol2 = 0 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol2 <> 0 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 and tbcol1 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol1 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol2 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol1 <> 0 if $rows != 5 then return -1 endi print =============== step10 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol1 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 and tbcol1 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol1 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 and tbcol1 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol1 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol1 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 and tbcol1 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol1 <> 0 if $rows != 5 then return -1 endi print =============== step11 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol2 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 and tbcol2 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol2 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 and tbcol2 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol2 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 and tbcol2 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol2 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 and tbcol2 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol2 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 and tbcol2 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol2 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 and tbcol2 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol2 <> 0 +sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 and tbcol2 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 +sql select * from $mt where ts >= 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 if $rows != 5 then return -1 endi print =============== step12 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts >= 1626739440001 and tbcol1 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 5 then return -1 endi @@ -405,25 +405,25 @@ if $data00 != 100 then endi print =============== step15 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts <= 1626739440001 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 50 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 @@ -468,25 +468,25 @@ if $data00 != 100 then endi print =============== step18 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m group by tgcol2 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 group by tgcol2 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 group by tgcol2 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 group by tgcol2 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 group by tgcol2 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 group by tgcol2 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 diff --git a/tests/script/general/field/4.sim b/tests/script/general/field/4.sim index e219be87783cfea2f071db481a1f8eb457f20f5e..2d893da777bea8260a333a957cf6f904b95eb6d0 100644 --- a/tests/script/general/field/4.sim +++ b/tests/script/general/field/4.sim @@ -30,7 +30,7 @@ while $i < 5 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 0, 0, 0, 0 ) + sql insert into $tb values (1626739200000 + $ms , 0, 0, 0, 0 ) $x = $x + 1 endw $i = $i + 1 @@ -41,7 +41,7 @@ while $i < 10 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 1, 1, 1, 1 ) + sql insert into $tb values (1626739200000 + $ms , 1, 1, 1, 1 ) $x = $x + 1 endw $i = $i + 1 @@ -53,19 +53,19 @@ if $rows != $totalNum then return -1 endi -sql select * from $mt where ts < now + 4m +sql select * from $mt where ts < 1626739440001 if $rows != 50 then return -1 endi -sql select * from $mt where ts > now + 4m +sql select * from $mt where ts > 1626739440001 if $rows != 150 then return -1 endi -sql select * from $mt where ts = now + 4m +sql select * from $mt where ts = 1626739440001 if $rows != 0 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 if $rows != 10 then return -1 endi @@ -159,375 +159,375 @@ if $rows != 100 then endi print =============== step7 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol1 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol1 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol1 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and tbcol1 <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi print =============== step8 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol2 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol2 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol2 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol2 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol2 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and tbcol2 <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi print =============== step9 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi print =============== step10 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi print =============== step11 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 and tbcol1 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol2 = 1 and tbcol1 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 and tbcol1 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol2 <> 1 and tbcol1 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 and tbcol1 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol2 = 0 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol2 <> 0 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 and tbcol1 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol1 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol2 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol1 <> 0 if $rows != 5 then return -1 endi print =============== step12 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol1 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 and tbcol1 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol1 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 and tbcol1 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol1 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol1 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 and tbcol1 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol1 <> 0 if $rows != 5 then return -1 endi print =============== step13 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol2 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 and tbcol2 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol2 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 and tbcol2 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol2 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 and tbcol2 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol2 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 and tbcol2 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol2 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 and tbcol2 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol2 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 and tbcol2 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol2 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 and tbcol2 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 if $rows != 5 then return -1 endi print =============== step14 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol4 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 and tbcol4 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol4 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 and tbcol4 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol4 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 and tbcol4 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol4 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 and tbcol4 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol4 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 and tbcol4 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol4 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 and tbcol4 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol4 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 and tbcol4 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol4 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol4 <> 0 if $rows != 5 then return -1 endi print =============== step15 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol1 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 5 then return -1 endi print =============== step16 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 5 then return -1 endi print =============== step17 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 if $rows != 5 then return -1 endi @@ -565,31 +565,31 @@ if $data00 != 100 then endi print =============== step20 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 50 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 @@ -646,31 +646,31 @@ if $data00 != 100 then endi print =============== step23 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m group by tgcol2 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 group by tgcol2 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 group by tgcol2 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 group by tgcol2 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 group by tgcol2 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 group by tgcol2 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol2 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol2 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 diff --git a/tests/script/general/field/5.sim b/tests/script/general/field/5.sim index e02bbd122ff00a0f727ff8706e4a5cc3cf28a57b..e1421bdb4f9e25b37deeafe699feb1ce8c0f6c0a 100644 --- a/tests/script/general/field/5.sim +++ b/tests/script/general/field/5.sim @@ -30,7 +30,7 @@ while $i < 5 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 0, 0, 0, 0, 0 ) + sql insert into $tb values (1626739200000 + $ms , 0, 0, 0, 0, 0 ) $x = $x + 1 endw $i = $i + 1 @@ -41,7 +41,7 @@ while $i < 10 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 1, 1, 1, 1, 1 ) + sql insert into $tb values (1626739200000 + $ms , 1, 1, 1, 1, 1 ) $x = $x + 1 endw $i = $i + 1 @@ -53,19 +53,19 @@ if $rows != $totalNum then return -1 endi -sql select * from $mt where ts < now + 4m +sql select * from $mt where ts < 1626739440001 if $rows != 50 then return -1 endi -sql select * from $mt where ts > now + 4m +sql select * from $mt where ts > 1626739440001 if $rows != 150 then return -1 endi -sql select * from $mt where ts = now + 4m +sql select * from $mt where ts = 1626739440001 if $rows != 0 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 if $rows != 10 then return -1 endi @@ -177,443 +177,443 @@ if $rows != 100 then endi print =============== step8 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol1 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol1 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol1 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and tbcol1 <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi print =============== step9 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol2 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol2 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol2 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol2 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol2 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and tbcol2 <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi print =============== step10 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi print =============== step11 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi print =============== step12 -sql select * from $mt where ts > now + 4m and tbcol5 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol5 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol5 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol5 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol5 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol5 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol5 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol5 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol5 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol5 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol5 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol5 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol5 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 0 and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and tbcol5 <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi print =============== step13 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 and tbcol1 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol2 = 1 and tbcol1 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 and tbcol1 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol2 <> 1 and tbcol1 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 and tbcol1 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol2 = 0 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol2 <> 0 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 and tbcol1 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol1 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol2 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol1 <> 0 if $rows != 5 then return -1 endi print =============== step14 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol2 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 and tbcol2 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol2 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 and tbcol2 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol2 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 and tbcol2 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol2 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 and tbcol2 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol2 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 and tbcol2 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol2 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 and tbcol2 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol2 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 and tbcol2 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 if $rows != 5 then return -1 endi print =============== step15 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol4 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 and tbcol4 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol4 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 and tbcol4 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol4 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 and tbcol4 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol4 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 and tbcol4 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol4 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 and tbcol4 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol4 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 and tbcol4 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol4 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 and tbcol4 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol4 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol4 <> 0 if $rows != 5 then return -1 endi print =============== step16 -sql select * from $mt where ts > now + 4m and tbcol5 = 1 and tbcol4 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol5 = 1 and tbcol4 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 1 and tbcol4 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol5 <> 1 and tbcol4 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol5 = 0 and tbcol4 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol5 = 0 and tbcol4 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol5 <> 0 and tbcol4 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol5 <> 0 and tbcol4 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol5 = 0 and tbcol4 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol5 = 0 and tbcol4 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol5 <> 0 and tbcol4 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol5 <> 0 and tbcol4 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol5 <> 0 and tbcol4 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol5 <> 0 and tbcol4 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 0 and ts < now + 5m and ts < now + 5m and tbcol4 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol5 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol4 <> 0 if $rows != 5 then return -1 endi print =============== step17 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol1 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 5 then return -1 endi print =============== step18 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 5 then return -1 endi print =============== step19 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 if $rows != 5 then return -1 endi print =============== step20 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 and tbcol5 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 and tbcol5 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 and tbcol5 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 and tbcol5 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 if $rows != 5 then return -1 endi @@ -657,37 +657,37 @@ if $data00 != 100 then endi print =============== step23 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 50 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 @@ -756,37 +756,37 @@ if $data00 != 100 then endi print =============== step26 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m group by tgcol2 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 group by tgcol2 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 group by tgcol2 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 group by tgcol2 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 group by tgcol2 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 group by tgcol2 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol2 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol2 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 group by tgcol2 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 group by tgcol2 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 diff --git a/tests/script/general/field/6.sim b/tests/script/general/field/6.sim index a852230cea7fd53f1fbc8e6cd44a67ba137ab3b3..27475d591fc6acaffb4e1f985f59d9a3c8778df5 100644 --- a/tests/script/general/field/6.sim +++ b/tests/script/general/field/6.sim @@ -30,7 +30,7 @@ while $i < 5 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 0, 0, 0, 0, 0, 0 ) + sql insert into $tb values (1626739200000 + $ms , 0, 0, 0, 0, 0, 0 ) $x = $x + 1 endw $i = $i + 1 @@ -41,7 +41,7 @@ while $i < 10 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 1, 1, 1, 1, 1, 1 ) + sql insert into $tb values (1626739200000 + $ms , 1, 1, 1, 1, 1, 1 ) $x = $x + 1 endw $i = $i + 1 @@ -53,19 +53,19 @@ if $rows != $totalNum then return -1 endi -sql select * from $mt where ts < now + 4m +sql select * from $mt where ts < 1626739440001 if $rows != 50 then return -1 endi -sql select * from $mt where ts > now + 4m +sql select * from $mt where ts > 1626739440001 if $rows != 150 then return -1 endi -sql select * from $mt where ts = now + 4m +sql select * from $mt where ts = 1626739440001 if $rows != 0 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 if $rows != 10 then return -1 endi @@ -195,545 +195,545 @@ if $rows != 100 then endi print =============== step9 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol1 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol1 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol1 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and tbcol1 <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi print =============== step10 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol2 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol2 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol2 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol2 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol2 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and tbcol2 <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi print =============== step11 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi print =============== step12 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi print =============== step13 -sql select * from $mt where ts > now + 4m and tbcol5 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol5 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol5 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol5 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol5 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol5 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol5 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol5 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol5 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol5 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol5 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol5 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol5 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 0 and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and tbcol5 <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi print =============== step14 -sql select * from $mt where ts > now + 4m and tbcol6 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol6 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol6 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol6 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol6 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol6 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol6 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol6 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol6 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol6 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol6 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol6 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol6 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol6 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol6 <> 0 and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and tbcol6 <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi print =============== step15 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 and tbcol1 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol2 = 1 and tbcol1 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 and tbcol1 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol2 <> 1 and tbcol1 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 and tbcol1 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol2 = 0 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol2 <> 0 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 and tbcol1 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol1 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol2 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol1 <> 0 if $rows != 5 then return -1 endi print =============== step16 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol2 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 and tbcol2 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol2 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 and tbcol2 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol2 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 and tbcol2 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol2 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 and tbcol2 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol2 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 and tbcol2 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol2 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 and tbcol2 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol2 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 and tbcol2 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 if $rows != 5 then return -1 endi print =============== step17 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol4 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 and tbcol4 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol4 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 and tbcol4 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol4 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 and tbcol4 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol4 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 and tbcol4 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol4 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 and tbcol4 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol4 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 and tbcol4 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol4 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 and tbcol4 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol4 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol4 <> 0 if $rows != 5 then return -1 endi print =============== step18 -sql select * from $mt where ts > now + 4m and tbcol5 = 1 and tbcol4 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol5 = 1 and tbcol4 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 1 and tbcol4 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol5 <> 1 and tbcol4 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol5 = 0 and tbcol4 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol5 = 0 and tbcol4 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol5 <> 0 and tbcol4 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol5 <> 0 and tbcol4 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol5 = 0 and tbcol4 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol5 = 0 and tbcol4 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol5 <> 0 and tbcol4 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol5 <> 0 and tbcol4 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol5 <> 0 and tbcol4 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol5 <> 0 and tbcol4 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 0 and ts < now + 5m and ts < now + 5m and tbcol4 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol5 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol4 <> 0 if $rows != 5 then return -1 endi print =============== step19 -sql select * from $mt where ts > now + 4m and tbcol5 = 1 and tbcol6 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol5 = 1 and tbcol6 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 1 and tbcol6 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol5 <> 1 and tbcol6 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol5 = 0 and tbcol6 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol5 = 0 and tbcol6 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol5 <> 0 and tbcol6 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol5 <> 0 and tbcol6 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol5 = 0 and tbcol6 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol5 = 0 and tbcol6 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol5 <> 0 and tbcol6 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol5 <> 0 and tbcol6 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol5 <> 0 and tbcol6 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol5 <> 0 and tbcol6 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 0 and ts < now + 5m and ts < now + 5m and tbcol6 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol5 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol6 <> 0 if $rows != 5 then return -1 endi print =============== step20 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol1 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 5 then return -1 endi print =============== step21 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0 if $rows != 5 then return -1 endi print =============== step22 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 if $rows != 5 then return -1 endi print =============== step23 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 and tbcol5 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 and tbcol5 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 and tbcol5 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 and tbcol5 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 if $rows != 5 then return -1 endi print =============== step24 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 and tbcol5 = 1 and tbcol6 = 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 and tbcol5 = 1 and tbcol6 = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 and tbcol5 <> 1 and tbcol6 <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 and tbcol5 <> 1 and tbcol6 <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 and tbcol6 = 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 and tbcol6 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 and tbcol6 = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 and tbcol6 = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0 +sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0 if $rows != 5 then return -1 endi @@ -783,43 +783,43 @@ if $data00 != 100 then endi print =============== step27 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 50 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 and tbcol6 = 1 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 and tbcol6 = 1 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 @@ -900,43 +900,43 @@ if $data00 != 100 then endi print =============== step30 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m group by tgcol2 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 group by tgcol2 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 group by tgcol2 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 group by tgcol2 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 group by tgcol2 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 group by tgcol2 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol2 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol2 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 group by tgcol2 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 group by tgcol2 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 endi -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 and tbcol6 = 1 group by tgcol2 +sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 and tbcol6 = 1 group by tgcol2 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 diff --git a/tests/script/general/field/bigint.sim b/tests/script/general/field/bigint.sim index 538f966c49cc3eefb8516c4bac4a49b9efd78d37..cfe8c561f0d852133267f7dd597f7796aee951f0 100644 --- a/tests/script/general/field/bigint.sim +++ b/tests/script/general/field/bigint.sim @@ -30,7 +30,7 @@ while $i < 5 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 0 ) + sql insert into $tb values (1626739200000 + $ms , 0 ) $x = $x + 1 endw $i = $i + 1 @@ -41,7 +41,7 @@ while $i < 10 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 1 ) + sql insert into $tb values (1626739200000 + $ms , 1 ) $x = $x + 1 endw $i = $i + 1 @@ -82,35 +82,35 @@ if $rows != 100 then endi print =============== step3 -sql select * from $mt where ts > now + 4m and tbcol = 1 +sql select * from $mt where ts > 1626739440001 and tbcol = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol = 0 +sql select * from $mt where ts < 1626739440001 and tbcol = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and tbcol <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi @@ -139,7 +139,7 @@ if $data00 != 100 then endi print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1626739440001 and tbcol = 1 group by tgcol print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 diff --git a/tests/script/general/field/binary.sim b/tests/script/general/field/binary.sim index d601750b0d96b94bd60751de62c7fd139e1882be..821dbc9a82f7d8e6e21be419d6c28a7b67f1271d 100644 --- a/tests/script/general/field/binary.sim +++ b/tests/script/general/field/binary.sim @@ -30,7 +30,7 @@ while $i < 5 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , '0' ) + sql insert into $tb values (1626739200000 + $ms , '0' ) $x = $x + 1 endw $i = $i + 1 @@ -41,7 +41,7 @@ while $i < 10 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , '1' ) + sql insert into $tb values (1626739200000 + $ms , '1' ) $x = $x + 1 endw $i = $i + 1 @@ -55,14 +55,14 @@ if $rows != 100 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol = '1' +sql select * from $mt where ts > 1626739440001 and tbcol = '1' if $rows != 75 then return -1 endi print select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' group by tgcol -sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = '1' group by tgcol +sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1626739440001 and tbcol = '1' group by tgcol sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' interval(1d) group by tgcol #can't filter binary fields diff --git a/tests/script/general/field/bool.sim b/tests/script/general/field/bool.sim index 796ed4e0aaa4c1b0b61462ef95ffaf98a671f2ed..d94071b3282613a51c7580fc23f0bdc700cea03f 100644 --- a/tests/script/general/field/bool.sim +++ b/tests/script/general/field/bool.sim @@ -30,7 +30,7 @@ while $i < 5 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 0 ) + sql insert into $tb values (1626739200000 + $ms , 0 ) $x = $x + 1 endw $i = $i + 1 @@ -41,7 +41,7 @@ while $i < 10 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 1 ) + sql insert into $tb values (1626739200000 + $ms , 1 ) $x = $x + 1 endw $i = $i + 1 @@ -82,35 +82,35 @@ if $rows != 100 then endi print =============== step3 -sql select * from $mt where ts > now + 4m and tbcol = true +sql select * from $mt where ts > 1626739440001 and tbcol = true if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol <> true +sql select * from $mt where ts > 1626739440001 and tbcol <> true if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol = false +sql select * from $mt where ts < 1626739440001 and tbcol = false if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol <> false +sql select * from $mt where ts < 1626739440001 and tbcol <> false if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol = false +sql select * from $mt where ts <= 1626739440001 and tbcol = false if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol <> false +sql select * from $mt where ts <= 1626739440001 and tbcol <> false if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> false +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol <> false if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol <> false and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and tbcol <> false and ts < 1626739500001 if $rows != 5 then return -1 endi @@ -137,7 +137,7 @@ if $data00 != 100 then endi print =============== step7 -sql select count(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = true group by tgcol +sql select count(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1626739440001 and tbcol = true group by tgcol print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 diff --git a/tests/script/general/field/double.sim b/tests/script/general/field/double.sim index ef86585e5f69fdd63c417ef823a57f3502436e40..0c9c23e3047466da264fd2ac3b2624ff22a5d0b0 100644 --- a/tests/script/general/field/double.sim +++ b/tests/script/general/field/double.sim @@ -30,7 +30,7 @@ while $i < 5 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 0 ) + sql insert into $tb values (1626739200000 + $ms , 0 ) $x = $x + 1 endw $i = $i + 1 @@ -41,7 +41,7 @@ while $i < 10 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 1 ) + sql insert into $tb values (1626739200000 + $ms , 1 ) $x = $x + 1 endw $i = $i + 1 @@ -82,35 +82,35 @@ if $rows != 100 then endi print =============== step3 -sql select * from $mt where ts > now + 4m and tbcol = 1 +sql select * from $mt where ts > 1626739440001 and tbcol = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol = 0 +sql select * from $mt where ts < 1626739440001 and tbcol = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and tbcol <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi @@ -137,7 +137,7 @@ if $data00 != 100 then endi print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1626739440001 and tbcol = 1 group by tgcol print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 diff --git a/tests/script/general/field/float.sim b/tests/script/general/field/float.sim index a01bcbdd4ca2a7a7b7009ded641cd88357fbcc07..00423c00b8515bafb7974604e1211c15868512d7 100644 --- a/tests/script/general/field/float.sim +++ b/tests/script/general/field/float.sim @@ -30,7 +30,7 @@ while $i < 5 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 0 ) + sql insert into $tb values (1626739200000 + $ms , 0 ) $x = $x + 1 endw $i = $i + 1 @@ -41,7 +41,7 @@ while $i < 10 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 1 ) + sql insert into $tb values (1626739200000 + $ms , 1 ) $x = $x + 1 endw $i = $i + 1 @@ -82,35 +82,35 @@ if $rows != 100 then endi print =============== step3 -sql select * from $mt where ts > now + 4m and tbcol = 1 +sql select * from $mt where ts > 1626739440001 and tbcol = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol = 0 +sql select * from $mt where ts < 1626739440001 and tbcol = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and tbcol <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi @@ -137,7 +137,7 @@ if $data00 != 100 then endi print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1626739440001 and tbcol = 1 group by tgcol print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 diff --git a/tests/script/general/field/int.sim b/tests/script/general/field/int.sim index c04fe5d2b1d4cc2d43de0111d3e22dcd177fa8fc..0e322e4f120d6eef933023467d1246a127780529 100644 --- a/tests/script/general/field/int.sim +++ b/tests/script/general/field/int.sim @@ -30,7 +30,7 @@ while $i < 5 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 0 ) + sql insert into $tb values (1626739200000 + $ms , 0 ) $x = $x + 1 endw $i = $i + 1 @@ -41,7 +41,7 @@ while $i < 10 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 1 ) + sql insert into $tb values (1626739200000 + $ms , 1 ) $x = $x + 1 endw $i = $i + 1 @@ -82,35 +82,35 @@ if $rows != 100 then endi print =============== step3 -sql select * from $mt where ts > now + 4m and tbcol = 1 +sql select * from $mt where ts > 1626739440001 and tbcol = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol = 0 +sql select * from $mt where ts < 1626739440001 and tbcol = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and tbcol <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi @@ -137,7 +137,7 @@ if $data00 != 100 then endi print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1626739440001 and tbcol = 1 group by tgcol print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 diff --git a/tests/script/general/field/single.sim b/tests/script/general/field/single.sim index 0cfb92aad5c795e14a304146419a97157176c3ac..3f6bf4309fac7ce45577094f3316c34edcd954c1 100644 --- a/tests/script/general/field/single.sim +++ b/tests/script/general/field/single.sim @@ -25,7 +25,7 @@ sql create table $tb (ts timestamp, tbcol int) $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , $x ) + sql insert into $tb values (1626739200000 + $ms , $x ) $x = $x + 1 endw @@ -111,18 +111,18 @@ if $rows != 0 then endi print =============== step3 -sql select * from $tb where ts < now + 4m +sql select * from $tb where ts < 1626739440001 if $rows != 5 then return -1 endi -sql select * from $tb where tbcol = 10 and ts < now + 4m -print select * from $tb where tbcol = 10 and ts < now + 4m +sql select * from $tb where tbcol = 10 and ts < 1626739440001 +print select * from $tb where tbcol = 10 and ts < 1626739440001 if $rows != 0 then return -1 endi -sql select * from $tb where tbcol = 4 and ts < now + 4m order by ts desc +sql select * from $tb where tbcol = 4 and ts < 1626739440001 order by ts desc if $rows != 1 then return -1 endi @@ -130,7 +130,7 @@ if $data01 != 4 then return -1 endi -sql select * from $tb where tbcol < 10 and ts < now + 4m order by ts desc +sql select * from $tb where tbcol < 10 and ts < 1626739440001 order by ts desc if $rows != 5 then return -1 endi @@ -138,7 +138,7 @@ if $data01 != 4 then return -1 endi -sql select * from $tb where tbcol < 10 and ts > now + 4m and ts < now + 5m order by ts desc +sql select * from $tb where tbcol < 10 and ts > 1626739440001 and ts < 1626739500001 order by ts desc print $rows $data00 $data01 if $rows != 1 then return -1 @@ -183,27 +183,27 @@ sql select count(*) from $tb where tbcol < 10 and tbcol > 5 order by ts asc -x s step4: print =============== step5 -sql select count(*) from $tb where ts < now + 4m +sql select count(*) from $tb where ts < 1626739440001 if $data00 != 5 then return -1 endi -#sql select count(*) from $tb where tbcol = 10 and ts < now + 4m +#sql select count(*) from $tb where tbcol = 10 and ts < 1626739440001 #if $data00 != 0 then # return -1 #endi -sql select count(*) from $tb where tbcol = 4 and ts < now + 4m +sql select count(*) from $tb where tbcol = 4 and ts < 1626739440001 if $data00 != 1 then return -1 endi -sql select count(*) from $tb where tbcol < 10 and ts < now + 4m +sql select count(*) from $tb where tbcol < 10 and ts < 1626739440001 if $data00 != 5 then return -1 endi -sql select count(*) from $tb where tbcol < 10 and ts > now + 4m and ts < now + 5m +sql select count(*) from $tb where tbcol < 10 and ts > 1626739440001 and ts < 1626739500001 if $data00 != 1 then return -1 endi diff --git a/tests/script/general/field/smallint.sim b/tests/script/general/field/smallint.sim index 1d5566812efcd8e59ccc339e53577246c61c7a63..78b2b998cfa56f368b1480716dabe8be38a45b9a 100644 --- a/tests/script/general/field/smallint.sim +++ b/tests/script/general/field/smallint.sim @@ -30,7 +30,7 @@ while $i < 5 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 0 ) + sql insert into $tb values (1626739200000 + $ms , 0 ) $x = $x + 1 endw $i = $i + 1 @@ -41,7 +41,7 @@ while $i < 10 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 1 ) + sql insert into $tb values (1626739200000 + $ms , 1 ) $x = $x + 1 endw $i = $i + 1 @@ -82,35 +82,35 @@ if $rows != 100 then endi print =============== step3 -sql select * from $mt where ts > now + 4m and tbcol = 1 +sql select * from $mt where ts > 1626739440001 and tbcol = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol = 0 +sql select * from $mt where ts < 1626739440001 and tbcol = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and tbcol <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi @@ -137,7 +137,7 @@ if $data00 != 100 then endi print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1626739440001 and tbcol = 1 group by tgcol print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 diff --git a/tests/script/general/field/tinyint.sim b/tests/script/general/field/tinyint.sim index f10e3d293a9d847f4f71a585603598a69ddc5e1c..7e1a0c6e80022435a50c48398ee9098ce9ec43aa 100644 --- a/tests/script/general/field/tinyint.sim +++ b/tests/script/general/field/tinyint.sim @@ -31,7 +31,7 @@ while $i < 5 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 0 ) + sql insert into $tb values (1626739200000 + $ms , 0 ) $x = $x + 1 endw $i = $i + 1 @@ -42,7 +42,7 @@ while $i < 10 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 1 ) + sql insert into $tb values (1626739200000 + $ms , 1 ) $x = $x + 1 endw $i = $i + 1 @@ -83,35 +83,35 @@ if $rows != 100 then endi print =============== step3 -sql select * from $mt where ts > now + 4m and tbcol = 1 +sql select * from $mt where ts > 1626739440001 and tbcol = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol = 0 +sql select * from $mt where ts < 1626739440001 and tbcol = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and tbcol <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi @@ -138,7 +138,7 @@ if $data00 != 100 then endi print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1626739440001 and tbcol = 1 group by tgcol print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 diff --git a/tests/script/general/field/unsigined_bigint.sim b/tests/script/general/field/unsigined_bigint.sim index 1cfe8ad15b31f38d2fc72d429a0c9af2cb5732fb..260128b5c2476911e8e1d809e63c7f89b4fd300a 100644 --- a/tests/script/general/field/unsigined_bigint.sim +++ b/tests/script/general/field/unsigined_bigint.sim @@ -31,11 +31,11 @@ while $i < 5 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 0 ) + sql insert into $tb values (1626739200000 + $ms , 0 ) $x = $x + 1 - sql_error insert into $tb values (now + $ms , -10) - sql_error insert into $tb values (now + $ms , -1000) - sql_error insert into $tb values (now + $ms , -10000000) + sql_error insert into $tb values (1626739200000 + $ms , -10) + sql_error insert into $tb values (1626739200000 + $ms , -1000) + sql_error insert into $tb values (1626739200000 + $ms , -10000000) endw $i = $i + 1 endw @@ -45,7 +45,7 @@ while $i < 10 $x = 0 while $x < $rowNum $ms = $x . m - sql insert into $tb values (now + $ms , 1 ) + sql insert into $tb values (1626739200000 + $ms , 1 ) $x = $x + 1 endw $i = $i + 1 @@ -86,35 +86,35 @@ if $rows != 100 then endi print =============== step3 -sql select * from $mt where ts > now + 4m and tbcol = 1 +sql select * from $mt where ts > 1626739440001 and tbcol = 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol <> 1 +sql select * from $mt where ts > 1626739440001 and tbcol <> 1 if $rows != 75 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol = 0 +sql select * from $mt where ts < 1626739440001 and tbcol = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts < now + 4m and tbcol <> 0 +sql select * from $mt where ts < 1626739440001 and tbcol <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol = 0 +sql select * from $mt where ts <= 1626739440001 and tbcol = 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts <= now + 4m and tbcol <> 0 +sql select * from $mt where ts <= 1626739440001 and tbcol <> 0 if $rows != 25 then return -1 endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 +sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol <> 0 if $rows != 5 then return -1 endi -sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m +sql select * from $mt where ts > 1626739440001 and tbcol <> 0 and ts < 1626739500001 if $rows != 5 then return -1 endi @@ -143,7 +143,7 @@ if $data00 != 100 then endi print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1626739440001 and tbcol = 1 group by tgcol print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 25 then return -1 diff --git a/tests/script/general/tag/3.sim b/tests/script/general/rm_bak/tag/3.sim similarity index 100% rename from tests/script/general/tag/3.sim rename to tests/script/general/rm_bak/tag/3.sim diff --git a/tests/script/general/tag/4.sim b/tests/script/general/rm_bak/tag/4.sim similarity index 100% rename from tests/script/general/tag/4.sim rename to tests/script/general/rm_bak/tag/4.sim diff --git a/tests/script/general/tag/5.sim b/tests/script/general/rm_bak/tag/5.sim similarity index 100% rename from tests/script/general/tag/5.sim rename to tests/script/general/rm_bak/tag/5.sim diff --git a/tests/script/general/tag/6.sim b/tests/script/general/rm_bak/tag/6.sim similarity index 100% rename from tests/script/general/tag/6.sim rename to tests/script/general/rm_bak/tag/6.sim diff --git a/tests/script/general/tag/add.sim b/tests/script/general/rm_bak/tag/add.sim similarity index 100% rename from tests/script/general/tag/add.sim rename to tests/script/general/rm_bak/tag/add.sim diff --git a/tests/script/general/tag/bigint.sim b/tests/script/general/rm_bak/tag/bigint.sim similarity index 100% rename from tests/script/general/tag/bigint.sim rename to tests/script/general/rm_bak/tag/bigint.sim diff --git a/tests/script/general/tag/binary.sim b/tests/script/general/rm_bak/tag/binary.sim similarity index 100% rename from tests/script/general/tag/binary.sim rename to tests/script/general/rm_bak/tag/binary.sim diff --git a/tests/script/general/tag/binary_binary.sim b/tests/script/general/rm_bak/tag/binary_binary.sim similarity index 100% rename from tests/script/general/tag/binary_binary.sim rename to tests/script/general/rm_bak/tag/binary_binary.sim diff --git a/tests/script/general/tag/bool.sim b/tests/script/general/rm_bak/tag/bool.sim similarity index 100% rename from tests/script/general/tag/bool.sim rename to tests/script/general/rm_bak/tag/bool.sim diff --git a/tests/script/general/tag/bool_binary.sim b/tests/script/general/rm_bak/tag/bool_binary.sim similarity index 100% rename from tests/script/general/tag/bool_binary.sim rename to tests/script/general/rm_bak/tag/bool_binary.sim diff --git a/tests/script/general/tag/bool_int.sim b/tests/script/general/rm_bak/tag/bool_int.sim similarity index 100% rename from tests/script/general/tag/bool_int.sim rename to tests/script/general/rm_bak/tag/bool_int.sim diff --git a/tests/script/general/tag/change.sim b/tests/script/general/rm_bak/tag/change.sim similarity index 100% rename from tests/script/general/tag/change.sim rename to tests/script/general/rm_bak/tag/change.sim diff --git a/tests/script/general/tag/column.sim b/tests/script/general/rm_bak/tag/column.sim similarity index 100% rename from tests/script/general/tag/column.sim rename to tests/script/general/rm_bak/tag/column.sim diff --git a/tests/script/general/tag/commit.sim b/tests/script/general/rm_bak/tag/commit.sim similarity index 100% rename from tests/script/general/tag/commit.sim rename to tests/script/general/rm_bak/tag/commit.sim diff --git a/tests/script/general/tag/create.sim b/tests/script/general/rm_bak/tag/create.sim similarity index 100% rename from tests/script/general/tag/create.sim rename to tests/script/general/rm_bak/tag/create.sim diff --git a/tests/script/general/tag/delete.sim b/tests/script/general/rm_bak/tag/delete.sim similarity index 100% rename from tests/script/general/tag/delete.sim rename to tests/script/general/rm_bak/tag/delete.sim diff --git a/tests/script/general/tag/double.sim b/tests/script/general/rm_bak/tag/double.sim similarity index 100% rename from tests/script/general/tag/double.sim rename to tests/script/general/rm_bak/tag/double.sim diff --git a/tests/script/general/tag/filter.sim b/tests/script/general/rm_bak/tag/filter.sim similarity index 100% rename from tests/script/general/tag/filter.sim rename to tests/script/general/rm_bak/tag/filter.sim diff --git a/tests/script/general/tag/float.sim b/tests/script/general/rm_bak/tag/float.sim similarity index 100% rename from tests/script/general/tag/float.sim rename to tests/script/general/rm_bak/tag/float.sim diff --git a/tests/script/general/tag/int.sim b/tests/script/general/rm_bak/tag/int.sim similarity index 100% rename from tests/script/general/tag/int.sim rename to tests/script/general/rm_bak/tag/int.sim diff --git a/tests/script/general/tag/int_binary.sim b/tests/script/general/rm_bak/tag/int_binary.sim similarity index 100% rename from tests/script/general/tag/int_binary.sim rename to tests/script/general/rm_bak/tag/int_binary.sim diff --git a/tests/script/general/tag/int_float.sim b/tests/script/general/rm_bak/tag/int_float.sim similarity index 100% rename from tests/script/general/tag/int_float.sim rename to tests/script/general/rm_bak/tag/int_float.sim diff --git a/tests/script/general/tag/set.sim b/tests/script/general/rm_bak/tag/set.sim similarity index 100% rename from tests/script/general/tag/set.sim rename to tests/script/general/rm_bak/tag/set.sim diff --git a/tests/script/general/tag/smallint.sim b/tests/script/general/rm_bak/tag/smallint.sim similarity index 100% rename from tests/script/general/tag/smallint.sim rename to tests/script/general/rm_bak/tag/smallint.sim diff --git a/tests/script/general/tag/testSuite.sim b/tests/script/general/rm_bak/tag/testSuite.sim similarity index 100% rename from tests/script/general/tag/testSuite.sim rename to tests/script/general/rm_bak/tag/testSuite.sim diff --git a/tests/script/general/tag/tinyint.sim b/tests/script/general/rm_bak/tag/tinyint.sim similarity index 100% rename from tests/script/general/tag/tinyint.sim rename to tests/script/general/rm_bak/tag/tinyint.sim diff --git a/tests/script/general/stream/agg_stream.sim b/tests/script/general/stream/agg_stream.sim index 65657fc33be88152040ce68c46d559e8b2c119a5..548f59cab7e6b3a81c5b01a62e02456f3c209720 100644 --- a/tests/script/general/stream/agg_stream.sim +++ b/tests/script/general/stream/agg_stream.sim @@ -20,7 +20,7 @@ print =============== step2 sql create database d4 precision 'us' sql use d4 sql create table t1 (ts timestamp, i int) -sql insert into d4.t1 values(now, 1) +sql insert into d4.t1 values(1626739200000, 1) sql create table d4.s001 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd) from log.dn_192_168_0_1 interval(5s) sql create table d4.s002 as select count(mem_taosd), count(mem_system), avg(mem_taosd), avg(mem_system), sum(mem_taosd), max(mem_taosd), min(mem_taosd) from log.dn_192_168_0_1 interval(5s) diff --git a/tests/script/general/stream/column_stream.sim b/tests/script/general/stream/column_stream.sim index c43ca1fd5ac7cfc5e477c970b313414469e9a29c..59a65f0969ebc6e2fd6d62c5b3fcc1bf66c420b7 100644 --- a/tests/script/general/stream/column_stream.sim +++ b/tests/script/general/stream/column_stream.sim @@ -23,7 +23,7 @@ print =============== step2 sql create database d4 precision 'us' sql use d4 sql create table t1 (ts timestamp, i int) -sql insert into d4.t1 values(now, 1) +sql insert into d4.t1 values(1626739200000, 1) sql create table d4.s1 as select count(cpu_taosd), count(cpu_system), avg(cpu_taosd), avg(cpu_system), sum(cpu_taosd), max(cpu_taosd), min(cpu_taosd), stddev(cpu_taosd), count(*) as c1, count(*) as c2, count(*) as c3, count(*) as c4, count(*) as c5, count(*) as c6, count(*) as c7, count(*) as c8, count(*) as c9, count(*) as c10, count(*) as c11, count(*) as c12, count(*) as c13, count(*) as c14, count(*) as c15, count(*) as c16, count(*) as c17, count(*) as c18, count(*) as c19, count(*) as c20, count(*) as c21, count(*) as c22, count(*) as c23, count(*) as c24, count(*) as c25, count(*) as c26, count(*) as c27, count(*) as c28, count(*) as c29, count(*) as c30 from log.dn_192_168_0_1 interval(5s) diff --git a/tests/script/general/stream/metrics_replica1_vnoden.sim b/tests/script/general/stream/metrics_replica1_vnoden.sim index 4629063c4460c10dccc844b6b39e512012638379..db1044a597510048c4b812d8a3a16d53ff4e5ac0 100644 --- a/tests/script/general/stream/metrics_replica1_vnoden.sim +++ b/tests/script/general/stream/metrics_replica1_vnoden.sim @@ -37,11 +37,11 @@ while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - $x = -1440 + $x = -400 $y = 0 while $y < $rowNum $ms = $x . m - sql insert into $tb values (now $ms , $y , $y ) + sql insert into $tb values (1626739200000 $ms , $y , $y ) $x = $x + 1 $y = $y + 1 endw @@ -143,14 +143,14 @@ $st = $stPrefix . la sql create table $st as select last(tbcol) from $mt interval(1d) print =============== step11 wh -sql select count(tbcol) from $mt where ts < now + 4m interval(1d) -print select count(tbcol) from $mt where ts < now + 4m interval(1d) ===> $data00 $data01 +sql select count(tbcol) from $mt where ts < 1626739440001 interval(1d) +print select count(tbcol) from $mt where ts < 1626739440000 interval(1d) ===> $data00 $data01 if $data01 != 200 then return -1 endi $st = $stPrefix . wh -#sql create table $st as select count(tbcol) from $mt where ts < now + 4m interval(1d) +#sql create table $st as select count(tbcol) from $mt where ts < 1626739200000 + 4m interval(1d) print =============== step12 as sql select count(tbcol) from $mt interval(1d) diff --git a/tests/script/general/stream/restart_stream.sim b/tests/script/general/stream/restart_stream.sim index c8be10103d16a856fb0c083546cfaf8b939a1b98..62e47f9b3a6c12668409293769ee7c5a12a718ac 100644 --- a/tests/script/general/stream/restart_stream.sim +++ b/tests/script/general/stream/restart_stream.sim @@ -34,11 +34,11 @@ while $i < 10 $tb = $tbPrefix . $i sql create table $tb using $mt tags( 0 ) - $x = -1440 + $x = -400 $y = 0 while $y < $rowNum - $ms = $x . m - sql insert into $tb values (now $ms , $y , $y ) + $ms = $x . m + sql insert into $tb values (1626739200000 $ms , $y , $y ) $x = $x + 1 $y = $y + 1 endw @@ -54,7 +54,7 @@ sql select count(*) from $tb interval(1d) print ===>rows $rows, data $data01 if $rows != 1 then return -1 -endi +endi if $data01 != 20 then return -1 endi @@ -114,11 +114,11 @@ while $i < 5 $tb = $tbPrefix . $i sql create table $tb using $mt tags( 0 ) - $x = -1440 + $x = -400 $y = 0 while $y < $rowNum $ms = $x . m - sql insert into $tb values (now $ms , $y , $y ) + sql insert into $tb values (1626739200000 $ms , $y , $y ) $x = $x + 1 $y = $y + 1 endw diff --git a/tests/script/general/stream/stream_3.sim b/tests/script/general/stream/stream_3.sim index 31490dc5ac44b93f0daf02cd0ba3b4d77a3be20b..b043993814db2ea5bf8c6a3513317efca50b51d3 100644 --- a/tests/script/general/stream/stream_3.sim +++ b/tests/script/general/stream/stream_3.sim @@ -34,11 +34,11 @@ while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - $x = -1440 + $x = -400 $y = 0 while $y < $rowNum $ms = $x . m - sql insert into $tb values (now $ms , $y , $y ) + sql insert into $tb values (1626739200000 $ms , $y , $y ) $x = $x + 1 $y = $y + 1 endw @@ -139,11 +139,11 @@ while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - $x = -1440 + $x = -400 $y = 0 while $y < $rowNum $ms = $x . m - sql insert into $tb values (now $ms , $y , $y ) + sql insert into $tb values (1626739200000 $ms , $y , $y ) $x = $x + 1 $y = $y + 1 endw diff --git a/tests/script/general/stream/stream_restart.sim b/tests/script/general/stream/stream_restart.sim index 4bf6760703ef744572a0b172cb860141f8768ff5..54a60a00811de0253d1ad1110b69f2587f707aa1 100644 --- a/tests/script/general/stream/stream_restart.sim +++ b/tests/script/general/stream/stream_restart.sim @@ -37,7 +37,7 @@ while $i < $tbNum $y = 0 while $y < $rowNum $ms = $x . s - sql insert into $tb values (now + $ms , $y , $y ) + sql insert into $tb values (1626739200000 + $ms , $y , $y ) $x = $x + 1 $y = $y + 1 endw diff --git a/tests/script/general/stream/table_del.sim b/tests/script/general/stream/table_del.sim index 3cbce538d5a87553289b834bd15dea1f43da35fb..34673605d63b39b9fd809aaedd94f4e6ef80f5b7 100644 --- a/tests/script/general/stream/table_del.sim +++ b/tests/script/general/stream/table_del.sim @@ -34,11 +34,11 @@ while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - $x = -1440 + $x = -400 $y = 0 while $y < $rowNum $ms = $x . m - sql insert into $tb values (now $ms , $y , $y ) + sql insert into $tb values (1626739200000 $ms , $y , $y ) $x = $x + 1 $y = $y + 1 endw diff --git a/tests/script/general/stream/table_replica1_vnoden.sim b/tests/script/general/stream/table_replica1_vnoden.sim index be67a31b4e6782e81289b03fb267db501f341520..4a6c4fe0462fc675e13785905ff1b707815fd168 100644 --- a/tests/script/general/stream/table_replica1_vnoden.sim +++ b/tests/script/general/stream/table_replica1_vnoden.sim @@ -37,11 +37,11 @@ while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - $x = -1440 + $x = -400 $y = 0 while $y < $rowNum $ms = $x . m - sql insert into $tb values (now $ms , $y , $y ) + sql insert into $tb values (1626739200000 $ms , $y , $y ) $x = $x + 1 $y = $y + 1 endw @@ -176,14 +176,14 @@ $st = $stPrefix . pe sql create table $st as select percentile(tbcol, 1) from $tb interval(1d) print =============== step14 wh -sql select count(tbcol) from $tb where ts < now + 4m interval(1d) -print select count(tbcol) from $tb where ts < now + 4m interval(1d) ===> $data00 $data01 +sql select count(tbcol) from $tb where ts < 1626739440001 interval(1d) +print select count(tbcol) from $tb where ts < 1626739440001 interval(1d) ===> $data00 $data01 if $data01 != $rowNum then return -1 endi $st = $stPrefix . wh -#sql create table $st as select count(tbcol) from $tb where ts < now + 4m interval(1d) +#sql create table $st as select count(tbcol) from $tb where ts < 1626739200000 + 4m interval(1d) print =============== step15 as sql select count(tbcol) from $tb interval(1d) diff --git a/tests/script/general/table/fill.sim b/tests/script/general/table/fill.sim deleted file mode 100644 index 069eeff6cf0cdf35a55f33fa3e5bbf8135cc7921..0000000000000000000000000000000000000000 --- a/tests/script/general/table/fill.sim +++ /dev/null @@ -1,63 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/exec.sh -n dnode1 -s start - -sleep 2000 -sql connect - -print =================== step1 -sql create database db -sql use db -sql create table mt (ts timestamp, k int, h binary(20), t bigint, s float, f double, x smallint, y tinyint, z bool) tags (a int, b binary(20), c bigint) -sql create table tb using mt tags (0, '1', 2) - -sql insert into tb values(now -200d, 200, '1', 2, 3, 4, 5, 6, true); -sql insert into tb values(now -100d, 100, '1', 2, 3, 4, 5, 6, true); -sql insert into tb values(now -30d, 30, '1', 2, 3, 4, 5, 6, true); -sql insert into tb values(now -20d, 20, '1', 2, 3, 4, 5, 6, true); -sql insert into tb values(now -10d, 10, '1', 2, 3, 4, 5, 6, true); -sql insert into tb values(now -5d, 5, '1', 2, 3, 4, 5, 6, true); -sql insert into tb values(now -1d, 1, '1', 2, 3, 4, 5, 6, true); -sql insert into tb values(now, 0, '1', 2, 3, 4, 5, 6, true); - -sql select * from db.mt -if $rows != 8 then - return -1 -endi - -sql select * from db.tb -if $rows != 8 then - return -1 -endi - -sql select count(*) from db.mt -if $data00 != 8 then - return -1 -endi - -sql select count(*), last(ts), min(k), max(k), avg(k) from db.mt where a=0 and ts>="2016-4-29 8:0:0" and ts < "2018-7-18 8:9:0" interval(1d) fill(value, 1) -sql select count(*), last(ts), min(k), max(k), avg(k) from db.mt where a=0 and ts>="2016-4-29 8:0:0" and ts < "2018-7-18 8:9:0" interval(1d) fill(value, 1) - -print =================== step2 -system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 -system sh/exec.sh -n dnode1 -s start -sleep 2000 - -print =================== step3 -sql select * from db.mt -if $rows != 8 then - return -1 -endi - -sql select * from db.tb -if $rows != 8 then - return -1 -endi - -sql select count(*) from db.mt -if $data00 != 8 then - return -1 -endi diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index daac2caf5da086d538d0ec4845737a819f6fa1cd..6ad6a74eed76765a11e3cc875b7ff1ae51be648b 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -93,31 +93,7 @@ cd ../../../debug; make #======================b1-end=============== #======================b2-start=============== -./test.sh -f general/tag/3.sim -./test.sh -f general/tag/4.sim -./test.sh -f general/tag/5.sim -./test.sh -f general/tag/6.sim -./test.sh -f general/tag/add.sim -./test.sh -f general/tag/bigint.sim -./test.sh -f general/tag/binary_binary.sim -./test.sh -f general/tag/binary.sim -./test.sh -f general/tag/bool_binary.sim -./test.sh -f general/tag/bool_int.sim -./test.sh -f general/tag/bool.sim -./test.sh -f general/tag/change.sim -./test.sh -f general/tag/column.sim -./test.sh -f general/tag/commit.sim -./test.sh -f general/tag/create.sim -./test.sh -f general/tag/delete.sim -./test.sh -f general/tag/double.sim -./test.sh -f general/tag/filter.sim -./test.sh -f general/tag/float.sim -./test.sh -f general/tag/int_binary.sim -./test.sh -f general/tag/int_float.sim -./test.sh -f general/tag/int.sim -./test.sh -f general/tag/set.sim -./test.sh -f general/tag/smallint.sim -./test.sh -f general/tag/tinyint.sim + ./test.sh -f general/wal/sync.sim ./test.sh -f general/wal/kill.sim ./test.sh -f general/wal/maxtables.sim @@ -397,7 +373,6 @@ cd ../../../debug; make ./test.sh -f general/table/delete_writing.sim ./test.sh -f general/table/describe.sim ./test.sh -f general/table/double.sim -./test.sh -f general/table/fill.sim ./test.sh -f general/table/float.sim ./test.sh -f general/table/int.sim ./test.sh -f general/table/limit.sim