From 569d8e6d33a3ea3ed6276181daa27d885bd2a7c4 Mon Sep 17 00:00:00 2001 From: kailixu Date: Fri, 15 Mar 2024 02:18:19 +0800 Subject: [PATCH] chore: test case for insert syntax and fix of show tags for varbinary/geometry --- source/common/src/ttypes.c | 2 +- source/common/src/tvariant.c | 9 +- source/libs/executor/CMakeLists.txt | 2 +- source/libs/executor/src/sysscanoperator.c | 40 +- source/libs/geometry/src/geosWrapper.c | 1 + source/libs/parser/src/parInsertSql.c | 8 +- tests/parallel_test/cases.task | 3 + .../script/tsim/parser/columnValue_double.sim | 216 +++++++++ .../script/tsim/parser/columnValue_float.sim | 242 +++++++++- .../script/tsim/parser/columnValue_nchar.sim | 415 ++++++++++++++++++ .../tsim/parser/columnValue_varbinary.sim | 34 ++ .../tsim/parser/columnValue_varchar.sim | 415 ++++++++++++++++++ tests/script/win-test-file | 3 + 13 files changed, 1365 insertions(+), 25 deletions(-) create mode 100644 tests/script/tsim/parser/columnValue_nchar.sim create mode 100644 tests/script/tsim/parser/columnValue_varbinary.sim create mode 100644 tests/script/tsim/parser/columnValue_varchar.sim diff --git a/source/common/src/ttypes.c b/source/common/src/ttypes.c index 8827ddc811..57bc875fce 100644 --- a/source/common/src/ttypes.c +++ b/source/common/src/ttypes.c @@ -34,7 +34,7 @@ const int32_t TYPE_BYTES[21] = { INT_BYTES, // TSDB_DATA_TYPE_UINT sizeof(uint64_t), // TSDB_DATA_TYPE_UBIGINT TSDB_MAX_JSON_TAG_LEN, // TSDB_DATA_TYPE_JSON - TSDB_MAX_TAGS_LEN, // TSDB_DATA_TYPE_VARBINARY: placeholder, not implemented + sizeof(VarDataOffsetT), // TSDB_DATA_TYPE_VARBINARY TSDB_MAX_TAGS_LEN, // TSDB_DATA_TYPE_DECIMAL: placeholder, not implemented TSDB_MAX_TAGS_LEN, // TSDB_DATA_TYPE_BLOB: placeholder, not implemented TSDB_MAX_TAGS_LEN, // TSDB_DATA_TYPE_MEDIUMBLOB: placeholder, not implemented diff --git a/source/common/src/tvariant.c b/source/common/src/tvariant.c index 546e870f98..e05471204a 100644 --- a/source/common/src/tvariant.c +++ b/source/common/src/tvariant.c @@ -93,9 +93,10 @@ static int32_t parseSignAndUInteger(const char *z, int32_t n, bool *is_neg, uint return TSDB_CODE_FAILED; } *value = round(val); + return TSDB_CODE_SUCCESS; } - return TSDB_CODE_SUCCESS; + return TSDB_CODE_FAILED; } int32_t toDoubleEx(const char *z, int32_t n, uint32_t type, double *value) { @@ -110,11 +111,11 @@ int32_t toDoubleEx(const char *z, int32_t n, uint32_t type, double *value) { if (errno == ERANGE || errno == EINVAL) return TSDB_CODE_FAILED; if (endPtr - z == n) return TSDB_CODE_SUCCESS; - if (type == TK_NK_BIN) { + if (type == TK_NK_BIN || type == TK_NK_STRING) { bool is_neg = false; uint64_t uv = 0; if (TSDB_CODE_SUCCESS == parseSignAndUInteger(z, n, &is_neg, &uv, false)) { - *value = is_neg ? -uv : uv; + *value = is_neg ? -(double)uv : uv; return TSDB_CODE_SUCCESS; } } @@ -239,7 +240,7 @@ int32_t toIntegerEx(const char *z, int32_t n, uint32_t type, int64_t *value) { *value = INT64_MIN; return TSDB_CODE_FAILED; } else { - *value = -uv; + *value = -(int64_t)uv; } } else { if (uv > INT64_MAX) { diff --git a/source/libs/executor/CMakeLists.txt b/source/libs/executor/CMakeLists.txt index d2c39aba74..838233346e 100644 --- a/source/libs/executor/CMakeLists.txt +++ b/source/libs/executor/CMakeLists.txt @@ -3,7 +3,7 @@ aux_source_directory(src EXECUTOR_SRC) add_library(executor STATIC ${EXECUTOR_SRC}) target_link_libraries(executor - PRIVATE os util common function parser planner qcom scalar nodes index wal tdb + PRIVATE os util common function parser planner qcom scalar nodes index wal tdb geometry ) target_include_directories( diff --git a/source/libs/executor/src/sysscanoperator.c b/source/libs/executor/src/sysscanoperator.c index 0c421bf354..af5df093da 100644 --- a/source/libs/executor/src/sysscanoperator.c +++ b/source/libs/executor/src/sysscanoperator.c @@ -14,6 +14,7 @@ */ #include "executorInt.h" +#include "geosWrapper.h" #include "filter.h" #include "functionMgt.h" #include "querynodes.h" @@ -811,6 +812,8 @@ int32_t convertTagDataToStr(char* str, int type, void* buf, int32_t bufSize, int break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_VARBINARY: + case TSDB_DATA_TYPE_GEOMETRY: if (bufSize < 0) { return TSDB_CODE_TSC_INVALID_VALUE; } @@ -854,6 +857,30 @@ int32_t convertTagDataToStr(char* str, int type, void* buf, int32_t bufSize, int return TSDB_CODE_SUCCESS; } +static int32_t sysTableGetGeomText(char* iGeom, int32_t nGeom, char** output, int32_t* nOutput) { + int32_t code = 0; + char* outputWKT = NULL; + + if (nGeom == 0) { + if (!(*output = strdup(""))) code = TSDB_CODE_OUT_OF_MEMORY; + *nOutput = 0; + return code; + } + + if (TSDB_CODE_SUCCESS != (code = initCtxAsText()) || + TSDB_CODE_SUCCESS != (code = doAsText(iGeom, nGeom, &outputWKT))) { + qError("geo text for systable failed:%s", getThreadLocalGeosCtx()->errMsg); + *output = NULL; + *nOutput = 0; + return code; + } + + *output = outputWKT; + *nOutput = strlen(outputWKT); + + return code; +} + static int32_t sysTableUserTagsFillOneTableTags(const SSysTableScanInfo* pInfo, SMetaReader* smrSuperTable, SMetaReader* smrChildTable, const char* dbname, const char* tableName, int32_t* pNumOfRows, const SSDataBlock* dataBlock) { @@ -889,13 +916,13 @@ static int32_t sysTableUserTagsFillOneTableTags(const SSysTableScanInfo* pInfo, pColInfoData = taosArrayGet(dataBlock->pDataBlock, 4); char tagTypeStr[VARSTR_HEADER_SIZE + 32]; int tagTypeLen = sprintf(varDataVal(tagTypeStr), "%s", tDataTypes[tagType].name); - if (tagType == TSDB_DATA_TYPE_VARCHAR) { - tagTypeLen += sprintf(varDataVal(tagTypeStr) + tagTypeLen, "(%d)", - (int32_t)((*smrSuperTable).me.stbEntry.schemaTag.pSchema[i].bytes - VARSTR_HEADER_SIZE)); - } else if (tagType == TSDB_DATA_TYPE_NCHAR) { + if (tagType == TSDB_DATA_TYPE_NCHAR) { tagTypeLen += sprintf( varDataVal(tagTypeStr) + tagTypeLen, "(%d)", (int32_t)(((*smrSuperTable).me.stbEntry.schemaTag.pSchema[i].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE)); + } else if (IS_VAR_DATA_TYPE(tagType)) { + tagTypeLen += sprintf(varDataVal(tagTypeStr) + tagTypeLen, "(%d)", + (int32_t)((*smrSuperTable).me.stbEntry.schemaTag.pSchema[i].bytes - VARSTR_HEADER_SIZE)); } varDataSetLen(tagTypeStr, tagTypeLen); colDataSetVal(pColInfoData, numOfRows, (char*)tagTypeStr, false); @@ -910,7 +937,9 @@ static int32_t sysTableUserTagsFillOneTableTags(const SSysTableScanInfo* pInfo, } else { bool exist = tTagGet((STag*)smrChildTable->me.ctbEntry.pTags, &tagVal); if (exist) { - if (IS_VAR_DATA_TYPE(tagType)) { + if (tagType == TSDB_DATA_TYPE_GEOMETRY) { + sysTableGetGeomText(tagVal.pData, tagVal.nData, &tagData, &tagLen); + } else if (IS_VAR_DATA_TYPE(tagType)) { tagData = (char*)tagVal.pData; tagLen = tagVal.nData; } else { @@ -940,6 +969,7 @@ static int32_t sysTableUserTagsFillOneTableTags(const SSysTableScanInfo* pInfo, pColInfoData = taosArrayGet(dataBlock->pDataBlock, 5); colDataSetVal(pColInfoData, numOfRows, tagVarChar, (tagData == NULL) || (tagType == TSDB_DATA_TYPE_JSON && tTagIsJsonNull(tagData))); + if (tagType == TSDB_DATA_TYPE_GEOMETRY) taosMemoryFreeClear(tagData); taosMemoryFree(tagVarChar); ++numOfRows; } diff --git a/source/libs/geometry/src/geosWrapper.c b/source/libs/geometry/src/geosWrapper.c index 993178e2b0..ad2d477a13 100644 --- a/source/libs/geometry/src/geosWrapper.c +++ b/source/libs/geometry/src/geosWrapper.c @@ -199,6 +199,7 @@ int32_t doAsText(const unsigned char *inputGeom, size_t size, char **outputWKT) wkt = GEOSWKTWriter_write_r(geosCtx->handle, geosCtx->WKTWriter, geom); if (wkt == NULL) { + code = TSDB_CODE_MSG_DECODE_ERROR; goto _exit; } *outputWKT = wkt; diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index f455e71be2..ece880efa6 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -502,8 +502,8 @@ static int32_t parseTagToken(const char** end, SToken* pToken, SSchema* pSchema, } else if (pToken->type == TK_NK_FLOAT) { *(int8_t*)(&val->i64) = ((taosStr2Double(pToken->z, NULL) == 0) ? FALSE_VALUE : TRUE_VALUE); } else if ((pToken->type == TK_NK_HEX || pToken->type == TK_NK_BIN) && - (TSDB_CODE_SUCCESS == toIntegerPure(pToken->z, pToken->n, 10, &iv))) { - *(int8_t*)(&val->i64) = (iv == 0 ? FALSE_VALUE : TRUE_VALUE); + (TSDB_CODE_SUCCESS == toDoubleEx(pToken->z, pToken->n, pToken->type, (double*)&iv))) { + *(int8_t*)(&val->i64) = ((double)iv == 0 ? FALSE_VALUE : TRUE_VALUE); } else { return buildSyntaxErrMsg(pMsgBuf, "invalid bool data", pToken->z); } @@ -1447,8 +1447,8 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql, } else if (pToken->type == TK_NK_FLOAT) { pVal->value.val = ((taosStr2Double(pToken->z, NULL) == 0) ? FALSE_VALUE : TRUE_VALUE); } else if ((pToken->type == TK_NK_HEX || pToken->type == TK_NK_BIN) && - (TSDB_CODE_SUCCESS == toIntegerPure(pToken->z, pToken->n, 10, &pVal->value.val))) { - *(int8_t*)(&pVal->value.val) = (pVal->value.val == 0 ? FALSE_VALUE : TRUE_VALUE); + (TSDB_CODE_SUCCESS == toDoubleEx(pToken->z, pToken->n, pToken->type, (double*)&pVal->value.val))) { + *(int8_t*)(&pVal->value.val) = ((double)pVal->value.val == 0 ? FALSE_VALUE : TRUE_VALUE); } else { return buildSyntaxErrMsg(&pCxt->msg, "invalid bool data", pToken->z); } diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index ebdff7db2d..9d73663ca8 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1057,6 +1057,9 @@ ,,y,script,./test.sh -f tsim/parser/columnValue_smallint.sim ,,y,script,./test.sh -f tsim/parser/columnValue_tinyint.sim ,,y,script,./test.sh -f tsim/parser/columnValue_unsign.sim +,,y,script,./test.sh -f tsim/parser/columnValue_varchar.sim +,,y,script,./test.sh -f tsim/parser/columnValue_nchar.sim +,,y,script,./test.sh -f tsim/parser/columnValue_varbinary.sim ,,y,script,./test.sh -f tsim/parser/condition.sim ,,y,script,./test.sh -f tsim/parser/condition_scl.sim ,,y,script,./test.sh -f tsim/parser/constCol.sim diff --git a/tests/script/tsim/parser/columnValue_double.sim b/tests/script/tsim/parser/columnValue_double.sim index 002274c95f..2b1178106f 100644 --- a/tests/script/tsim/parser/columnValue_double.sim +++ b/tests/script/tsim/parser/columnValue_double.sim @@ -148,6 +148,46 @@ sql show tags from st_double_16_0 #if $data05 != 0.001500000 then # return -1 #endi +sql create table st_double_100 using mt_double tags ("0x01") +sql show tags from st_double_100 +if $data05 != 1.000000000 then + return -1 +endi +sql create table st_double_101 using mt_double tags ("0b01") +sql show tags from st_double_101 +if $data05 != 1.000000000 then + return -1 +endi +sql create table st_double_102 using mt_double tags ("+0x01") +sql show tags from st_double_102 +if $data05 != 1.000000000 then + return -1 +endi +sql create table st_double_103 using mt_double tags ("-0b01") +sql show tags from st_double_103 +if $data05 != -1.000000000 then + return -1 +endi +sql create table st_double_200 using mt_double tags ( 0x01) +sql show tags from st_double_200 +if $data05 != 1.000000000 then + return -1 +endi +sql create table st_double_201 using mt_double tags (0b01 ) +sql show tags from st_double_201 +if $data05 != 1.000000000 then + return -1 +endi +sql create table st_double_202 using mt_double tags (+0x01) +sql show tags from st_double_202 +if $data05 != 1.000000000 then + return -1 +endi +sql create table st_double_203 using mt_double tags ( -0b01 ) +sql show tags from st_double_203 +if $data05 != -1.000000000 then + return -1 +endi ## case 01: insert values for test column values sql insert into st_double_0 values (now, NULL ) @@ -274,6 +314,70 @@ endi #if $data01 != -56 then # return -1 #endi +sql insert into st_double_100 values(now, "0x01") +sql select * from st_double_100 +if $rows != 1 then + return -1 +endi +if $data01 != 1.000000000 then + return -1 +endi +sql insert into st_double_101 values(now, "0b01") +sql select * from st_double_101 +if $rows != 1 then + return -1 +endi +if $data01 != 1.000000000 then + return -1 +endi +sql insert into st_double_102 values(now, "+0x01") +sql select * from st_double_102 +if $rows != 1 then + return -1 +endi +if $data01 != 1.000000000 then + return -1 +endi +sql insert into st_double_103 values(now, "-0b01") +sql select * from st_double_103 +if $rows != 1 then + return -1 +endi +if $data01 != -1.000000000 then + return -1 +endi +sql insert into st_double_200 values(now, 0x01) +sql select * from st_double_200 +if $rows != 1 then + return -1 +endi +if $data01 != 1.000000000 then + return -1 +endi +sql insert into st_double_201 values(now, 0b01 ) +sql select * from st_double_201 +if $rows != 1 then + return -1 +endi +if $data01 != 1.000000000 then + return -1 +endi +sql insert into st_double_202 values(now, +0x01) +sql select * from st_double_202 +if $rows != 1 then + return -1 +endi +if $data01 != 1.000000000 then + return -1 +endi +sql insert into st_double_203 values(now, -0b01 ) +sql select * from st_double_203 +if $rows != 1 then + return -1 +endi +if $data01 != -1.000000000 then + return -1 +endi ## case 02: dynamic create table for test tag values sql insert into st_double_16 using mt_double tags (NULL ) values (now, NULL ) @@ -394,6 +498,78 @@ sql select * from st_double_28 #if $data01 != -56 then # return -1 #endi +sql insert into st_double_100 using mt_double tags ("0x01") values (now, "0x01") +sql show tags from st_double_100 +if $data05 != 1.000000000 then + return -1 +endi +sql select * from st_double_100 +if $data01 != 1.000000000 then + return -1 +endi +sql insert into st_double_101 using mt_double tags ("0b01") values (now, "0b01") +sql show tags from st_double_101 +if $data05 != 1.000000000 then + return -1 +endi +sql select * from st_double_101 +if $data01 != 1.000000000 then + return -1 +endi +sql insert into st_double_102 using mt_double tags ("+0x01") values (now, "+0x01") +sql show tags from st_double_102 +if $data05 != 1.000000000 then + return -1 +endi +sql select * from st_double_102 +if $data01 != 1.000000000 then + return -1 +endi +sql insert into st_double_103 using mt_double tags ("-0b01") values (now, "-0b01") +sql show tags from st_double_103 +if $data05 != -1.000000000 then + return -1 +endi +sql select * from st_double_103 +if $data01 != -1.000000000 then + return -1 +endi +sql insert into st_double_200 using mt_double tags ( 0x01) values (now, 0x01) +sql show tags from st_double_200 +if $data05 != 1.000000000 then + return -1 +endi +sql select * from st_double_200 +if $data01 != 1.000000000 then + return -1 +endi +sql insert into st_double_201 using mt_double tags (0b01 ) values (now, 0b01) +sql show tags from st_double_201 +if $data05 != 1.000000000 then + return -1 +endi +sql select * from st_double_201 +if $data01 != 1.000000000 then + return -1 +endi +sql insert into st_double_202 using mt_double tags (+0x01) values (now, +0x01) +sql show tags from st_double_202 +if $data05 != 1.000000000 then + return -1 +endi +sql select * from st_double_202 +if $data01 != 1.000000000 then + return -1 +endi +sql insert into st_double_203 using mt_double tags ( -0b01 ) values (now, -0b01) +sql show tags from st_double_203 +if $data05 != -1.000000000 then + return -1 +endi +sql select * from st_double_203 +if $data01 != -1.000000000 then + return -1 +endi ### case 03: alter tag values #sql alter table st_double_0 set tag tagname=1.7976931348623157e+308 @@ -436,6 +612,46 @@ sql select * from st_double_28 ##if $data05 != -63 then ## return -1 ##endi +sql alter table st_double_100 set tag tagname="0x01" +sql show tags from st_double_100 +if $data05 != 1.000000000 then + return -1 +endi +sql alter table st_double_101 set tag tagname="0b01" +sql show tags from st_double_101 +if $data05 != 1.000000000 then + return -1 +endi +sql alter table st_double_102 set tag tagname="+0x01" +sql show tags from st_double_102 +if $data05 != 1.000000000 then + return -1 +endi +sql alter table st_double_103 set tag tagname="-0b01" +sql show tags from st_double_103 +if $data05 != -1.000000000 then + return -1 +endi +sql alter table st_double_200 set tag tagname= 0x01 +sql show tags from st_double_200 +if $data05 != 1.000000000 then + return -1 +endi +sql alter table st_double_201 set tag tagname=0b01 +sql show tags from st_double_201 +if $data05 != 1.000000000 then + return -1 +endi +sql alter table st_double_202 set tag tagname=+0x01 +sql show tags from st_double_202 +if $data05 != 1.000000000 then + return -1 +endi +sql alter table st_double_203 set tag tagname= -0b01 +sql show tags from st_double_203 +if $data05 != -1.000000000 then + return -1 +endi ## case 04: illegal input sql_error create table st_double_e0 using mt_double tags (1.8976931348623157e+308) diff --git a/tests/script/tsim/parser/columnValue_float.sim b/tests/script/tsim/parser/columnValue_float.sim index cf27dc6d19..facb2f1b79 100644 --- a/tests/script/tsim/parser/columnValue_float.sim +++ b/tests/script/tsim/parser/columnValue_float.sim @@ -156,16 +156,62 @@ if $data05 != 0.00150 then print expect 0.00150, actual: $data05 return -1 endi -#sql create table st_float_15_0 using mt_float tags (3.40282347e+38) -#sql show tags from st_float_15_0 -#if $data05 != 0.001500 then -# return -1 -#endi -#sql create table st_float_16_0 using mt_float tags (-3.40282347e+38) -#sql show tags from st_float_16_0 -#if $data05 != 0.001500 then -# return -1 -#endi +sql create table st_float_15_0 using mt_float tags (3.40282346638528859811704183484516925e+38) +sql show tags from st_float_15_0 +if $data05 < 340282346638528859811704183484516925000 then + return -1 +endi +if $data05 > 340282346638528859811704183484516925900 then + return -1 +endi +sql create table st_float_16_0 using mt_float tags (-3.40282346638528859811704183484516925e+38) +sql show tags from st_float_16_0 +if $data05 < -340282346638528859811704183484516925900 then + return -1 +endi +if $data05 > -340282346638528859811704183484516925000 then + return -1 +endi +sql create table st_float_100 using mt_float tags ("0x01") +sql show tags from st_float_100 +if $data05 != 1.00000 then + return -1 +endi +sql create table st_float_101 using mt_float tags ("0b01") +sql show tags from st_float_101 +if $data05 != 1.00000 then + return -1 +endi +sql create table st_float_102 using mt_float tags ("+0x01") +sql show tags from st_float_102 +if $data05 != 1.00000 then + return -1 +endi +sql create table st_float_103 using mt_float tags ("-0b01") +sql show tags from st_float_103 +if $data05 != -1.00000 then + return -1 +endi +sql create table st_float_200 using mt_float tags ( 0x01) +sql show tags from st_float_200 +if $data05 != 1.00000 then + return -1 +endi +sql create table st_float_201 using mt_float tags (0b01 ) +sql show tags from st_float_201 +if $data05 != 1.00000 then + return -1 +endi +sql create table st_float_202 using mt_float tags (+0x01) +sql show tags from st_float_202 +if $data05 != 1.00000 then + return -1 +endi +sql create table st_float_203 using mt_float tags ( -0b01 ) +sql show tags from st_float_203 +if $data05 != -1.00000 then + return -1 +endi ## case 01: insert values for test column values sql insert into st_float_0 values (now, NULL) @@ -216,6 +262,70 @@ endi if $data01 != NULL then return -1 endi +sql insert into st_float_100 values(now, "0x01") +sql select * from st_float_100 +if $rows != 1 then + return -1 +endi +if $data01 != 1.00000 then + return -1 +endi +sql insert into st_float_101 values(now, "0b01") +sql select * from st_float_101 +if $rows != 1 then + return -1 +endi +if $data01 != 1.00000 then + return -1 +endi +sql insert into st_float_102 values(now, "+0x01") +sql select * from st_float_102 +if $rows != 1 then + return -1 +endi +if $data01 != 1.00000 then + return -1 +endi +sql insert into st_float_103 values(now, "-0b01") +sql select * from st_float_103 +if $rows != 1 then + return -1 +endi +if $data01 != -1.00000 then + return -1 +endi +sql insert into st_float_200 values(now, 0x01) +sql select * from st_float_200 +if $rows != 1 then + return -1 +endi +if $data01 != 1.00000 then + return -1 +endi +sql insert into st_float_201 values(now, 0b01 ) +sql select * from st_float_201 +if $rows != 1 then + return -1 +endi +if $data01 != 1.00000 then + return -1 +endi +sql insert into st_float_202 values(now, +0x01) +sql select * from st_float_202 +if $rows != 1 then + return -1 +endi +if $data01 != 1.00000 then + return -1 +endi +sql insert into st_float_203 values(now, -0b01 ) +sql select * from st_float_203 +if $rows != 1 then + return -1 +endi +if $data01 != -1.00000 then + return -1 +endi sql_error insert into st_float_6 values (now, 3.40282347e+38) sql_error insert into st_float_6 values (now, -3.40282347e+38) @@ -425,6 +535,78 @@ sql select * from st_float_28 if $data01 != -5.60000 then return -1 endi +sql insert into st_float_100 using mt_float tags ("0x01") values (now, "0x01") +sql show tags from st_float_100 +if $data05 != 1.00000 then + return -1 +endi +sql select * from st_float_100 +if $data01 != 1.00000 then + return -1 +endi +sql insert into st_float_101 using mt_float tags ("0b01") values (now, "0b01") +sql show tags from st_float_101 +if $data05 != 1.00000 then + return -1 +endi +sql select * from st_float_101 +if $data01 != 1.00000 then + return -1 +endi +sql insert into st_float_102 using mt_float tags ("+0x01") values (now, "+0x01") +sql show tags from st_float_102 +if $data05 != 1.00000 then + return -1 +endi +sql select * from st_float_102 +if $data01 != 1.00000 then + return -1 +endi +sql insert into st_float_103 using mt_float tags ("-0b01") values (now, "-0b01") +sql show tags from st_float_103 +if $data05 != -1.00000 then + return -1 +endi +sql select * from st_float_103 +if $data01 != -1.00000 then + return -1 +endi +sql insert into st_float_200 using mt_float tags ( 0x01) values (now, 0x01) +sql show tags from st_float_200 +if $data05 != 1.00000 then + return -1 +endi +sql select * from st_float_200 +if $data01 != 1.00000 then + return -1 +endi +sql insert into st_float_201 using mt_float tags (0b01 ) values (now, 0b01) +sql show tags from st_float_201 +if $data05 != 1.00000 then + return -1 +endi +sql select * from st_float_201 +if $data01 != 1.00000 then + return -1 +endi +sql insert into st_float_202 using mt_float tags (+0x01) values (now, +0x01) +sql show tags from st_float_202 +if $data05 != 1.00000 then + return -1 +endi +sql select * from st_float_202 +if $data01 != 1.00000 then + return -1 +endi +sql insert into st_float_203 using mt_float tags ( -0b01 ) values (now, -0b01) +sql show tags from st_float_203 +if $data05 != -1.00000 then + return -1 +endi +sql select * from st_float_203 +if $data01 != -1.00000 then + return -1 +endi ### case 03: alter tag values sql alter table st_float_0 set tag tagname=340282346638528859811704183484516925440.00000 @@ -468,6 +650,46 @@ sql show tags from st_float_0 if $data05 != -63.58200 then return -1 endi +sql alter table st_float_100 set tag tagname="0x01" +sql show tags from st_float_100 +if $data05 != 1.00000 then + return -1 +endi +sql alter table st_float_101 set tag tagname="0b01" +sql show tags from st_float_101 +if $data05 != 1.00000 then + return -1 +endi +sql alter table st_float_102 set tag tagname="+0x01" +sql show tags from st_float_102 +if $data05 != 1.00000 then + return -1 +endi +sql alter table st_float_103 set tag tagname="-0b01" +sql show tags from st_float_103 +if $data05 != -1.00000 then + return -1 +endi +sql alter table st_float_200 set tag tagname= 0x01 +sql show tags from st_float_200 +if $data05 != 1.00000 then + return -1 +endi +sql alter table st_float_201 set tag tagname=0b01 +sql show tags from st_float_201 +if $data05 != 1.00000 then + return -1 +endi +sql alter table st_float_202 set tag tagname=+0x01 +sql show tags from st_float_202 +if $data05 != 1.00000 then + return -1 +endi +sql alter table st_float_203 set tag tagname= -0b01 +sql show tags from st_float_203 +if $data05 != -1.00000 then + return -1 +endi ## case 04: illegal input sql_error create table st_float_e0 using mt_float tags (3.50282347e+38) diff --git a/tests/script/tsim/parser/columnValue_nchar.sim b/tests/script/tsim/parser/columnValue_nchar.sim new file mode 100644 index 0000000000..0b5de82d57 --- /dev/null +++ b/tests/script/tsim/parser/columnValue_nchar.sim @@ -0,0 +1,415 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect + +print ========== columnValues.sim + +sql drop database if exists db +sql create database db +sql use db + +#### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value + +######## case 0: nchar +print ========== nchar +sql create table mt_nchar (ts timestamp, c nchar(50)) tags (tagname nchar(50)) + +## case 00: static create table for test tag values +sql create table st_nchar_0 using mt_nchar tags (NULL) +sql show create table st_nchar_0 +sql show tags from st_nchar_0 +if $data05 != NULL then + return -1 +endi +sql create table st_nchar_1 using mt_nchar tags (NULL) +sql show tags from st_nchar_1 +if $data05 != NULL then + return -1 +endi +sql create table st_nchar_2 using mt_nchar tags ('NULL') +sql show tags from st_nchar_2 +if $data05 != NULL then + return -1 +endi +sql create table st_nchar_3 using mt_nchar tags ('NULL') +sql show tags from st_nchar_3 +if $data05 != NULL then + return -1 +endi +sql create table st_nchar_4 using mt_nchar tags ("NULL") +sql show tags from st_nchar_4 +if $data05 != NULL then + return -1 +endi +sql create table st_nchar_5 using mt_nchar tags ("NULL") +sql show tags from st_nchar_5 +if $data05 != NULL then + return -1 +endi +sql create table st_nchar_6 using mt_nchar tags (+0123) +sql show tags from st_nchar_6 +if $data05 != +0123 then + return -1 +endi +sql create table st_nchar_7 using mt_nchar tags (-01.23) +sql show tags from st_nchar_7 +if $data05 != -01.23 then + return -1 +endi +sql create table st_nchar_8 using mt_nchar tags (+0x01) +sql show tags from st_nchar_8 +if $data05 != +0x01 then + return -1 +endi +sql create table st_nchar_9 using mt_nchar tags (-0b01) +sql show tags from st_nchar_9 +if $data05 != -0b01 then + return -1 +endi +sql create table st_nchar_10 using mt_nchar tags (-0.1e-10) +sql show tags from st_nchar_10 +if $data05 != -0.1e-10 then + return -1 +endi +sql create table st_nchar_11 using mt_nchar tags (+0.1E+2) +sql show tags from st_nchar_11 +if $data05 != +0.1e+2 then + return -1 +endi +sql create table st_nchar_12 using mt_nchar tags (tRue) +sql show tags from st_nchar_12 +if $data05 != true then + return -1 +endi +sql create table st_nchar_13 using mt_nchar tags (FalsE) +sql show tags from st_nchar_13 +if $data05 != false then + return -1 +endi +sql create table st_nchar_14 using mt_nchar tags (noW) +sql show tags from st_nchar_14 +if $data05 != now then + return -1 +endi +sql create table st_nchar_15 using mt_nchar tags (toDay) +sql show tags from st_nchar_15 +if $data05 != today then + return -1 +endi + +## case 01: insert values for test column values +sql insert into st_nchar_0 values(now, NULL) +sql select * from st_nchar_0 +if $data01 != NULL then + return -1 +endi +sql insert into st_nchar_1 values(now, NULL) +sql select * from st_nchar_1 +if $data01 != NULL then + return -1 +endi +sql insert into st_nchar_2 values(now, 'NULL') +sql select * from st_nchar_2 +if $data01 != NULL then + return -1 +endi +sql insert into st_nchar_3 values(now, 'NULL') +sql select * from st_nchar_3 +if $data01 != NULL then + return -1 +endi +sql insert into st_nchar_4 values(now, "NULL") +sql select * from st_nchar_4 +if $data01 != NULL then + return -1 +endi +sql insert into st_nchar_5 values(now, "NULL") +sql select * from st_nchar_5 +if $data01 != NULL then + return -1 +endi +sql insert into st_nchar_6 values(now, +0123) +sql select * from st_nchar_6 +if $data01 != +0123 then + return -1 +endi +sql insert into st_nchar_7 values(now, -01.23) +sql select * from st_nchar_7 +if $data01 != -01.23 then + return -1 +endi +sql insert into st_nchar_8 values(now, +0x01) +sql select * from st_nchar_8 +if $data01 != +0x01 then + return -1 +endi +sql insert into st_nchar_9 values(now, -0b01) +sql select * from st_nchar_9 +if $data01 != -0b01 then + return -1 +endi +sql insert into st_nchar_10 values(now, -0.1e-10) +sql select * from st_nchar_10 +if $data01 != -0.1e-10 then + return -1 +endi +sql insert into st_nchar_11 values(now, +0.1E+2) +sql select * from st_nchar_11 +if $data01 != +0.1e+2 then + return -1 +endi +sql insert into st_nchar_12 values(now, tRue) +sql select * from st_nchar_12 +if $data01 != true then + return -1 +endi +sql insert into st_nchar_13 values(now, FalsE) +sql select * from st_nchar_13 +if $data01 != false then + return -1 +endi +sql insert into st_nchar_14 values(now, noW) +sql select * from st_nchar_14 +if $data01 != now then + return -1 +endi +sql insert into st_nchar_15 values(now, toDay) +sql select * from st_nchar_15 +if $data01 != today then + return -1 +endi + +## case 02: dynamic create table for test tag values +sql insert into st_nchar_0 using mt_nchar tags (NULL) values(now, NULL) +sql show tags from st_nchar_0 +if $data05 != NULL then + return -1 +endi +sql select * from st_nchar_0 +if $data01 != NULL then + return -1 +endi +sql insert into st_nchar_1 using mt_nchar tags (NULL) values(now, NULL) +sql show tags from st_nchar_1 +if $data05 != NULL then + return -1 +endi +sql select * from st_nchar_1 +if $data01 != NULL then + return -1 +endi +sql insert into st_nchar_2 using mt_nchar tags ('NULL') values(now, 'NULL') +sql show tags from st_nchar_2 +if $data05 != NULL then + return -1 +endi +sql select * from st_nchar_2 +if $data01 != NULL then + return -1 +endi +sql insert into st_nchar_3 using mt_nchar tags ('NULL') values(now, 'NULL') +sql show tags from st_nchar_3 +if $data05 != NULL then + return -1 +endi +sql select * from st_nchar_3 +if $data01 != NULL then + return -1 +endi +sql insert into st_nchar_4 using mt_nchar tags ("NULL") values(now, "NULL") +sql show tags from st_nchar_4 +if $data05 != NULL then + return -1 +endi +sql select * from st_nchar_4 +if $data01 != NULL then + return -1 +endi +sql insert into st_nchar_5 using mt_nchar tags ("NULL") values(now, "NULL") +sql show tags from st_nchar_5 +if $data05 != NULL then + return -1 +endi +sql select * from st_nchar_5 +if $data01 != NULL then + return -1 +endi +sql insert into st_nchar_6 using mt_nchar tags (+0123) values(now, +0123) +sql show tags from st_nchar_6 +if $data05 != +0123 then + return -1 +endi +sql select * from st_nchar_6 +if $data01 != +0123 then + return -1 +endi +sql insert into st_nchar_7 using mt_nchar tags (-01.23) values(now, -01.23) +sql show tags from st_nchar_7 +if $data05 != -01.23 then + return -1 +endi +sql select * from st_nchar_7 +if $data01 != -01.23 then + return -1 +endi +sql insert into st_nchar_8 using mt_nchar tags (+0x01) values(now, +0x01) +sql show tags from st_nchar_8 +if $data05 != +0x01 then + return -1 +endi +sql select * from st_nchar_8 +if $data01 != +0x01 then + return -1 +endi +sql insert into st_nchar_9 using mt_nchar tags (-0b01) values(now, -0b01) +sql show tags from st_nchar_9 +if $data05 != -0b01 then + return -1 +endi +sql select * from st_nchar_9 +if $data01 != -0b01 then + return -1 +endi +sql insert into st_nchar_10 using mt_nchar tags (-0.1e-10) values(now, -0.1e-10) +sql show tags from st_nchar_10 +if $data05 != -0.1e-10 then + return -1 +endi +sql select * from st_nchar_10 +if $data01 != -0.1e-10 then + return -1 +endi +sql insert into st_nchar_11 using mt_nchar tags (+0.1E+2) values(now, +0.1E+2) +sql show tags from st_nchar_11 +if $data05 != +0.1e+2 then + return -1 +endi +sql select * from st_nchar_11 +if $data01 != +0.1e+2 then + return -1 +endi +sql insert into st_nchar_12 using mt_nchar tags (tRue) values(now, tRue) +sql show tags from st_nchar_12 +if $data05 != true then + return -1 +endi +sql select * from st_nchar_12 +if $data01 != true then + return -1 +endi +sql insert into st_nchar_13 using mt_nchar tags (FalsE) values(now, FalsE) +sql show tags from st_nchar_13 +if $data05 != false then + return -1 +endi +sql select * from st_nchar_13 +if $data01 != false then + return -1 +endi +sql insert into st_nchar_14 using mt_nchar tags (noW) values(now, noW) +sql show tags from st_nchar_14 +if $data05 != now then + return -1 +endi +sql select * from st_nchar_14 +if $data01 != now then + return -1 +endi +sql insert into st_nchar_15 using mt_nchar tags (toDay) values(now, toDay) +sql show tags from st_nchar_15 +if $data05 != today then + return -1 +endi +sql select * from st_nchar_15 +if $data01 != today then + return -1 +endi + +## case 03: alter tag values +sql alter table st_nchar_0 set tag tagname=NULL +sql show tags from st_nchar_0 +if $data05 != NULL then + return -1 +endi +sql alter table st_nchar_1 set tag tagname=NULL +sql show tags from st_nchar_1 +if $data05 != NULL then + return -1 +endi +sql alter table st_nchar_2 set tag tagname='NULL' +sql show tags from st_nchar_2 +if $data05 != NULL then + return -1 +endi +sql alter table st_nchar_3 set tag tagname='NULL' +sql show tags from st_nchar_3 +if $data05 != NULL then + return -1 +endi +sql alter table st_nchar_4 set tag tagname="NULL" +sql show tags from st_nchar_4 +if $data05 != NULL then + return -1 +endi +sql alter table st_nchar_5 set tag tagname="NULL" +sql show tags from st_nchar_5 +if $data05 != NULL then + return -1 +endi +sql alter table st_nchar_6 set tag tagname=+0123 +sql show tags from st_nchar_6 +if $data05 != +0123 then + return -1 +endi +sql alter table st_nchar_7 set tag tagname=-01.23 +sql show tags from st_nchar_7 +if $data05 != -01.23 then + return -1 +endi +sql alter table st_nchar_8 set tag tagname=+0x01 +sql show tags from st_nchar_8 +if $data05 != +0x01 then + return -1 +endi +sql alter table st_nchar_9 set tag tagname=-0b01 +sql show tags from st_nchar_9 +if $data05 != -0b01 then + return -1 +endi +sql alter table st_nchar_10 set tag tagname=-0.1e-10 +sql show tags from st_nchar_10 +if $data05 != -0.1e-10 then + return -1 +endi +sql alter table st_nchar_11 set tag tagname=+0.1E+2 +sql show tags from st_nchar_11 +if $data05 != +0.1e+2 then + return -1 +endi +sql alter table st_nchar_12 set tag tagname=tRue +sql show tags from st_nchar_12 +if $data05 != true then + return -1 +endi +sql alter table st_nchar_13 set tag tagname=FalsE +sql show tags from st_nchar_13 +if $data05 != false then + return -1 +endi +sql alter table st_nchar_14 set tag tagname=noW +sql show tags from st_nchar_14 +if $data05 != now then + return -1 +endi +sql alter table st_nchar_15 set tag tagname=toDay +sql show tags from st_nchar_15 +if $data05 != today then + return -1 +endi + + +# case 04: illegal input + + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/columnValue_varbinary.sim b/tests/script/tsim/parser/columnValue_varbinary.sim new file mode 100644 index 0000000000..a1af2ded14 --- /dev/null +++ b/tests/script/tsim/parser/columnValue_varbinary.sim @@ -0,0 +1,34 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect + +print ========== columnValues.sim + +sql drop database if exists db +sql create database db +sql use db + +#### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value + +######## case 0: varbinary +print ========== varbinary +sql create table mt_varbinary (ts timestamp, c varbinary(50)) tags (tagname varbinary(50)) + +## case 00: static create table for test tag values +sql create table st_varbinary_0 using mt_varbinary tags (NULL) +sql show create table st_varbinary_0 +sql show tags from st_varbinary_0 +if $data05 != NULL then + return -1 +endi +sql create table st_varbinary_1 using mt_varbinary tags (NULL) +sql show tags from st_varbinary_1 +if $data05 != NULL then + return -1 +endi +sql create table st_varbinary_2 using mt_varbinary tags ('NULL') +sql show tags from st_varbinary_2 +if $data05 != NULL then + return -1 +endi diff --git a/tests/script/tsim/parser/columnValue_varchar.sim b/tests/script/tsim/parser/columnValue_varchar.sim new file mode 100644 index 0000000000..5edfe5ed24 --- /dev/null +++ b/tests/script/tsim/parser/columnValue_varchar.sim @@ -0,0 +1,415 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect + +print ========== columnValues.sim + +sql drop database if exists db +sql create database db +sql use db + +#### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value + +######## case 0: varchar +print ========== varchar +sql create table mt_varchar (ts timestamp, c varchar(50)) tags (tagname varchar(50)) + +## case 00: static create table for test tag values +sql create table st_varchar_0 using mt_varchar tags (NULL) +sql show create table st_varchar_0 +sql show tags from st_varchar_0 +if $data05 != NULL then + return -1 +endi +sql create table st_varchar_1 using mt_varchar tags (NULL) +sql show tags from st_varchar_1 +if $data05 != NULL then + return -1 +endi +sql create table st_varchar_2 using mt_varchar tags ('NULL') +sql show tags from st_varchar_2 +if $data05 != NULL then + return -1 +endi +sql create table st_varchar_3 using mt_varchar tags ('NULL') +sql show tags from st_varchar_3 +if $data05 != NULL then + return -1 +endi +sql create table st_varchar_4 using mt_varchar tags ("NULL") +sql show tags from st_varchar_4 +if $data05 != NULL then + return -1 +endi +sql create table st_varchar_5 using mt_varchar tags ("NULL") +sql show tags from st_varchar_5 +if $data05 != NULL then + return -1 +endi +sql create table st_varchar_6 using mt_varchar tags (+0123) +sql show tags from st_varchar_6 +if $data05 != +0123 then + return -1 +endi +sql create table st_varchar_7 using mt_varchar tags (-01.23) +sql show tags from st_varchar_7 +if $data05 != -01.23 then + return -1 +endi +sql create table st_varchar_8 using mt_varchar tags (+0x01) +sql show tags from st_varchar_8 +if $data05 != +0x01 then + return -1 +endi +sql create table st_varchar_9 using mt_varchar tags (-0b01) +sql show tags from st_varchar_9 +if $data05 != -0b01 then + return -1 +endi +sql create table st_varchar_10 using mt_varchar tags (-0.1e-10) +sql show tags from st_varchar_10 +if $data05 != -0.1e-10 then + return -1 +endi +sql create table st_varchar_11 using mt_varchar tags (+0.1E+2) +sql show tags from st_varchar_11 +if $data05 != +0.1e+2 then + return -1 +endi +sql create table st_varchar_12 using mt_varchar tags (tRue) +sql show tags from st_varchar_12 +if $data05 != true then + return -1 +endi +sql create table st_varchar_13 using mt_varchar tags (FalsE) +sql show tags from st_varchar_13 +if $data05 != false then + return -1 +endi +sql create table st_varchar_14 using mt_varchar tags (noW) +sql show tags from st_varchar_14 +if $data05 != now then + return -1 +endi +sql create table st_varchar_15 using mt_varchar tags (toDay) +sql show tags from st_varchar_15 +if $data05 != today then + return -1 +endi + +## case 01: insert values for test column values +sql insert into st_varchar_0 values(now, NULL) +sql select * from st_varchar_0 +if $data01 != NULL then + return -1 +endi +sql insert into st_varchar_1 values(now, NULL) +sql select * from st_varchar_1 +if $data01 != NULL then + return -1 +endi +sql insert into st_varchar_2 values(now, 'NULL') +sql select * from st_varchar_2 +if $data01 != NULL then + return -1 +endi +sql insert into st_varchar_3 values(now, 'NULL') +sql select * from st_varchar_3 +if $data01 != NULL then + return -1 +endi +sql insert into st_varchar_4 values(now, "NULL") +sql select * from st_varchar_4 +if $data01 != NULL then + return -1 +endi +sql insert into st_varchar_5 values(now, "NULL") +sql select * from st_varchar_5 +if $data01 != NULL then + return -1 +endi +sql insert into st_varchar_6 values(now, +0123) +sql select * from st_varchar_6 +if $data01 != +0123 then + return -1 +endi +sql insert into st_varchar_7 values(now, -01.23) +sql select * from st_varchar_7 +if $data01 != -01.23 then + return -1 +endi +sql insert into st_varchar_8 values(now, +0x01) +sql select * from st_varchar_8 +if $data01 != +0x01 then + return -1 +endi +sql insert into st_varchar_9 values(now, -0b01) +sql select * from st_varchar_9 +if $data01 != -0b01 then + return -1 +endi +sql insert into st_varchar_10 values(now, -0.1e-10) +sql select * from st_varchar_10 +if $data01 != -0.1e-10 then + return -1 +endi +sql insert into st_varchar_11 values(now, +0.1E+2) +sql select * from st_varchar_11 +if $data01 != +0.1e+2 then + return -1 +endi +sql insert into st_varchar_12 values(now, tRue) +sql select * from st_varchar_12 +if $data01 != true then + return -1 +endi +sql insert into st_varchar_13 values(now, FalsE) +sql select * from st_varchar_13 +if $data01 != false then + return -1 +endi +sql insert into st_varchar_14 values(now, noW) +sql select * from st_varchar_14 +if $data01 != now then + return -1 +endi +sql insert into st_varchar_15 values(now, toDay) +sql select * from st_varchar_15 +if $data01 != today then + return -1 +endi + +## case 02: dynamic create table for test tag values +sql insert into st_varchar_0 using mt_varchar tags (NULL) values(now, NULL) +sql show tags from st_varchar_0 +if $data05 != NULL then + return -1 +endi +sql select * from st_varchar_0 +if $data01 != NULL then + return -1 +endi +sql insert into st_varchar_1 using mt_varchar tags (NULL) values(now, NULL) +sql show tags from st_varchar_1 +if $data05 != NULL then + return -1 +endi +sql select * from st_varchar_1 +if $data01 != NULL then + return -1 +endi +sql insert into st_varchar_2 using mt_varchar tags ('NULL') values(now, 'NULL') +sql show tags from st_varchar_2 +if $data05 != NULL then + return -1 +endi +sql select * from st_varchar_2 +if $data01 != NULL then + return -1 +endi +sql insert into st_varchar_3 using mt_varchar tags ('NULL') values(now, 'NULL') +sql show tags from st_varchar_3 +if $data05 != NULL then + return -1 +endi +sql select * from st_varchar_3 +if $data01 != NULL then + return -1 +endi +sql insert into st_varchar_4 using mt_varchar tags ("NULL") values(now, "NULL") +sql show tags from st_varchar_4 +if $data05 != NULL then + return -1 +endi +sql select * from st_varchar_4 +if $data01 != NULL then + return -1 +endi +sql insert into st_varchar_5 using mt_varchar tags ("NULL") values(now, "NULL") +sql show tags from st_varchar_5 +if $data05 != NULL then + return -1 +endi +sql select * from st_varchar_5 +if $data01 != NULL then + return -1 +endi +sql insert into st_varchar_6 using mt_varchar tags (+0123) values(now, +0123) +sql show tags from st_varchar_6 +if $data05 != +0123 then + return -1 +endi +sql select * from st_varchar_6 +if $data01 != +0123 then + return -1 +endi +sql insert into st_varchar_7 using mt_varchar tags (-01.23) values(now, -01.23) +sql show tags from st_varchar_7 +if $data05 != -01.23 then + return -1 +endi +sql select * from st_varchar_7 +if $data01 != -01.23 then + return -1 +endi +sql insert into st_varchar_8 using mt_varchar tags (+0x01) values(now, +0x01) +sql show tags from st_varchar_8 +if $data05 != +0x01 then + return -1 +endi +sql select * from st_varchar_8 +if $data01 != +0x01 then + return -1 +endi +sql insert into st_varchar_9 using mt_varchar tags (-0b01) values(now, -0b01) +sql show tags from st_varchar_9 +if $data05 != -0b01 then + return -1 +endi +sql select * from st_varchar_9 +if $data01 != -0b01 then + return -1 +endi +sql insert into st_varchar_10 using mt_varchar tags (-0.1e-10) values(now, -0.1e-10) +sql show tags from st_varchar_10 +if $data05 != -0.1e-10 then + return -1 +endi +sql select * from st_varchar_10 +if $data01 != -0.1e-10 then + return -1 +endi +sql insert into st_varchar_11 using mt_varchar tags (+0.1E+2) values(now, +0.1E+2) +sql show tags from st_varchar_11 +if $data05 != +0.1e+2 then + return -1 +endi +sql select * from st_varchar_11 +if $data01 != +0.1e+2 then + return -1 +endi +sql insert into st_varchar_12 using mt_varchar tags (tRue) values(now, tRue) +sql show tags from st_varchar_12 +if $data05 != true then + return -1 +endi +sql select * from st_varchar_12 +if $data01 != true then + return -1 +endi +sql insert into st_varchar_13 using mt_varchar tags (FalsE) values(now, FalsE) +sql show tags from st_varchar_13 +if $data05 != false then + return -1 +endi +sql select * from st_varchar_13 +if $data01 != false then + return -1 +endi +sql insert into st_varchar_14 using mt_varchar tags (noW) values(now, noW) +sql show tags from st_varchar_14 +if $data05 != now then + return -1 +endi +sql select * from st_varchar_14 +if $data01 != now then + return -1 +endi +sql insert into st_varchar_15 using mt_varchar tags (toDay) values(now, toDay) +sql show tags from st_varchar_15 +if $data05 != today then + return -1 +endi +sql select * from st_varchar_15 +if $data01 != today then + return -1 +endi + +## case 03: alter tag values +sql alter table st_varchar_0 set tag tagname=NULL +sql show tags from st_varchar_0 +if $data05 != NULL then + return -1 +endi +sql alter table st_varchar_1 set tag tagname=NULL +sql show tags from st_varchar_1 +if $data05 != NULL then + return -1 +endi +sql alter table st_varchar_2 set tag tagname='NULL' +sql show tags from st_varchar_2 +if $data05 != NULL then + return -1 +endi +sql alter table st_varchar_3 set tag tagname='NULL' +sql show tags from st_varchar_3 +if $data05 != NULL then + return -1 +endi +sql alter table st_varchar_4 set tag tagname="NULL" +sql show tags from st_varchar_4 +if $data05 != NULL then + return -1 +endi +sql alter table st_varchar_5 set tag tagname="NULL" +sql show tags from st_varchar_5 +if $data05 != NULL then + return -1 +endi +sql alter table st_varchar_6 set tag tagname=+0123 +sql show tags from st_varchar_6 +if $data05 != +0123 then + return -1 +endi +sql alter table st_varchar_7 set tag tagname=-01.23 +sql show tags from st_varchar_7 +if $data05 != -01.23 then + return -1 +endi +sql alter table st_varchar_8 set tag tagname=+0x01 +sql show tags from st_varchar_8 +if $data05 != +0x01 then + return -1 +endi +sql alter table st_varchar_9 set tag tagname=-0b01 +sql show tags from st_varchar_9 +if $data05 != -0b01 then + return -1 +endi +sql alter table st_varchar_10 set tag tagname=-0.1e-10 +sql show tags from st_varchar_10 +if $data05 != -0.1e-10 then + return -1 +endi +sql alter table st_varchar_11 set tag tagname=+0.1E+2 +sql show tags from st_varchar_11 +if $data05 != +0.1e+2 then + return -1 +endi +sql alter table st_varchar_12 set tag tagname=tRue +sql show tags from st_varchar_12 +if $data05 != true then + return -1 +endi +sql alter table st_varchar_13 set tag tagname=FalsE +sql show tags from st_varchar_13 +if $data05 != false then + return -1 +endi +sql alter table st_varchar_14 set tag tagname=noW +sql show tags from st_varchar_14 +if $data05 != now then + return -1 +endi +sql alter table st_varchar_15 set tag tagname=toDay +sql show tags from st_varchar_15 +if $data05 != today then + return -1 +endi + + +# case 04: illegal input + + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/win-test-file b/tests/script/win-test-file index b9f250927f..e43f1e327b 100644 --- a/tests/script/win-test-file +++ b/tests/script/win-test-file @@ -113,6 +113,9 @@ ./test.sh -f tsim/parser/columnValue_smallint.sim ./test.sh -f tsim/parser/columnValue_tinyint.sim ./test.sh -f tsim/parser/columnValue_unsign.sim +./test.sh -f tsim/parser/columnValue_varchar.sim +./test.sh -f tsim/parser/columnValue_nchar.sim +./test.sh -f tsim/parser/columnValue_varbinary.sim ./test.sh -f tsim/parser/condition.sim ./test.sh -f tsim/parser/condition_scl.sim ./test.sh -f tsim/parser/constCol.sim