fix: unify tag value parsing syntax

This commit is contained in:
kailixu 2024-03-10 22:14:57 +08:00
parent a083f45ac1
commit 433179af0d
29 changed files with 3894 additions and 3509 deletions

View File

@ -2822,6 +2822,7 @@ typedef struct {
int8_t tagType; int8_t tagType;
uint32_t nTagVal; uint32_t nTagVal;
uint8_t* pTagVal; uint8_t* pTagVal;
SArray* pTagArray;
// TSDB_ALTER_TABLE_UPDATE_OPTIONS // TSDB_ALTER_TABLE_UPDATE_OPTIONS
int8_t updateTTL; int8_t updateTTL;
int32_t newTTL; int32_t newTTL;

View File

@ -98,8 +98,8 @@ int32_t parseSignAndUInteger(const char *z, int32_t n, bool *is_neg, uint64_t *v
int32_t toDoubleEx(const char *z, int32_t n, uint32_t type, double* value) { int32_t toDoubleEx(const char *z, int32_t n, uint32_t type, double* value) {
if (n == 0) { if (n == 0) {
*value = 0; errno = EINVAL;
return TSDB_CODE_SUCCESS; return TSDB_CODE_FAILED;
} }
errno = 0; errno = 0;
@ -144,8 +144,8 @@ int32_t toIntegerEx(const char *z, int32_t n, uint32_t type, int64_t *value) {
} }
if (n == 0) { if (n == 0) {
*value = 0; errno = EINVAL;
return TSDB_CODE_SUCCESS; return TSDB_CODE_FAILED;
} }
// 1. try to parse as integer // 1. try to parse as integer

View File

@ -108,6 +108,8 @@ SNodeList* addNodeToList(SAstCreateContext* pCxt, SNodeList* pList, SNode* pNode
SNode* createColumnNode(SAstCreateContext* pCxt, SToken* pTableAlias, SToken* pColumnName); SNode* createColumnNode(SAstCreateContext* pCxt, SToken* pTableAlias, SToken* pColumnName);
SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral); SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral);
SNode* createRawValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode *pNode);
SNode* createRawValueNodeExt(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode *pLeft, SNode *pRight);
SNodeList* createHintNodeList(SAstCreateContext* pCxt, const SToken* pLiteral); SNodeList* createHintNodeList(SAstCreateContext* pCxt, const SToken* pLiteral);
SNode* createIdentifierValueNode(SAstCreateContext* pCxt, SToken* pLiteral); SNode* createIdentifierValueNode(SAstCreateContext* pCxt, SToken* pLiteral);
SNode* createDurationValueNode(SAstCreateContext* pCxt, const SToken* pLiteral); SNode* createDurationValueNode(SAstCreateContext* pCxt, const SToken* pLiteral);

View File

@ -23,6 +23,7 @@ extern "C" {
#include "catalog.h" #include "catalog.h"
#include "os.h" #include "os.h"
#include "parser.h" #include "parser.h"
#include "parToken.h"
#include "query.h" #include "query.h"
#define parserFatal(param, ...) qFatal("PARSER: " param, ##__VA_ARGS__) #define parserFatal(param, ...) qFatal("PARSER: " param, ##__VA_ARGS__)
@ -35,6 +36,54 @@ extern "C" {
#define ROWTS_PSEUDO_COLUMN_NAME "_rowts" #define ROWTS_PSEUDO_COLUMN_NAME "_rowts"
#define C0_PSEUDO_COLUMN_NAME "_c0" #define C0_PSEUDO_COLUMN_NAME "_c0"
#define IS_NOW_STR(s, n) \
((*(s) == 'n' || *(s) == 'N') && (*((s) + 1) == 'o' || *((s) + 1) == 'O') && \
(*((s) + 2) == 'w' || *((s) + 2) == 'W') && (n == 3 || (n == 5 && *((s) + 3) == '(' && *((s) + 4) == ')')))
#define IS_TODAY_STR(s, n) \
((*(s) == 't' || *(s) == 'T') && (*((s) + 1) == 'o' || *((s) + 1) == 'O') && \
(*((s) + 2) == 'd' || *((s) + 2) == 'D') && (*((s) + 3) == 'a' || *((s) + 3) == 'A') && \
(*((s) + 4) == 'y' || *((s) + 4) == 'Y') && (n == 5 || (n == 7 && *((s) + 5) == '(' && *((s) + 6) == ')')))
#define IS_TRUE_STR(s, n) \
(n == 4 && (*(s) == 't' || *(s) == 'T') && (*((s) + 1) == 'r' || *((s) + 1) == 'R') && \
(*((s) + 2) == 'u' || *((s) + 2) == 'U') && (*((s) + 3) == 'e' || *((s) + 3) == 'E'))
#define IS_FALSE_STR(s, n) \
(n == 5 && (*(s) == 'f' || *(s) == 'F') && (*((s) + 1) == 'a' || *((s) + 1) == 'A') && \
(*((s) + 2) == 'l' || *((s) + 2) == 'L') && (*((s) + 3) == 's' || *((s) + 3) == 'S') && \
(*((s) + 4) == 'e' || *((s) + 4) == 'E'))
#define IS_NULL_STR(s, n) \
(n == 4 && (*(s) == 'N' || *(s) == 'n') && (*((s) + 1) == 'U' || *((s) + 1) == 'u') && \
(*((s) + 2) == 'L' || *((s) + 2) == 'l') && (*((s) + 3) == 'L' || *((s) + 3) == 'l'))
#define NEXT_TOKEN_WITH_PREV(pSql, token) \
do { \
int32_t index = 0; \
token = tStrGetToken(pSql, &index, true, NULL); \
pSql += index; \
} while (0)
#define NEXT_TOKEN_WITH_PREV_EXT(pSql, token, pIgnoreComma) \
do { \
int32_t index = 0; \
token = tStrGetToken(pSql, &index, true, pIgnoreComma); \
pSql += index; \
} while (0)
#define NEXT_TOKEN_KEEP_SQL(pSql, token, index) \
do { \
token = tStrGetToken(pSql, &index, false, NULL); \
} while (0)
#define NEXT_VALID_TOKEN(pSql, token) \
do { \
(token).n = tGetToken(pSql, &(token).type); \
(token).z = (char*)pSql; \
pSql += (token).n; \
} while (TK_NK_SPACE == (token).type)
typedef struct SMsgBuf { typedef struct SMsgBuf {
int32_t len; int32_t len;
char* buf; char* buf;
@ -89,6 +138,9 @@ int32_t getTableTypeFromTableNode(SNode *pTable);
int32_t trimString(const char* src, int32_t len, char* dst, int32_t dlen); int32_t trimString(const char* src, int32_t len, char* dst, int32_t dlen);
int32_t getVnodeSysTableTargetName(int32_t acctId, SNode* pWhere, SName* pName); int32_t getVnodeSysTableTargetName(int32_t acctId, SNode* pWhere, SName* pName);
int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf, SMsgBuf* pMsgBuf, int8_t type);
int32_t parseTagValue(SMsgBuf* pMsgBuf, const char** pSql, uint8_t precision, SSchema* pTagSchema, SToken* pToken,
SArray* pTagName, SArray* pTagVals, STag** pTag);
int32_t buildCatalogReq(const SParseMetaCache* pMetaCache, SCatalogReq* pCatalogReq); int32_t buildCatalogReq(const SParseMetaCache* pMetaCache, SCatalogReq* pCatalogReq);
int32_t putMetaDataToCache(const SCatalogReq* pCatalogReq, const SMetaData* pMetaData, SParseMetaCache* pMetaCache); int32_t putMetaDataToCache(const SCatalogReq* pCatalogReq, const SMetaData* pMetaData, SParseMetaCache* pMetaCache);

View File

@ -354,7 +354,7 @@ alter_table_clause(A) ::=
alter_table_clause(A) ::= alter_table_clause(A) ::=
full_table_name(B) RENAME TAG column_name(C) column_name(D). { A = createAlterTableRenameCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &C, &D); } full_table_name(B) RENAME TAG column_name(C) column_name(D). { A = createAlterTableRenameCol(pCxt, B, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &C, &D); }
alter_table_clause(A) ::= alter_table_clause(A) ::=
full_table_name(B) SET TAG column_name(C) NK_EQ signed_literal(D). { A = createAlterTableSetTag(pCxt, B, &C, D); } full_table_name(B) SET TAG column_name(C) NK_EQ tags_literal(D). { A = createAlterTableSetTag(pCxt, B, &C, D); }
%type multi_create_clause { SNodeList* } %type multi_create_clause { SNodeList* }
%destructor multi_create_clause { nodesDestroyList($$); } %destructor multi_create_clause { nodesDestroyList($$); }
@ -363,7 +363,7 @@ multi_create_clause(A) ::= multi_create_clause(B) create_subtable_clause(C).
create_subtable_clause(A) ::= create_subtable_clause(A) ::=
not_exists_opt(B) full_table_name(C) USING full_table_name(D) not_exists_opt(B) full_table_name(C) USING full_table_name(D)
specific_cols_opt(E) TAGS NK_LP expression_list(F) NK_RP table_options(G). { A = createCreateSubTableClause(pCxt, B, C, D, E, F, G); } specific_cols_opt(E) TAGS NK_LP tags_literal_list(F) NK_RP table_options(G). { A = createCreateSubTableClause(pCxt, B, C, D, E, F, G); }
%type multi_drop_clause { SNodeList* } %type multi_drop_clause { SNodeList* }
%destructor multi_drop_clause { nodesDestroyList($$); } %destructor multi_drop_clause { nodesDestroyList($$); }
@ -744,6 +744,52 @@ insert_query(A) ::= INSERT INTO full_table_name(D)
NK_LP col_name_list(B) NK_RP query_or_subquery(C). { A = createInsertStmt(pCxt, D, B, C); } NK_LP col_name_list(B) NK_RP query_or_subquery(C). { A = createInsertStmt(pCxt, D, B, C); }
insert_query(A) ::= INSERT INTO full_table_name(C) query_or_subquery(B). { A = createInsertStmt(pCxt, C, NULL, B); } insert_query(A) ::= INSERT INTO full_table_name(C) query_or_subquery(B). { A = createInsertStmt(pCxt, C, NULL, B); }
/************************************************ tags_literal *************************************************************/
tags_literal(A) ::= NK_INTEGER(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B, NULL); }
tags_literal(A) ::= NK_PLUS(B) NK_INTEGER(C). {
SToken t = B;
t.n = (C.z + C.n) - B.z;
A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL);
}
tags_literal(A) ::= NK_MINUS(B) NK_INTEGER(C). {
SToken t = B;
t.n = (C.z + C.n) - B.z;
A = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL);
}
tags_literal(A) ::= NK_FLOAT(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &B, NULL); }
tags_literal(A) ::= NK_PLUS(B) NK_FLOAT(C). {
SToken t = B;
t.n = (C.z + C.n) - B.z;
A = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL);
}
tags_literal(A) ::= NK_MINUS(B) NK_FLOAT(C). {
SToken t = B;
t.n = (C.z + C.n) - B.z;
A = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL);
}
tags_literal(A) ::= NK_STRING(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B, NULL); }
tags_literal(A) ::= NK_BOOL(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &B, NULL); }
tags_literal(A) ::= NULL(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &B, NULL); }
tags_literal(A) ::= literal_func(B). { A = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, B); }
tags_literal(A) ::= literal_func(B) NK_PLUS duration_literal(C). {
SToken l = getTokenFromRawExprNode(pCxt, B);
SToken r = getTokenFromRawExprNode(pCxt, C);
l.n = (r.z + r.n) - l.z;
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, B, C);
}
tags_literal(A) ::= literal_func(B) NK_MINUS duration_literal(C). {
SToken l = getTokenFromRawExprNode(pCxt, B);
SToken r = getTokenFromRawExprNode(pCxt, C);
l.n = (r.z + r.n) - l.z;
A = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, B, C);
}
%type tags_literal_list { SNodeList* }
%destructor tags_literal_list { nodesDestroyList($$); }
tags_literal_list(A) ::= tags_literal(B). { A = createNodeList(pCxt, B); }
tags_literal_list(A) ::= tags_literal_list(B) NK_COMMA tags_literal(C). { A = addNodeToList(pCxt, B, C); }
/************************************************ literal *************************************************************/ /************************************************ literal *************************************************************/
literal(A) ::= NK_INTEGER(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B)); } literal(A) ::= NK_INTEGER(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B)); }
literal(A) ::= NK_FLOAT(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &B)); } literal(A) ::= NK_FLOAT(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &B)); }
@ -924,6 +970,7 @@ function_expression(A) ::= literal_func(B).
literal_func(A) ::= noarg_func(B) NK_LP NK_RP(C). { A = createRawExprNodeExt(pCxt, &B, &C, createFunctionNode(pCxt, &B, NULL)); } literal_func(A) ::= noarg_func(B) NK_LP NK_RP(C). { A = createRawExprNodeExt(pCxt, &B, &C, createFunctionNode(pCxt, &B, NULL)); }
literal_func(A) ::= NOW(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } literal_func(A) ::= NOW(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
literal_func(A) ::= TODAY(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
%type noarg_func { SToken } %type noarg_func { SToken }
%destructor noarg_func { } %destructor noarg_func { }

View File

@ -371,6 +371,80 @@ SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken*
return (SNode*)val; return (SNode*)val;
} }
SNode* createRawValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode* pNode) {
CHECK_PARSER_STATUS(pCxt);
SValueNode* val = NULL;
if (!(val = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE))) {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY, "Out of memory");
goto _exit;
}
if (pLiteral) {
val->literal = strndup(pLiteral->z, pLiteral->n);
} else if (pNode) {
SRawExprNode* pRawExpr = (SRawExprNode*)pNode;
if (!nodesIsExprNode(pRawExpr->pNode)) {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, pRawExpr->p);
goto _exit;
}
val->literal = strndup(pRawExpr->p, pRawExpr->n);
} else {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INTERNAL_ERROR, "Invalid parameters");
goto _exit;
}
if (!val->literal) {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY, "Out of memory");
goto _exit;
}
val->node.resType.type = dataType;
val->node.resType.bytes = IS_VAR_DATA_TYPE(dataType) ? strlen(val->literal) : tDataTypes[dataType].bytes;
if (TSDB_DATA_TYPE_TIMESTAMP == dataType) {
val->node.resType.precision = TSDB_TIME_PRECISION_MILLI;
}
_exit:
nodesDestroyNode(pNode);
if (pCxt->errCode != 0) {
nodesDestroyNode((SNode*)val);
return NULL;
}
return (SNode*)val;
}
SNode* createRawValueNodeExt(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode* pLeft,
SNode* pRight) {
CHECK_PARSER_STATUS(pCxt);
SValueNode* val = NULL;
if (!(val = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE))) {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY, "Out of memory");
goto _exit;
}
if (pLiteral) {
if (!(val->literal = strndup(pLiteral->z, pLiteral->n))) {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY, "Out of memory");
goto _exit;
}
} else {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INTERNAL_ERROR, "Invalid parameters");
goto _exit;
}
val->node.resType.type = dataType;
val->node.resType.bytes = IS_VAR_DATA_TYPE(dataType) ? strlen(val->literal) : tDataTypes[dataType].bytes;
if (TSDB_DATA_TYPE_TIMESTAMP == dataType) {
val->node.resType.precision = TSDB_TIME_PRECISION_MILLI;
}
_exit:
nodesDestroyNode(pLeft);
nodesDestroyNode(pRight);
if (pCxt->errCode != 0) {
nodesDestroyNode((SNode*)val);
return NULL;
}
return (SNode*)val;
}
static bool hasHint(SNodeList* pHintList, EHintOption hint) { static bool hasHint(SNodeList* pHintList, EHintOption hint) {
if (!pHintList) return false; if (!pHintList) return false;
SNode* pNode; SNode* pNode;

View File

@ -20,32 +20,6 @@
#include "ttime.h" #include "ttime.h"
#include "geosWrapper.h" #include "geosWrapper.h"
#define NEXT_TOKEN_WITH_PREV(pSql, token) \
do { \
int32_t index = 0; \
token = tStrGetToken(pSql, &index, true, NULL); \
pSql += index; \
} while (0)
#define NEXT_TOKEN_WITH_PREV_EXT(pSql, token, pIgnoreComma) \
do { \
int32_t index = 0; \
token = tStrGetToken(pSql, &index, true, pIgnoreComma); \
pSql += index; \
} while (0)
#define NEXT_TOKEN_KEEP_SQL(pSql, token, index) \
do { \
token = tStrGetToken(pSql, &index, false, NULL); \
} while (0)
#define NEXT_VALID_TOKEN(pSql, token) \
do { \
(token).n = tGetToken(pSql, &(token).type); \
(token).z = (char*)pSql; \
pSql += (token).n; \
} while (TK_NK_SPACE == (token).type)
typedef struct SInsertParseContext { typedef struct SInsertParseContext {
SParseContext* pComCxt; SParseContext* pComCxt;
SMsgBuf msg; SMsgBuf msg;
@ -63,13 +37,9 @@ typedef int32_t (*_row_append_fn_t)(SMsgBuf* pMsgBuf, const void* value, int32_t
static uint8_t TRUE_VALUE = (uint8_t)TSDB_TRUE; static uint8_t TRUE_VALUE = (uint8_t)TSDB_TRUE;
static uint8_t FALSE_VALUE = (uint8_t)TSDB_FALSE; static uint8_t FALSE_VALUE = (uint8_t)TSDB_FALSE;
static bool isNullStr(SToken* pToken) { static FORCE_INLINE bool isNullValue(int8_t dataType, SToken* pToken) {
return ((pToken->type == TK_NK_STRING) && (strlen(TSDB_DATA_NULL_STR_L) == pToken->n) && return TK_NULL == pToken->type ||
(strncasecmp(TSDB_DATA_NULL_STR_L, pToken->z, pToken->n) == 0)); (TK_NK_STRING == pToken->type && !IS_STR_DATA_TYPE(dataType) && IS_NULL_STR(pToken->z, pToken->n));
}
static bool isNullValue(int8_t dataType, SToken* pToken) {
return TK_NULL == pToken->type || (!IS_STR_DATA_TYPE(dataType) && isNullStr(pToken));
} }
static FORCE_INLINE int32_t toDouble(SToken* pToken, double* value, char** endPtr) { static FORCE_INLINE int32_t toDouble(SToken* pToken, double* value, char** endPtr) {
@ -268,7 +238,8 @@ static int32_t parseBoundColumns(SInsertParseContext* pCxt, const char** pSql, E
return code; return code;
} }
static int parseTimestampOrInterval(const char** end, SToken* pToken, int16_t timePrec, int64_t* ts, int64_t* interval, SMsgBuf* pMsgBuf, bool* isTs) { static int parseTimestampOrInterval(const char** end, SToken* pToken, int16_t timePrec, int64_t* ts, int64_t* interval,
SMsgBuf* pMsgBuf, bool* isTs) {
if (pToken->type == TK_NOW) { if (pToken->type == TK_NOW) {
*isTs = true; *isTs = true;
*ts = taosGetTimestamp(timePrec); *ts = taosGetTimestamp(timePrec);
@ -289,7 +260,20 @@ static int parseTimestampOrInterval(const char** end, SToken* pToken, int16_t ti
} else { // parse the RFC-3339/ISO-8601 timestamp format string } else { // parse the RFC-3339/ISO-8601 timestamp format string
*isTs = true; *isTs = true;
if (taosParseTime(pToken->z, ts, pToken->n, timePrec, tsDaylight) != TSDB_CODE_SUCCESS) { if (taosParseTime(pToken->z, ts, pToken->n, timePrec, tsDaylight) != TSDB_CODE_SUCCESS) {
return buildSyntaxErrMsg(pMsgBuf, "invalid timestamp format", pToken->z); if (pToken->type != TK_NK_STRING) {
return buildSyntaxErrMsg(pMsgBuf, "invalid timestamp format", pToken->z);
}
if (TSDB_CODE_SUCCESS != toInteger(pToken->z, pToken->n, 10, ts)) {
if (IS_NOW_STR(pToken->z, pToken->n)) {
*isTs = true;
*ts = taosGetTimestamp(timePrec);
} else if (IS_TODAY_STR(pToken->z, pToken->n)) {
*isTs = true;
*ts = taosGetTimestampToday(timePrec);
} else {
return buildSyntaxErrMsg(pMsgBuf, "invalid timestamp format", pToken->z);
}
}
} }
} }
@ -313,10 +297,22 @@ static int parseTime(const char** end, SToken* pToken, int16_t timePrec, int64_t
for (int k = pToken->n; pToken->z[k] != '\0'; k++) { for (int k = pToken->n; pToken->z[k] != '\0'; k++) {
if (pToken->z[k] == ' ' || pToken->z[k] == '\t') continue; if (pToken->z[k] == ' ' || pToken->z[k] == '\t') continue;
if (pToken->z[k] == '(' && pToken->z[k + 1] == ')') { // for insert NOW()/TODAY() if (pToken->z[k] == '(') { // for insert NOW()/TODAY()
*end = pTokenEnd = &pToken->z[k + 2]; if (pToken->z[k + 1] == ')') {
k++; *end = pTokenEnd = &pToken->z[k + 2];
continue; ++k;
continue;
} else {
char nc = pToken->z[k + 1];
while (nc == ' ' || nc == '\t' || nc == '\n' || nc == '\r' || nc == '\f') {
nc = pToken->z[(++k) + 1];
}
if (nc == ')') {
*end = pTokenEnd = &pToken->z[k + 2];
++k;
continue;
}
}
} }
if (pToken->z[k] == ',') { if (pToken->z[k] == ',') {
*end = pTokenEnd; *end = pTokenEnd;
@ -491,9 +487,9 @@ static int32_t parseTagToken(const char** end, SToken* pToken, SSchema* pSchema,
switch (pSchema->type) { switch (pSchema->type) {
case TSDB_DATA_TYPE_BOOL: { case TSDB_DATA_TYPE_BOOL: {
if ((pToken->type == TK_NK_BOOL || pToken->type == TK_NK_STRING) && (pToken->n != 0)) { if ((pToken->type == TK_NK_BOOL || pToken->type == TK_NK_STRING) && (pToken->n != 0)) {
if (strncmp(pToken->z, "true", pToken->n) == 0) { if (IS_TRUE_STR(pToken->z, pToken->n)) {
*(int8_t*)(&val->i64) = TRUE_VALUE; *(int8_t*)(&val->i64) = TRUE_VALUE;
} else if (strncmp(pToken->z, "false", pToken->n) == 0) { } else if (IS_FALSE_STR(pToken->z, pToken->n)) {
*(int8_t*)(&val->i64) = FALSE_VALUE; *(int8_t*)(&val->i64) = FALSE_VALUE;
} else { } else {
return buildSyntaxErrMsg(pMsgBuf, "invalid bool data", pToken->z); return buildSyntaxErrMsg(pMsgBuf, "invalid bool data", pToken->z);
@ -709,30 +705,29 @@ static int32_t parseBoundTagsClause(SInsertParseContext* pCxt, SVnodeModifyOpStm
return parseBoundColumns(pCxt, &pStmt->pSql, BOUND_TAGS, pStmt->pTableMeta, &pCxt->tags); return parseBoundColumns(pCxt, &pStmt->pSql, BOUND_TAGS, pStmt->pTableMeta, &pCxt->tags);
} }
static int32_t parseTagValue(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, const char** ppSql, SSchema* pTagSchema, SToken* pToken, int32_t parseTagValue(SMsgBuf* pMsgBuf, const char** pSql, uint8_t precision, SSchema* pTagSchema, SToken* pToken,
SArray* pTagName, SArray* pTagVals, STag** pTag) { SArray* pTagName, SArray* pTagVals, STag** pTag) {
bool isNull = isNullValue(pTagSchema->type, pToken); bool isNull = isNullValue(pTagSchema->type, pToken);
if (!isNull) { if (!isNull && pTagName) {
taosArrayPush(pTagName, pTagSchema->name); taosArrayPush(pTagName, pTagSchema->name);
} }
if (pTagSchema->type == TSDB_DATA_TYPE_JSON) { if (pTagSchema->type == TSDB_DATA_TYPE_JSON) {
if (pToken->n > (TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) { if (pToken->n > (TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) {
return buildSyntaxErrMsg(&pCxt->msg, "json string too long than 4095", pToken->z); return buildSyntaxErrMsg(pMsgBuf, "json string too long than 4095", pToken->z);
} }
if (isNull) { if (isNull) {
return tTagNew(pTagVals, 1, true, pTag); return tTagNew(pTagVals, 1, true, pTag);
} else { } else {
return parseJsontoTagData(pToken->z, pTagVals, pTag, &pCxt->msg); return parseJsontoTagData(pToken->z, pTagVals, pTag, pMsgBuf);
} }
} }
if (isNull) return 0; if (isNull) return 0;
STagVal val = {0}; STagVal val = {0};
int32_t code = int32_t code = parseTagToken(pSql, pToken, pTagSchema, precision, &val, pMsgBuf);
parseTagToken(ppSql, pToken, pTagSchema, pStmt->pTableMeta->tableInfo.precision, &val, &pCxt->msg);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
taosArrayPush(pTagVals, &val); taosArrayPush(pTagVals, &val);
} }
@ -755,7 +750,7 @@ static int32_t buildCreateTbReq(SVnodeModifyOpStmt* pStmt, STag* pTag, SArray* p
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf, SMsgBuf* pMsgBuf, int8_t type) { int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf, SMsgBuf* pMsgBuf, int8_t type) {
if ((pToken->type != TK_NOW && pToken->type != TK_TODAY && pToken->type != TK_NK_INTEGER && if ((pToken->type != TK_NOW && pToken->type != TK_TODAY && pToken->type != TK_NK_INTEGER &&
pToken->type != TK_NK_STRING && pToken->type != TK_NK_FLOAT && pToken->type != TK_NK_BOOL && pToken->type != TK_NK_STRING && pToken->type != TK_NK_FLOAT && pToken->type != TK_NK_BOOL &&
pToken->type != TK_NULL && pToken->type != TK_NK_HEX && pToken->type != TK_NK_OCT && pToken->type != TK_NULL && pToken->type != TK_NK_HEX && pToken->type != TK_NK_OCT &&
@ -911,12 +906,19 @@ static int32_t checkSubtablePrivilege(SArray* pTagVals, SArray* pTagName, SNode*
static int32_t parseTagsClauseImpl(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) { static int32_t parseTagsClauseImpl(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) {
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
SSchema* pSchema = getTableTagSchema(pStmt->pTableMeta); SSchema* pSchema = getTableTagSchema(pStmt->pTableMeta);
SArray* pTagVals = taosArrayInit(pCxt->tags.numOfBound, sizeof(STagVal)); SArray* pTagVals = NULL;
SArray* pTagName = taosArrayInit(8, TSDB_COL_NAME_LEN); SArray* pTagName = NULL;
uint8_t precision = pStmt->pTableMeta->tableInfo.precision;
SToken token; SToken token;
bool isParseBindParam = false; bool isParseBindParam = false;
bool isJson = false; bool isJson = false;
STag* pTag = NULL; STag* pTag = NULL;
if (!(pTagVals = taosArrayInit(pCxt->tags.numOfBound, sizeof(STagVal))) ||
!(pTagName = taosArrayInit(pCxt->tags.numOfBound, TSDB_COL_NAME_LEN))) {
return TSDB_CODE_OUT_OF_MEMORY;
}
for (int i = 0; TSDB_CODE_SUCCESS == code && i < pCxt->tags.numOfBound; ++i) { for (int i = 0; TSDB_CODE_SUCCESS == code && i < pCxt->tags.numOfBound; ++i) {
NEXT_TOKEN_WITH_PREV(pStmt->pSql, token); NEXT_TOKEN_WITH_PREV(pStmt->pSql, token);
@ -938,16 +940,15 @@ static int32_t parseTagsClauseImpl(SInsertParseContext* pCxt, SVnodeModifyOpStmt
SSchema* pTagSchema = &pSchema[pCxt->tags.pColIndex[i]]; SSchema* pTagSchema = &pSchema[pCxt->tags.pColIndex[i]];
isJson = pTagSchema->type == TSDB_DATA_TYPE_JSON; isJson = pTagSchema->type == TSDB_DATA_TYPE_JSON;
code = checkAndTrimValue(&token, pCxt->tmpTokenBuf, &pCxt->msg, pTagSchema->type); code = checkAndTrimValue(&token, pCxt->tmpTokenBuf, &pCxt->msg, pTagSchema->type);
if (TK_NK_VARIABLE == token.type) { if (TSDB_CODE_SUCCESS == code && TK_NK_VARIABLE == token.type) {
code = buildSyntaxErrMsg(&pCxt->msg, "not expected tags values ", token.z); code = buildSyntaxErrMsg(&pCxt->msg, "not expected tags values ", token.z);
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = parseTagValue(pCxt, pStmt, &pStmt->pSql, pTagSchema, &token, pTagName, pTagVals, &pTag); code = parseTagValue(&pCxt->msg, &pStmt->pSql, precision, pTagSchema, &token, pTagName, pTagVals, &pTag);
} }
} }
if (TSDB_CODE_SUCCESS == code && NULL != pStmt->pTagCond) { if (TSDB_CODE_SUCCESS == code && NULL != pStmt->pTagCond) {
assert(0);
code = checkSubtablePrivilege(pTagVals, pTagName, &pStmt->pTagCond); code = checkSubtablePrivilege(pTagVals, pTagName, &pStmt->pTagCond);
} }
@ -960,8 +961,8 @@ static int32_t parseTagsClauseImpl(SInsertParseContext* pCxt, SVnodeModifyOpStmt
pTag = NULL; pTag = NULL;
} }
for (int i = 0; i < taosArrayGetSize(pTagVals); ++i) { for (int32_t i = 0; i < TARRAY_SIZE(pTagVals); ++i) {
STagVal* p = (STagVal*)taosArrayGet(pTagVals, i); STagVal* p = (STagVal*)TARRAY_GET_ELEM(pTagVals, i);
if (IS_VAR_DATA_TYPE(p->type)) { if (IS_VAR_DATA_TYPE(p->type)) {
taosMemoryFreeClear(p->pData); taosMemoryFreeClear(p->pData);
} }
@ -1426,9 +1427,9 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
switch (pSchema->type) { switch (pSchema->type) {
case TSDB_DATA_TYPE_BOOL: { case TSDB_DATA_TYPE_BOOL: {
if ((pToken->type == TK_NK_BOOL || pToken->type == TK_NK_STRING) && (pToken->n != 0)) { if ((pToken->type == TK_NK_BOOL || pToken->type == TK_NK_STRING) && (pToken->n != 0)) {
if (strncmp(pToken->z, "true", pToken->n) == 0) { if (IS_TRUE_STR(pToken->z, pToken->n)) {
pVal->value.val = TRUE_VALUE; pVal->value.val = TRUE_VALUE;
} else if (strncmp(pToken->z, "false", pToken->n) == 0) { } else if (IS_FALSE_STR(pToken->z, pToken->n)) {
pVal->value.val = FALSE_VALUE; pVal->value.val = FALSE_VALUE;
} else { } else {
return buildSyntaxErrMsg(&pCxt->msg, "invalid bool data", pToken->z); return buildSyntaxErrMsg(&pCxt->msg, "invalid bool data", pToken->z);
@ -1511,7 +1512,7 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
break; break;
} }
case TSDB_DATA_TYPE_FLOAT: { case TSDB_DATA_TYPE_FLOAT: {
double dv; double dv;
int32_t code = toDoubleEx(pToken->z, pToken->n, pToken->type, &dv); int32_t code = toDoubleEx(pToken->z, pToken->n, pToken->type, &dv);
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
return buildSyntaxErrMsg(&pCxt->msg, "illegal float data", pToken->z); return buildSyntaxErrMsg(&pCxt->msg, "illegal float data", pToken->z);
@ -1524,7 +1525,7 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
break; break;
} }
case TSDB_DATA_TYPE_DOUBLE: { case TSDB_DATA_TYPE_DOUBLE: {
double dv; double dv;
int32_t code = toDoubleEx(pToken->z, pToken->n, pToken->type, &dv); int32_t code = toDoubleEx(pToken->z, pToken->n, pToken->type, &dv);
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
return buildSyntaxErrMsg(&pCxt->msg, "illegal float data", pToken->z); return buildSyntaxErrMsg(&pCxt->msg, "illegal float data", pToken->z);
@ -1550,7 +1551,7 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
} }
case TSDB_DATA_TYPE_VARBINARY: { case TSDB_DATA_TYPE_VARBINARY: {
int32_t code = parseVarbinary(pToken, &pVal->value.pData, &pVal->value.nData, pSchema->bytes); int32_t code = parseVarbinary(pToken, &pVal->value.pData, &pVal->value.nData, pSchema->bytes);
if(code != TSDB_CODE_SUCCESS){ if (code != TSDB_CODE_SUCCESS) {
return generateSyntaxErrMsg(&pCxt->msg, code, pSchema->name); return generateSyntaxErrMsg(&pCxt->msg, code, pSchema->name);
} }
break; break;
@ -1588,9 +1589,9 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
break; break;
} }
case TSDB_DATA_TYPE_GEOMETRY: { case TSDB_DATA_TYPE_GEOMETRY: {
int32_t code = TSDB_CODE_FAILED; int32_t code = TSDB_CODE_FAILED;
unsigned char *output = NULL; unsigned char* output = NULL;
size_t size = 0; size_t size = 0;
code = parseGeometry(pToken, &output, &size); code = parseGeometry(pToken, &output, &size);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
@ -1599,13 +1600,11 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
// Too long values will raise the invalid sql error message // Too long values will raise the invalid sql error message
else if (size + VARSTR_HEADER_SIZE > pSchema->bytes) { else if (size + VARSTR_HEADER_SIZE > pSchema->bytes) {
code = generateSyntaxErrMsg(&pCxt->msg, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name); code = generateSyntaxErrMsg(&pCxt->msg, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name);
} } else {
else {
pVal->value.pData = taosMemoryMalloc(size); pVal->value.pData = taosMemoryMalloc(size);
if (NULL == pVal->value.pData) { if (NULL == pVal->value.pData) {
code = TSDB_CODE_OUT_OF_MEMORY; code = TSDB_CODE_OUT_OF_MEMORY;
} } else {
else {
memcpy(pVal->value.pData, output, size); memcpy(pVal->value.pData, output, size);
pVal->value.nData = size; pVal->value.nData = size;
} }
@ -1640,18 +1639,14 @@ static int32_t parseValueToken(SInsertParseContext* pCxt, const char** pSql, STo
return buildSyntaxErrMsg(&pCxt->msg, "primary timestamp should not be null", pToken->z); return buildSyntaxErrMsg(&pCxt->msg, "primary timestamp should not be null", pToken->z);
} }
if (TK_NK_VARIABLE == pToken->type && pSchema->type != TSDB_DATA_TYPE_TIMESTAMP) {
return buildSyntaxErrMsg(&pCxt->msg, "invalid values", pToken->z);
}
pVal->flag = CV_FLAG_NULL; pVal->flag = CV_FLAG_NULL;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
if (TSDB_CODE_SUCCESS == code && IS_NUMERIC_TYPE(pSchema->type) && pToken->n == 0) {
return buildSyntaxErrMsg(&pCxt->msg, "invalid numeric data", pToken->z);
}
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
if (pToken->n == 0 && IS_NUMERIC_TYPE(pSchema->type)) {
return buildSyntaxErrMsg(&pCxt->msg, "invalid numeric data", pToken->z);
}
code = parseValueTokenImpl(pCxt, pSql, pToken, pSchema, timePrec, pVal); code = parseValueTokenImpl(pCxt, pSql, pToken, pSchema, timePrec, pVal);
} }
@ -1729,18 +1724,19 @@ static int32_t processCtbTagsAfterCtbName(SInsertParseContext* pCxt, SVnodeModif
const SToken* tagTokens, SSchema* const* tagSchemas, const SToken* tagTokens, SSchema* const* tagSchemas,
int numOfTagTokens) { int numOfTagTokens) {
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
uint8_t precision = pStmt->pTableMeta->tableInfo.precision;
if (code == TSDB_CODE_SUCCESS && ctbFirst) { if (code == TSDB_CODE_SUCCESS && ctbFirst) {
for (int32_t i = 0; code == TSDB_CODE_SUCCESS && i < numOfTagTokens; ++i) { for (int32_t i = 0; code == TSDB_CODE_SUCCESS && i < numOfTagTokens; ++i) {
SToken* pTagToken = (SToken*)(tagTokens + i); SToken* pTagToken = (SToken*)(tagTokens + i);
SSchema* pTagSchema = tagSchemas[i]; SSchema* pTagSchema = tagSchemas[i];
code = checkAndTrimValue(pTagToken, pCxt->tmpTokenBuf, &pCxt->msg, pTagSchema->type); code = checkAndTrimValue(pTagToken, pCxt->tmpTokenBuf, &pCxt->msg, pTagSchema->type);
if (TK_NK_VARIABLE == pTagToken->type) { if (code == TSDB_CODE_SUCCESS && TK_NK_VARIABLE == pTagToken->type) {
code = buildInvalidOperationMsg(&pCxt->msg, "not expected tag"); code = buildInvalidOperationMsg(&pCxt->msg, "not expected tag");
} }
if (code == TSDB_CODE_SUCCESS) { if (code == TSDB_CODE_SUCCESS) {
code = parseTagValue(pCxt, pStmt, NULL, pTagSchema, pTagToken, pStbRowsCxt->aTagNames, pStbRowsCxt->aTagVals, code = parseTagValue(&pCxt->msg, NULL, precision, pTagSchema, pTagToken, pStbRowsCxt->aTagNames, pStbRowsCxt->aTagVals,
&pStbRowsCxt->pTag); &pStbRowsCxt->pTag);
} }
} }
@ -1760,11 +1756,12 @@ static int32_t doGetStbRowValues(SInsertParseContext* pCxt, SVnodeModifyOpStmt*
const SBoundColInfo* pCols, const SSchema* pSchemas, const SBoundColInfo* pCols, const SSchema* pSchemas,
SToken* tagTokens, SSchema** tagSchemas, int* pNumOfTagTokens, bool* bFoundTbName) { SToken* tagTokens, SSchema** tagSchemas, int* pNumOfTagTokens, bool* bFoundTbName) {
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
SArray* pTagNames = pStbRowsCxt->aTagNames; SArray* pTagNames = pStbRowsCxt->aTagNames;
SArray* pTagVals = pStbRowsCxt->aTagVals; SArray* pTagVals = pStbRowsCxt->aTagVals;
bool canParseTagsAfter = !pStbRowsCxt->pTagCond && !pStbRowsCxt->hasTimestampTag; bool canParseTagsAfter = !pStbRowsCxt->pTagCond && !pStbRowsCxt->hasTimestampTag;
int32_t numOfCols = getNumOfColumns(pStbRowsCxt->pStbMeta); int32_t numOfCols = getNumOfColumns(pStbRowsCxt->pStbMeta);
int32_t tbnameIdx = getTbnameSchemaIndex(pStbRowsCxt->pStbMeta); int32_t tbnameIdx = getTbnameSchemaIndex(pStbRowsCxt->pStbMeta);
uint8_t precision = getTableInfo(pStbRowsCxt->pStbMeta).precision;
for (int i = 0; i < pCols->numOfBound && (code) == TSDB_CODE_SUCCESS; ++i) { for (int i = 0; i < pCols->numOfBound && (code) == TSDB_CODE_SUCCESS; ++i) {
const char* pTmpSql = *ppSql; const char* pTmpSql = *ppSql;
bool ignoreComma = false; bool ignoreComma = false;
@ -1782,7 +1779,7 @@ static int32_t doGetStbRowValues(SInsertParseContext* pCxt, SVnodeModifyOpStmt*
if (pCols->pColIndex[i] < numOfCols) { if (pCols->pColIndex[i] < numOfCols) {
const SSchema* pSchema = &pSchemas[pCols->pColIndex[i]]; const SSchema* pSchema = &pSchemas[pCols->pColIndex[i]];
SColVal* pVal = taosArrayGet(pStbRowsCxt->aColVals, pCols->pColIndex[i]); SColVal* pVal = taosArrayGet(pStbRowsCxt->aColVals, pCols->pColIndex[i]);
code = parseValueToken(pCxt, ppSql, pToken, (SSchema*)pSchema, getTableInfo(pStbRowsCxt->pStbMeta).precision, pVal); code = parseValueToken(pCxt, ppSql, pToken, (SSchema*)pSchema, precision, pVal);
if (TK_NK_VARIABLE == pToken->type) { if (TK_NK_VARIABLE == pToken->type) {
code = buildInvalidOperationMsg(&pCxt->msg, "not expected row value"); code = buildInvalidOperationMsg(&pCxt->msg, "not expected row value");
} }
@ -1794,11 +1791,11 @@ static int32_t doGetStbRowValues(SInsertParseContext* pCxt, SVnodeModifyOpStmt*
++(*pNumOfTagTokens); ++(*pNumOfTagTokens);
} else { } else {
code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg, pTagSchema->type); code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg, pTagSchema->type);
if (TK_NK_VARIABLE == pToken->type) { if (code == TSDB_CODE_SUCCESS && TK_NK_VARIABLE == pToken->type) {
code = buildInvalidOperationMsg(&pCxt->msg, "not expected row value"); code = buildInvalidOperationMsg(&pCxt->msg, "not expected row value");
} }
if (code == TSDB_CODE_SUCCESS) { if (code == TSDB_CODE_SUCCESS) {
code = parseTagValue(pCxt, pStmt, ppSql, (SSchema*)pTagSchema, pToken, pTagNames, pTagVals, &pStbRowsCxt->pTag); code = parseTagValue(&pCxt->msg, ppSql, precision, (SSchema*)pTagSchema, pToken, pTagNames, pTagVals, &pStbRowsCxt->pTag);
} }
} }
} }

View File

@ -1517,12 +1517,13 @@ static EDealRes translateNormalValue(STranslateContext* pCxt, SValueNode* pVal,
void* data = NULL; void* data = NULL;
uint32_t size = 0; uint32_t size = 0;
bool isHexChar = isHex(pVal->literal, strlen(pVal->literal)); uint32_t vlen = strlen(pVal->literal);
bool isHexChar = isHex(pVal->literal, vlen);
if (isHexChar) { if (isHexChar) {
if (!isValidateHex(pVal->literal, strlen(pVal->literal))) { if (!isValidateHex(pVal->literal, vlen)) {
return TSDB_CODE_PAR_INVALID_VARBINARY; return TSDB_CODE_PAR_INVALID_VARBINARY;
} }
if (taosHex2Ascii(pVal->literal, strlen(pVal->literal), &data, &size) < 0) { if (taosHex2Ascii(pVal->literal, vlen, &data, &size) < 0) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
} else { } else {
@ -10025,75 +10026,6 @@ static int32_t createCastFuncForTag(STranslateContext* pCxt, SNode* pNode, SData
return code; return code;
} }
static int32_t createTagValFromExpr(STranslateContext* pCxt, SDataType targetDt, SNode* pNode, SValueNode** pVal) {
SNode* pCast = NULL;
int32_t code = createCastFuncForTag(pCxt, pNode, targetDt, &pCast);
SNode* pNew = NULL;
if (TSDB_CODE_SUCCESS == code) {
code = scalarCalculateConstants(pCast, &pNew);
}
if (TSDB_CODE_SUCCESS == code) {
pCast = pNew;
if (QUERY_NODE_VALUE != nodeType(pCast)) {
code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)pNode)->aliasName);
}
}
if (TSDB_CODE_SUCCESS == code) {
*pVal = (SValueNode*)pCast;
} else {
nodesDestroyNode(pCast);
}
return code;
}
static int32_t createTagValFromVal(STranslateContext* pCxt, SDataType targetDt, SNode* pNode, SValueNode** pVal) {
SValueNode* pTempVal = (SValueNode*)nodesCloneNode(pNode);
if (NULL == pTempVal) {
return TSDB_CODE_OUT_OF_MEMORY;
}
if (DEAL_RES_ERROR == translateValueImpl(pCxt, pTempVal, targetDt, true)) {
nodesDestroyNode((SNode*)pTempVal);
return pCxt->errCode;
}
*pVal = pTempVal;
return TSDB_CODE_SUCCESS;
}
static int32_t createTagVal(STranslateContext* pCxt, uint8_t precision, SSchema* pSchema, SNode* pNode,
SValueNode** pVal) {
if (QUERY_NODE_VALUE == nodeType(pNode)) {
return createTagValFromVal(pCxt, schemaToDataType(precision, pSchema), pNode, pVal);
} else {
return createTagValFromExpr(pCxt, schemaToDataType(precision, pSchema), pNode, pVal);
}
}
static int32_t buildJsonTagVal(STranslateContext* pCxt, SSchema* pTagSchema, SValueNode* pVal, SArray* pTagArray,
STag** ppTag) {
if (pVal->literal && strlen(pVal->literal) > (TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) {
return buildSyntaxErrMsg(&pCxt->msgBuf, "json string too long than 4095", pVal->literal);
}
return parseJsontoTagData(pVal->literal, pTagArray, ppTag, &pCxt->msgBuf);
}
static int32_t buildNormalTagVal(STranslateContext* pCxt, SSchema* pTagSchema, SValueNode* pVal, SArray* pTagArray) {
if (pVal->node.resType.type != TSDB_DATA_TYPE_NULL) {
void* nodeVal = nodesGetValueFromNode(pVal);
STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type};
// strcpy(val.colName, pTagSchema->name);
if (IS_VAR_DATA_TYPE(pTagSchema->type)) {
val.pData = varDataVal(nodeVal);
val.nData = varDataLen(nodeVal);
} else {
memcpy(&val.i64, nodeVal, pTagSchema->bytes);
}
taosArrayPush(pTagArray, &val);
}
return TSDB_CODE_SUCCESS;
}
static int32_t buildKVRowForBindTags(STranslateContext* pCxt, SCreateSubTableClause* pStmt, STableMeta* pSuperTableMeta, static int32_t buildKVRowForBindTags(STranslateContext* pCxt, SCreateSubTableClause* pStmt, STableMeta* pSuperTableMeta,
STag** ppTag, SArray* tagName) { STag** ppTag, SArray* tagName) {
int32_t numOfTags = getNumOfTags(pSuperTableMeta); int32_t numOfTags = getNumOfTags(pSuperTableMeta);
@ -10109,42 +10041,56 @@ static int32_t buildKVRowForBindTags(STranslateContext* pCxt, SCreateSubTableCla
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
bool isJson = false; bool isJson = false;
SNodeList* pVals = NULL; SNode * pTagNode = NULL, *pNode = NULL;
SNode * pTag = NULL, *pNode = NULL; uint8_t precision = pSuperTableMeta->tableInfo.precision;
FORBOTH(pTag, pStmt->pSpecificTags, pNode, pStmt->pValsOfTags) { SToken token;
SColumnNode* pCol = (SColumnNode*)pTag; char tokenBuf[TSDB_MAX_TAGS_LEN];
SSchema* pSchema = getTagSchema(pSuperTableMeta, pCol->colName); const char* tagStr = NULL;
if (NULL == pSchema) { FORBOTH(pTagNode, pStmt->pSpecificTags, pNode, pStmt->pValsOfTags) {
code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TAG_NAME, pCol->colName); tagStr = ((SValueNode*)pNode)->literal;
} NEXT_TOKEN_WITH_PREV(tagStr, token);
SValueNode* pVal = NULL;
SSchema* pSchema = NULL;
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = createTagVal(pCxt, pSuperTableMeta->tableInfo.precision, pSchema, pNode, &pVal); if ((pSchema = getTagSchema(pSuperTableMeta, ((SColumnNode*)pTagNode)->colName))) {
code = checkAndTrimValue(&token, tokenBuf, &pCxt->msgBuf, pSchema->type);
if (TSDB_CODE_SUCCESS == code && TK_NK_VARIABLE == token.type) {
code = TSDB_CODE_TSC_SQL_SYNTAX_ERROR;
}
} else {
code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TAG_NAME, ((SColumnNode*)pTagNode)->colName);
}
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
if (pSchema->type == TSDB_DATA_TYPE_JSON) { if (pSchema->type == TSDB_DATA_TYPE_JSON) {
isJson = true; isJson = true;
code = buildJsonTagVal(pCxt, pSchema, pVal, pTagArray, ppTag); }
taosArrayPush(tagName, pCol->colName); code = parseTagValue(&pCxt->msgBuf, &tagStr, precision, pSchema, &token, tagName, pTagArray, ppTag);
} else if (pVal->node.resType.type != TSDB_DATA_TYPE_NULL) { }
code = buildNormalTagVal(pCxt, pSchema, pVal, pTagArray);
taosArrayPush(tagName, pCol->colName); if (TSDB_CODE_SUCCESS == code) {
NEXT_VALID_TOKEN(tagStr, token);
if (token.n != 0) {
code = buildSyntaxErrMsg(&pCxt->msgBuf, "not expected tags values", token.z);
} }
} }
if (TSDB_CODE_SUCCESS == code) {
code = nodesListMakeAppend(&pVals, (SNode*)pVal);
}
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
break; break;
} }
} }
if (TSDB_CODE_SUCCESS == code && !isJson) { if (TSDB_CODE_SUCCESS == code && !isJson) {
code = tTagNew(pTagArray, 1, false, ppTag); code = tTagNew(pTagArray, 1, false, ppTag);
} }
nodesDestroyList(pVals); for (int i = 0; i < taosArrayGetSize(pTagArray); ++i) {
STagVal* p = (STagVal*)taosArrayGet(pTagArray, i);
if (IS_VAR_DATA_TYPE(p->type)) {
taosMemoryFreeClear(p->pData);
}
}
taosArrayDestroy(pTagArray); taosArrayDestroy(pTagArray);
return code; return code;
} }
@ -10162,51 +10108,52 @@ static int32_t buildKVRowForAllTags(STranslateContext* pCxt, SCreateSubTableClau
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
bool isJson = false; bool isJson = false;
int32_t index = 0; SNode* pNode;
SSchema* pTagSchemas = getTableTagSchema(pSuperTableMeta); uint8_t precision = pSuperTableMeta->tableInfo.precision;
SNodeList* pVals = NULL; SSchema* pTagSchema = getTableTagSchema(pSuperTableMeta);
SNode* pNode; SToken token;
char tokenBuf[TSDB_MAX_TAGS_LEN];
const char* tagStr = NULL;
FOREACH(pNode, pStmt->pValsOfTags) { FOREACH(pNode, pStmt->pValsOfTags) {
SValueNode* pVal = NULL; tagStr = ((SValueNode*)pNode)->literal;
SSchema* pTagSchema = pTagSchemas + index; NEXT_TOKEN_WITH_PREV(tagStr, token);
code = createTagVal(pCxt, pSuperTableMeta->tableInfo.precision, pTagSchema, pNode, &pVal);
code = checkAndTrimValue(&token, tokenBuf, &pCxt->msgBuf, pTagSchema->type);
if (TSDB_CODE_SUCCESS == code && TK_NK_VARIABLE == token.type) {
code = buildSyntaxErrMsg(&pCxt->msgBuf, "not expected tags values", token.z);
}
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
if (pTagSchema->type == TSDB_DATA_TYPE_JSON) { if (pTagSchema->type == TSDB_DATA_TYPE_JSON) {
isJson = true; isJson = true;
code = buildJsonTagVal(pCxt, pTagSchema, pVal, pTagArray, ppTag); }
if (TSDB_CODE_SUCCESS != code) { code = parseTagValue(&pCxt->msgBuf, &tagStr, precision, pTagSchema, &token, tagName, pTagArray, ppTag);
nodesDestroyNode((SNode*)pVal); }
}
taosArrayPush(tagName, pTagSchema->name); if (TSDB_CODE_SUCCESS == code) {
} else if (pVal->node.resType.type != TSDB_DATA_TYPE_NULL && !pVal->isNull) { NEXT_VALID_TOKEN(tagStr, token);
char* tmpVal = nodesGetValueFromNode(pVal); if (token.n != 0) {
STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; code = buildSyntaxErrMsg(&pCxt->msgBuf, "not expected tags values", token.z);
// strcpy(val.colName, pTagSchema->name);
if (IS_VAR_DATA_TYPE(pTagSchema->type)) {
val.pData = varDataVal(tmpVal);
val.nData = varDataLen(tmpVal);
} else {
memcpy(&val.i64, tmpVal, pTagSchema->bytes);
}
taosArrayPush(pTagArray, &val);
taosArrayPush(tagName, pTagSchema->name);
} }
} }
if (TSDB_CODE_SUCCESS == code) {
code = nodesListMakeAppend(&pVals, (SNode*)pVal);
}
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
break; break;
} }
++index; ++pTagSchema;
} }
if (TSDB_CODE_SUCCESS == code && !isJson) { if (TSDB_CODE_SUCCESS == code && !isJson) {
code = tTagNew(pTagArray, 1, false, ppTag); code = tTagNew(pTagArray, 1, false, ppTag);
} }
nodesDestroyList(pVals); for (int32_t i = 0; i < TARRAY_SIZE(pTagArray); ++i) {
STagVal* p = (STagVal*)TARRAY_GET_ELEM(pTagArray, i);
if (IS_VAR_DATA_TYPE(p->type)) {
taosMemoryFreeClear(p->pData);
}
}
taosArrayDestroy(pTagArray); taosArrayDestroy(pTagArray);
return code; return code;
} }
@ -10467,58 +10414,65 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE, "Invalid tag name: %s", return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE, "Invalid tag name: %s",
pStmt->colName); pStmt->colName);
} }
pReq->tagName = taosStrdup(pStmt->colName); pReq->tagName = taosStrdup(pStmt->colName);
if (NULL == pReq->tagName) { if (NULL == pReq->tagName) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
pReq->pTagArray = taosArrayInit(1, sizeof(STagVal));
if (NULL == pReq->pTagArray) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pReq->colId = pSchema->colId; pReq->colId = pSchema->colId;
pReq->tagType = pSchema->type;
SDataType targetDt = schemaToDataType(pTableMeta->tableInfo.precision, pSchema); int32_t code = 0;
if (QUERY_NODE_VALUE != pStmt->pVal->node.type) { STag* pTag = NULL;
SValueNode* pVal = NULL; SToken token;
pCxt->errCode = createTagValFromExpr(pCxt, targetDt, (SNode*)pStmt->pVal, &pVal); char tokenBuf[TSDB_MAX_TAGS_LEN];
if (pCxt->errCode) { const char* tagStr = pStmt->pVal->literal;
return pCxt->errCode; NEXT_TOKEN_WITH_PREV(tagStr, token);
} if (TSDB_CODE_SUCCESS == code) {
code = checkAndTrimValue(&token, tokenBuf, &pCxt->msgBuf, pSchema->type);
nodesDestroyNode((SNode*)pStmt->pVal); if (TSDB_CODE_SUCCESS == code && TK_NK_VARIABLE == token.type) {
pStmt->pVal = pVal; code = buildSyntaxErrMsg(&pCxt->msgBuf, "not expected tags values", token.z);
} else if (DEAL_RES_ERROR == translateValueImpl(pCxt, pStmt->pVal, targetDt, true)) {
return pCxt->errCode;
}
pReq->tagType = targetDt.type;
if (targetDt.type == TSDB_DATA_TYPE_JSON) {
if (pStmt->pVal->literal &&
strlen(pStmt->pVal->literal) > (TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) {
return buildSyntaxErrMsg(&pCxt->msgBuf, "json string too long than 4095", pStmt->pVal->literal);
}
SArray* pTagVals = taosArrayInit(1, sizeof(STagVal));
int32_t code = TSDB_CODE_SUCCESS;
STag* pTag = NULL;
code = parseJsontoTagData(pStmt->pVal->literal, pTagVals, &pTag, &pCxt->msgBuf);
taosArrayDestroy(pTagVals);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
pReq->nTagVal = pTag->len;
pReq->pTagVal = (uint8_t*)pTag;
pStmt->pVal->datum.p = (char*)pTag; // for free
} else {
pReq->isNull = pStmt->pVal->isNull;
pReq->nTagVal = pStmt->pVal->node.resType.bytes;
pReq->pTagVal = nodesGetValueFromNode(pStmt->pVal);
// data and length are seperated for new tag format STagVal
if (IS_VAR_DATA_TYPE(pStmt->pVal->node.resType.type)) {
pReq->nTagVal = varDataLen(pReq->pTagVal);
pReq->pTagVal = varDataVal(pReq->pTagVal);
} }
} }
return TSDB_CODE_SUCCESS; if (TSDB_CODE_SUCCESS == code) {
code = parseTagValue(&pCxt->msgBuf, &tagStr, pTableMeta->tableInfo.precision, pSchema, &token, NULL,
pReq->pTagArray, &pTag);
}
if (TSDB_CODE_SUCCESS == code && tagStr) {
NEXT_VALID_TOKEN(tagStr, token);
if (token.n != 0) {
code = buildSyntaxErrMsg(&pCxt->msgBuf, "not expected tags values", token.z);
}
}
if (TSDB_CODE_SUCCESS == code) {
if (pSchema->type == TSDB_DATA_TYPE_JSON) {
pReq->nTagVal = pTag->len;
pReq->pTagVal = (uint8_t*)pTag;
pStmt->pVal->datum.p = (char*)pTag; // for free
} else {
STagVal* pTagVal = taosArrayGet(pReq->pTagArray, 0);
if (pTagVal) {
pReq->isNull = false;
if (IS_VAR_DATA_TYPE(pSchema->type)) {
pReq->nTagVal = pTagVal->nData;
pReq->pTagVal = pTagVal->pData;
} else {
pReq->nTagVal = pSchema->bytes;
pReq->pTagVal = (uint8_t*)&pTagVal->i64;
}
} else {
pReq->isNull = true;
}
}
}
return code;
} }
static int32_t buildAddColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, STableMeta* pTableMeta, static int32_t buildAddColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, STableMeta* pTableMeta,
@ -10742,6 +10696,13 @@ static void destoryAlterTbReq(SVAlterTbReq* pReq) {
taosMemoryFree(pReq->colNewName); taosMemoryFree(pReq->colNewName);
taosMemoryFree(pReq->tagName); taosMemoryFree(pReq->tagName);
taosMemoryFree(pReq->newComment); taosMemoryFree(pReq->newComment);
for (int i = 0; i < taosArrayGetSize(pReq->pTagArray); ++i) {
STagVal* p = (STagVal*)taosArrayGet(pReq->pTagArray, i);
if (IS_VAR_DATA_TYPE(p->type)) {
taosMemoryFreeClear(p->pData);
}
}
taosArrayDestroy(pReq->pTagArray);
} }
static int32_t rewriteAlterTableImpl(STranslateContext* pCxt, SAlterTableStmt* pStmt, STableMeta* pTableMeta, static int32_t rewriteAlterTableImpl(STranslateContext* pCxt, SAlterTableStmt* pStmt, STableMeta* pTableMeta,

File diff suppressed because it is too large Load Diff

View File

@ -485,7 +485,7 @@ bool isHex(const char* z, uint32_t n){
} }
bool isValidateHex(const char* z, uint32_t n){ bool isValidateHex(const char* z, uint32_t n){
if(n % 2 != 0) return false; if((n & 1) != 0) return false;
for(size_t i = HEX_PREFIX_LEN; i < n; i++){ for(size_t i = HEX_PREFIX_LEN; i < n; i++){
if(isxdigit(z[i]) == 0){ if(isxdigit(z[i]) == 0){
return false; return false;
@ -494,13 +494,16 @@ bool isValidateHex(const char* z, uint32_t n){
return true; return true;
} }
int32_t taosHex2Ascii(const char *z, uint32_t n, void** data, uint32_t* size){ int32_t taosHex2Ascii(const char *z, uint32_t n, void **data, uint32_t *size) {
n -= HEX_PREFIX_LEN; // remove 0x n -= HEX_PREFIX_LEN; // remove 0x
z += HEX_PREFIX_LEN; z += HEX_PREFIX_LEN;
*size = n / HEX_PREFIX_LEN; *size = n / HEX_PREFIX_LEN;
if(*size == 0) return 0; if (*size == 0) {
uint8_t* tmp = (uint8_t*)taosMemoryCalloc(*size, 1); if (!(*data = taosStrdup(""))) return -1;
if(tmp == NULL) return -1; return 0;
}
uint8_t *tmp = (uint8_t *)taosMemoryCalloc(*size, 1);
if (tmp == NULL) return -1;
int8_t num = 0; int8_t num = 0;
uint8_t *byte = tmp + *size - 1; uint8_t *byte = tmp + *size - 1;

View File

@ -613,7 +613,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_GET_META_ERROR, "Fail to get table i
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS, "Not unique table/alias") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS, "Not unique table/alias")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_SYSTABLE_NOT_ALLOWED_FUNC, "System table not allowed") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_SYSTABLE_NOT_ALLOWED_FUNC, "System table not allowed")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_SYSTABLE_NOT_ALLOWED, "System table not allowed") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_SYSTABLE_NOT_ALLOWED, "System table not allowed")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_VARBINARY, "Invalidate varbinary value") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_VARBINARY, "Invalid varbinary value")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_IP_RANGE, "Invalid IPV4 address ranges") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_IP_RANGE, "Invalid IPV4 address ranges")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTERNAL_ERROR, "Parser internal error") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTERNAL_ERROR, "Parser internal error")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_STREAM_QUERY, "Invalid stream query") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_STREAM_QUERY, "Invalid stream query")

View File

@ -327,6 +327,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/db_tb_name_check.py ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/db_tb_name_check.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/InsertFuturets.py ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/InsertFuturets.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/insert_wide_column.py ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/insert_wide_column.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/insert_column_value.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_benchmark.py ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_benchmark.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k.py ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k.py -R ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k.py -R

View File

@ -28,10 +28,26 @@ if $data05 != NULL then
return -1 return -1
endi endi
sql_error create table st_bigint_2 using mt_bigint tags ('NULL') sql create table st_bigint_2 using mt_bigint tags ('NULL')
sql_error create table st_bigint_3 using mt_bigint tags ('NULL') sql show tags from st_bigint_2
sql_error create table st_bigint_4 using mt_bigint tags ("NULL") if $data05 != NULL then
sql_error create table st_bigint_5 using mt_bigint tags ("NULL") return -1
endi
sql create table st_bigint_3 using mt_bigint tags ('NULL')
sql show tags from st_bigint_3
if $data05 != NULL then
return -1
endi
sql create table st_bigint_4 using mt_bigint tags ("NULL")
sql show tags from st_bigint_4
if $data05 != NULL then
return -1
endi
sql create table st_bigint_5 using mt_bigint tags ("NULL")
sql show tags from st_bigint_5
if $data05 != NULL then
return -1
endi
sql create table st_bigint_6 using mt_bigint tags (-9223372036854775807) sql create table st_bigint_6 using mt_bigint tags (-9223372036854775807)
sql show tags from st_bigint_6 sql show tags from st_bigint_6
@ -97,6 +113,39 @@ if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_bigint_2 values (now, NULL)
sql select * from st_bigint_2
if $rows != 1 then
return -1
endi
if $data01 != NULL then
return -1
endi
sql insert into st_bigint_3 values (now, NULL)
sql select * from st_bigint_3
if $rows != 1 then
return -1
endi
if $data01 != NULL then
return -1
endi
sql insert into st_bigint_4 values (now, NULL)
sql select * from st_bigint_4
if $rows != 1 then
return -1
endi
if $data01 != NULL then
return -1
endi
sql insert into st_bigint_5 values (now, NULL)
sql select * from st_bigint_5
if $rows != 1 then
return -1
endi
if $data01 != NULL then
return -1
endi
sql insert into st_bigint_6 values (now, 9223372036854775807) sql insert into st_bigint_6 values (now, 9223372036854775807)
sql select * from st_bigint_6 sql select * from st_bigint_6
if $rows != 1 then if $rows != 1 then
@ -348,7 +397,7 @@ sql_error create table st_bigint_e0 using mt_bigint tags ("123abc")
sql_error create table st_bigint_e0 using mt_bigint tags (abc) sql_error create table st_bigint_e0 using mt_bigint tags (abc)
sql_error create table st_bigint_e0 using mt_bigint tags ("abc") sql_error create table st_bigint_e0 using mt_bigint tags ("abc")
sql_error create table st_bigint_e0 using mt_bigint tags (" ") sql_error create table st_bigint_e0 using mt_bigint tags (" ")
sql create table st_bigint_e0_error using mt_bigint tags ('') sql_error create table st_bigint_e0_error using mt_bigint tags ('')
sql create table st_bigint_e0 using mt_bigint tags (123) sql create table st_bigint_e0 using mt_bigint tags (123)
sql create table st_bigint_e1 using mt_bigint tags (123) sql create table st_bigint_e1 using mt_bigint tags (123)
@ -401,7 +450,7 @@ sql_error insert into st_bigint_e20 using mt_bigint tags ("123abc") values (now,
sql_error insert into st_bigint_e22 using mt_bigint tags (abc) values (now, -033) sql_error insert into st_bigint_e22 using mt_bigint tags (abc) values (now, -033)
sql_error insert into st_bigint_e23 using mt_bigint tags ("abc") values (now, -033) sql_error insert into st_bigint_e23 using mt_bigint tags ("abc") values (now, -033)
sql_error insert into st_bigint_e24 using mt_bigint tags (" ") values (now, -033) sql_error insert into st_bigint_e24 using mt_bigint tags (" ") values (now, -033)
sql insert into st_bigint_e25 using mt_bigint tags ('') values (now, -033) sql_error insert into st_bigint_e25 using mt_bigint tags ('') values (now, -033)
sql insert into st_bigint_e13 using mt_bigint tags (033) values (now, 00062) sql insert into st_bigint_e13 using mt_bigint tags (033) values (now, 00062)
sql insert into st_bigint_e14 using mt_bigint tags (033) values (now, 00062) sql insert into st_bigint_e14 using mt_bigint tags (033) values (now, 00062)
@ -417,15 +466,15 @@ sql insert into st_bigint_e23 using mt_bigint tags (033) values (now, 00062)
sql insert into st_bigint_e24 using mt_bigint tags (033) values (now, 00062) sql insert into st_bigint_e24 using mt_bigint tags (033) values (now, 00062)
sql insert into st_bigint_e25 using mt_bigint tags (033) values (now, 00062) sql insert into st_bigint_e25 using mt_bigint tags (033) values (now, 00062)
#sql alter table st_bigint_e13 set tag tagname=9223372036854775808 sql_error alter table st_bigint_e13 set tag tagname=9223372036854775808
#sql_error alter table st_bigint_e14 set tag tagname=-9223372036854775808 sql alter table st_bigint_e14 set tag tagname=-9223372036854775808
#sql alter table st_bigint_e15 set tag tagname=92233720368547758080 sql_error alter table st_bigint_e15 set tag tagname=92233720368547758080
#sql_error alter table st_bigint_e16 set tag tagname=-92233720368547758080 sql_error alter table st_bigint_e16 set tag tagname=-92233720368547758080
#sql_error alter table st_bigint_e19 set tag tagname=123abc sql_error alter table st_bigint_e19 set tag tagname=123abc
#sql_error alter table st_bigint_e20 set tag tagname="123abc" sql_error alter table st_bigint_e20 set tag tagname="123abc"
#sql_error alter table st_bigint_e22 set tag tagname=abc sql_error alter table st_bigint_e22 set tag tagname=abc
#sql_error alter table st_bigint_e23 set tag tagname="abc" sql_error alter table st_bigint_e23 set tag tagname="abc"
#sql_error alter table st_bigint_e24 set tag tagname=" " sql_error alter table st_bigint_e24 set tag tagname=" "
#sql_error alter table st_bigint_e25 set tag tagname='' sql_error alter table st_bigint_e25 set tag tagname=''
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -31,26 +31,26 @@ if $data05 != NULL then
endi endi
sql create table st_bool_2 using mt_bool tags ('NULL') sql create table st_bool_2 using mt_bool tags ('NULL')
sql show tags from st_bool_2 sql show tags from st_bool_2
if $data05 != false then if $data05 != NULL then
print ==3== expect: false, actually: $data05 print ==3== expect: NULL, actually: $data05
return -1 return -1
endi endi
sql create table st_bool_3 using mt_bool tags ('NULL') sql create table st_bool_3 using mt_bool tags ('NULL')
sql show tags from st_bool_3 sql show tags from st_bool_3
if $data05 != false then if $data05 != NULL then
print ==4== expect: false, actually: $data05 print ==4== expect: NULL, actually: $data05
return -1 return -1
endi endi
sql create table st_bool_4 using mt_bool tags ("NULL") sql create table st_bool_4 using mt_bool tags ("NULL")
sql show tags from st_bool_4 sql show tags from st_bool_4
if $data05 != false then if $data05 != NULL then
print ==5== expect: false, actually: $data05 print ==5== expect: NULL, actually: $data05
return -1 return -1
endi endi
sql create table st_bool_5 using mt_bool tags ("NULL") sql create table st_bool_5 using mt_bool tags ("NULL")
sql show tags from st_bool_5 sql show tags from st_bool_5
if $data05 != false then if $data05 != NULL then
print ==6== expect: false, actually: $data05 print ==6== expect: NULL, actually: $data05
return -1 return -1
endi endi
sql create table st_bool_6 using mt_bool tags ("true") sql create table st_bool_6 using mt_bool tags ("true")
@ -581,12 +581,12 @@ endi
# case 04: illegal input # case 04: illegal input
sql_error create table st_bool_e0 using mt_bool tags (123abc) sql_error create table st_bool_e0 using mt_bool tags (123abc)
sql create table st_bool_e1 using mt_bool tags ("123abc") sql_error create table st_bool_e1 using mt_bool tags ("123abc")
sql create table st_bool_e2 using mt_bool tags ("123") sql_error create table st_bool_e2 using mt_bool tags ("123")
sql_error create table st_bool_e3 using mt_bool tags (abc) sql_error create table st_bool_e3 using mt_bool tags (abc)
sql create table st_bool_e4 using mt_bool tags ("abc") sql_error create table st_bool_e4 using mt_bool tags ("abc")
sql create table st_bool_e5 using mt_bool tags (" ") sql_error create table st_bool_e5 using mt_bool tags (" ")
sql create table st_bool_e6 using mt_bool tags ('') sql_error create table st_bool_e6 using mt_bool tags ('')
sql create table st_bool_f0 using mt_bool tags (true) sql create table st_bool_f0 using mt_bool tags (true)
sql create table st_bool_f1 using mt_bool tags (true) sql create table st_bool_f1 using mt_bool tags (true)
@ -629,11 +629,11 @@ sql insert into st_bool_i5 using mt_bool tags (1) values (now, 1)
sql insert into st_bool_i6 using mt_bool tags (1) values (now, 1) sql insert into st_bool_i6 using mt_bool tags (1) values (now, 1)
sql_error alter table st_bool_i0 set tag tagname=123abc sql_error alter table st_bool_i0 set tag tagname=123abc
sql alter table st_bool_i1 set tag tagname="123abc" sql_error alter table st_bool_i1 set tag tagname="123abc"
sql alter table st_bool_i2 set tag tagname="123" sql_error alter table st_bool_i2 set tag tagname="123"
sql_error alter table st_bool_i3 set tag tagname=abc sql_error alter table st_bool_i3 set tag tagname=abc
sql alter table st_bool_i4 set tag tagname="abc" sql_error alter table st_bool_i4 set tag tagname="abc"
sql alter table st_bool_i5 set tag tagname=" " sql_error alter table st_bool_i5 set tag tagname=" "
sql alter table st_bool_i6 set tag tagname='' sql_error alter table st_bool_i6 set tag tagname=''
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -28,22 +28,22 @@ if $data05 != NULL then
endi endi
sql create table st_double_2 using mt_double tags ('NULL') sql create table st_double_2 using mt_double tags ('NULL')
sql show tags from st_double_2 sql show tags from st_double_2
if $data05 != 0.000000000 then if $data05 != NULL then
return -1 return -1
endi endi
sql create table st_double_3 using mt_double tags ('NULL') sql create table st_double_3 using mt_double tags ('NULL')
sql show tags from st_double_3 sql show tags from st_double_3
if $data05 != 0.000000000 then if $data05 != NULL then
return -1 return -1
endi endi
sql create table st_double_4 using mt_double tags ("NULL") sql create table st_double_4 using mt_double tags ("NULL")
sql show tags from st_double_4 sql show tags from st_double_4
if $data05 != 0.000000000 then if $data05 != NULL then
return -1 return -1
endi endi
sql create table st_double_5 using mt_double tags ("NULL") sql create table st_double_5 using mt_double tags ("NULL")
sql show tags from st_double_5 sql show tags from st_double_5
if $data05 != 0.000000000 then if $data05 != NULL then
return -1 return -1
endi endi
sql create table st_double_6 using mt_double tags (-123.321) sql create table st_double_6 using mt_double tags (-123.321)
@ -445,11 +445,11 @@ sql_error create table st_double_e0 using mt_double tags (-31.7976931348623157e+
#sql_error create table st_double_e0 using mt_double tags (12.80) truncate integer part #sql_error create table st_double_e0 using mt_double tags (12.80) truncate integer part
#sql_error create table st_double_e0 using mt_double tags (-11.80) #sql_error create table st_double_e0 using mt_double tags (-11.80)
sql_error create table st_double_e0 using mt_double tags (123abc) sql_error create table st_double_e0 using mt_double tags (123abc)
sql create table st_double_e0_1 using mt_double tags ("123abc") sql_error create table st_double_e0_1 using mt_double tags ("123abc")
sql_error create table st_double_e0 using mt_double tags (abc) sql_error create table st_double_e0 using mt_double tags (abc)
sql create table st_double_e0_2 using mt_double tags ("abc") sql_error create table st_double_e0_2 using mt_double tags ("abc")
sql create table st_double_e0_3 using mt_double tags (" ") sql_error create table st_double_e0_3 using mt_double tags (" ")
sql create table st_double_e0_4 using mt_double tags ('') sql_error create table st_double_e0_4 using mt_double tags ('')
sql create table st_double_e0 using mt_double tags (123) sql create table st_double_e0 using mt_double tags (123)
sql create table st_double_e1 using mt_double tags (123) sql create table st_double_e1 using mt_double tags (123)
@ -502,7 +502,8 @@ sql_error insert into st_double_e20 using mt_double tags ("123abc") values (now,
sql_error insert into st_double_e22 using mt_double tags (abc) values (now, -033) sql_error insert into st_double_e22 using mt_double tags (abc) values (now, -033)
sql_error insert into st_double_e23 using mt_double tags ("abc") values (now, -033) sql_error insert into st_double_e23 using mt_double tags ("abc") values (now, -033)
sql_error insert into st_double_e24 using mt_double tags (" ") values (now, -033) sql_error insert into st_double_e24 using mt_double tags (" ") values (now, -033)
sql insert into st_double_e25 using mt_double tags ('') values (now, -033) sql_error insert into st_double_e25 using mt_double tags ('') values (now, -033)
sql insert into st_double_e20 using mt_double tags ("123") values (now, -033)
sql insert into st_double_e13 using mt_double tags (033) values (now, 00062) sql insert into st_double_e13 using mt_double tags (033) values (now, 00062)
sql insert into st_double_e14 using mt_double tags (033) values (now, 00062) sql insert into st_double_e14 using mt_double tags (033) values (now, 00062)
@ -523,10 +524,11 @@ sql_error alter table st_double_e14 set tag tagname=-1.8976931348623157e+308
sql_error alter table st_double_e15 set tag tagname=131.7976931348623157e+308 sql_error alter table st_double_e15 set tag tagname=131.7976931348623157e+308
sql_error alter table st_double_e16 set tag tagname=-131.7976931348623157e+308 sql_error alter table st_double_e16 set tag tagname=-131.7976931348623157e+308
sql_error alter table st_double_e19 set tag tagname=123abc sql_error alter table st_double_e19 set tag tagname=123abc
sql alter table st_double_e20 set tag tagname="123abc" sql_error alter table st_double_e20 set tag tagname="123abc"
sql_error alter table st_double_e22 set tag tagname=abc sql_error alter table st_double_e22 set tag tagname=abc
sql alter table st_double_e23 set tag tagname="abc" sql_error alter table st_double_e23 set tag tagname="abc"
sql alter table st_double_e24 set tag tagname=" " sql_error alter table st_double_e24 set tag tagname=" "
sql alter table st_double_e25 set tag tagname='' sql_error alter table st_double_e25 set tag tagname=''
sql alter table st_double_e25 set tag tagname='123'
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -29,22 +29,22 @@ if $data05 != NULL then
endi endi
sql create table st_float_2 using mt_float tags ('NULL') sql create table st_float_2 using mt_float tags ('NULL')
sql show tags from st_float_2 sql show tags from st_float_2
if $data05 != 0.00000 then if $data05 != NULL then
return -1 return -1
endi endi
sql create table st_float_3 using mt_float tags ('NULL') sql create table st_float_3 using mt_float tags ('NULL')
sql show tags from st_float_3 sql show tags from st_float_3
if $data05 != 0.00000 then if $data05 != NULL then
return -1 return -1
endi endi
sql create table st_float_4 using mt_float tags ("NULL") sql create table st_float_4 using mt_float tags ("NULL")
sql show tags from st_float_4 sql show tags from st_float_4
if $data05 != 0.00000 then if $data05 != NULL then
return -1 return -1
endi endi
sql create table st_float_5 using mt_float tags ("NULL") sql create table st_float_5 using mt_float tags ("NULL")
sql show tags from st_float_5 sql show tags from st_float_5
if $data05 != 0.00000 then if $data05 != NULL then
return -1 return -1
endi endi
sql create table st_float_6 using mt_float tags (-123.321) sql create table st_float_6 using mt_float tags (-123.321)
@ -477,11 +477,11 @@ sql_error create table st_float_e0 using mt_float tags (-333.40282347e+38)
#sql_error create table st_float_e0 using mt_float tags (12.80) truncate integer part #sql_error create table st_float_e0 using mt_float tags (12.80) truncate integer part
#sql_error create table st_float_e0 using mt_float tags (-11.80) #sql_error create table st_float_e0 using mt_float tags (-11.80)
sql_error create table st_float_e0 using mt_float tags (123abc) sql_error create table st_float_e0 using mt_float tags (123abc)
sql create table st_float_e0_1 using mt_float tags ("123abc") sql_error create table st_float_e0_1 using mt_float tags ("123abc")
sql_error create table st_float_e0 using mt_float tags (abc) sql_error create table st_float_e0 using mt_float tags (abc)
sql create table st_float_e0_2 using mt_float tags ("abc") sql_error create table st_float_e0_2 using mt_float tags ("abc")
sql create table st_float_e0_3 using mt_float tags (" ") sql_error create table st_float_e0_3 using mt_float tags (" ")
sql create table st_float_e0_4 using mt_float tags ('') sql_error create table st_float_e0_4 using mt_float tags ('')
sql create table st_float_e0 using mt_float tags (123) sql create table st_float_e0 using mt_float tags (123)
sql create table st_float_e1 using mt_float tags (123) sql create table st_float_e1 using mt_float tags (123)
@ -534,7 +534,7 @@ sql_error insert into st_float_e20 using mt_float tags ("123abc") values (now, -
sql_error insert into st_float_e22 using mt_float tags (abc) values (now, -033) sql_error insert into st_float_e22 using mt_float tags (abc) values (now, -033)
sql_error insert into st_float_e23 using mt_float tags ("abc") values (now, -033) sql_error insert into st_float_e23 using mt_float tags ("abc") values (now, -033)
sql_error insert into st_float_e24 using mt_float tags (" ") values (now, -033) sql_error insert into st_float_e24 using mt_float tags (" ") values (now, -033)
sql insert into st_float_e25_3 using mt_float tags ('') values (now, -033) sql_error insert into st_float_e25_3 using mt_float tags ('') values (now, -033)
sql insert into st_float_e13 using mt_float tags (033) values (now, 00062) sql insert into st_float_e13 using mt_float tags (033) values (now, 00062)
sql insert into st_float_e14 using mt_float tags (033) values (now, 00062) sql insert into st_float_e14 using mt_float tags (033) values (now, 00062)
@ -555,10 +555,10 @@ sql_error alter table st_float_e14 set tag tagname=-3.50282347e+38
sql_error alter table st_float_e15 set tag tagname=13.40282347e+38 sql_error alter table st_float_e15 set tag tagname=13.40282347e+38
sql_error alter table st_float_e16 set tag tagname=-13.40282347e+38 sql_error alter table st_float_e16 set tag tagname=-13.40282347e+38
sql_error alter table st_float_e19 set tag tagname=123abc sql_error alter table st_float_e19 set tag tagname=123abc
sql alter table st_float_e20 set tag tagname="123abc" sql_error alter table st_float_e20 set tag tagname="123abc"
sql_error alter table st_float_e22 set tag tagname=abc sql_error alter table st_float_e22 set tag tagname=abc
sql alter table st_float_e23 set tag tagname="abc" sql_error alter table st_float_e23 set tag tagname="abc"
sql alter table st_float_e24 set tag tagname=" " sql_error alter table st_float_e24 set tag tagname=" "
sql alter table st_float_e25 set tag tagname='' sql_error alter table st_float_e25 set tag tagname=''
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -28,10 +28,26 @@ if $data05 != NULL then
return -1 return -1
endi endi
sql_error create table st_int_2 using mt_int tags ('NULL') sql create table st_int_2 using mt_int tags ('NULL')
sql_error create table st_int_3 using mt_int tags ('NULL') sql show tags from st_int_2
sql_error create table st_int_4 using mt_int tags ("NULL") if $data05 != NULL then
sql_error create table st_int_5 using mt_int tags ("NULL") return -1
endi
sql create table st_int_3 using mt_int tags ('NULL')
sql show tags from st_int_3
if $data05 != NULL then
return -1
endi
sql create table st_int_4 using mt_int tags ("NULL")
sql show tags from st_int_4
if $data05 != NULL then
return -1
endi
sql create table st_int_5 using mt_int tags ("NULL")
sql show tags from st_int_5
if $data05 != NULL then
return -1
endi
sql create table st_int_6 using mt_int tags (-2147483647) sql create table st_int_6 using mt_int tags (-2147483647)
sql show tags from st_int_6 sql show tags from st_int_6
@ -346,7 +362,7 @@ sql_error create table st_int_e0 using mt_int tags ("123abc")
sql_error create table st_int_e0 using mt_int tags (abc) sql_error create table st_int_e0 using mt_int tags (abc)
sql_error create table st_int_e0 using mt_int tags ("abc") sql_error create table st_int_e0 using mt_int tags ("abc")
sql_error create table st_int_e0 using mt_int tags (" ") sql_error create table st_int_e0 using mt_int tags (" ")
sql create table st_int_e0_err2 using mt_int tags ('') sql_error create table st_int_e0_err2 using mt_int tags ('')
sql create table st_int_e0 using mt_int tags (123) sql create table st_int_e0 using mt_int tags (123)
sql create table st_int_e1 using mt_int tags (123) sql create table st_int_e1 using mt_int tags (123)
@ -399,7 +415,10 @@ sql_error insert into st_int_e20 using mt_int tags ("123abc") values (now, -033)
sql_error insert into st_int_e22 using mt_int tags (abc) values (now, -033) sql_error insert into st_int_e22 using mt_int tags (abc) values (now, -033)
sql_error insert into st_int_e23 using mt_int tags ("abc") values (now, -033) sql_error insert into st_int_e23 using mt_int tags ("abc") values (now, -033)
sql_error insert into st_int_e24 using mt_int tags (" ") values (now, -033) sql_error insert into st_int_e24 using mt_int tags (" ") values (now, -033)
sql insert into st_int_e25_1 using mt_int tags ('') values (now, -033) sql_error insert into st_int_e25_1 using mt_int tags ('') values (now, -033)
sql insert into st_int_e26_1 using mt_int tags ('123') values (now, -033)
sql insert into st_int_e27_1 using mt_int tags ('12.80') values (now, -033)
sql insert into st_int_e28_1 using mt_int tags ('-11.80') values (now, -033)
sql insert into st_int_e13 using mt_int tags (033) values (now, 00062) sql insert into st_int_e13 using mt_int tags (033) values (now, 00062)
sql insert into st_int_e14 using mt_int tags (033) values (now, 00062) sql insert into st_int_e14 using mt_int tags (033) values (now, 00062)
@ -424,6 +443,9 @@ sql_error alter table st_int_e20 set tag tagname="123abc"
sql_error alter table st_int_e22 set tag tagname=abc sql_error alter table st_int_e22 set tag tagname=abc
sql_error alter table st_int_e23 set tag tagname="abc" sql_error alter table st_int_e23 set tag tagname="abc"
sql_error alter table st_int_e24 set tag tagname=" " sql_error alter table st_int_e24 set tag tagname=" "
sql alter table st_int_e25 set tag tagname='' sql_error alter table st_int_e25 set tag tagname=''
sql alter table st_int_e26_1 set tag tagname='123'
sql alter table st_int_e27_1 set tag tagname='12.80'
sql alter table st_int_e28_1 set tag tagname='-11.80'
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -31,10 +31,27 @@ if $data05 != NULL then
return -1 return -1
endi endi
sql_error create table st_smallint_2 using mt_smallint tags ('NULL')
sql_error create table st_smallint_3 using mt_smallint tags ('NULL') sql create table st_smallint_2 using mt_smallint tags ('NULL')
sql_error create table st_smallint_4 using mt_smallint tags ("NULL") sql show tags from st_smallint_2
sql_error create table st_smallint_5 using mt_smallint tags ("NULL") if $data05 != NULL then
return -1
endi
sql create table st_smallint_3 using mt_smallint tags ('NULL')
sql show tags from st_smallint_3
if $data05 != NULL then
return -1
endi
sql create table st_smallint_4 using mt_smallint tags ("NULL")
sql show tags from st_smallint_4
if $data05 != NULL then
return -1
endi
sql create table st_smallint_5 using mt_smallint tags ("NULL")
sql show tags from st_smallint_5
if $data05 != NULL then
return -1
endi
sql create table st_smallint_6 using mt_smallint tags (-32767) sql create table st_smallint_6 using mt_smallint tags (-32767)
sql show tags from st_smallint_6 sql show tags from st_smallint_6
@ -349,7 +366,8 @@ sql_error create table st_smallint_e0 using mt_smallint tags ("123abc")
sql_error create table st_smallint_e0 using mt_smallint tags (abc) sql_error create table st_smallint_e0 using mt_smallint tags (abc)
sql_error create table st_smallint_e0 using mt_smallint tags ("abc") sql_error create table st_smallint_e0 using mt_smallint tags ("abc")
sql_error create table st_smallint_e0 using mt_smallint tags (" ") sql_error create table st_smallint_e0 using mt_smallint tags (" ")
sql create table st_smallint_e0_1 using mt_smallint tags ('') sql_error create table st_smallint_e0_1 using mt_smallint tags ('')
sql create table st_smallint_e0_2 using mt_smallint tags ('123')
sql create table st_smallint_e0 using mt_smallint tags (123) sql create table st_smallint_e0 using mt_smallint tags (123)
sql create table st_smallint_e1 using mt_smallint tags (123) sql create table st_smallint_e1 using mt_smallint tags (123)
@ -402,7 +420,8 @@ sql_error insert into st_smallint_e20 using mt_smallint tags ("123abc") values (
sql_error insert into st_smallint_e22 using mt_smallint tags (abc) values (now, -033) sql_error insert into st_smallint_e22 using mt_smallint tags (abc) values (now, -033)
sql_error insert into st_smallint_e23 using mt_smallint tags ("abc") values (now, -033) sql_error insert into st_smallint_e23 using mt_smallint tags ("abc") values (now, -033)
sql_error insert into st_smallint_e24 using mt_smallint tags (" ") values (now, -033) sql_error insert into st_smallint_e24 using mt_smallint tags (" ") values (now, -033)
sql insert into st_smallint_e25 using mt_smallint tags ('') values (now, -033) sql_error insert into st_smallint_e25 using mt_smallint tags ('') values (now, -033)
sql insert into st_smallint_e26 using mt_smallint tags ('123') values (now, -033)
sql insert into st_smallint_e13 using mt_smallint tags (033) values (now, 00062) sql insert into st_smallint_e13 using mt_smallint tags (033) values (now, 00062)
sql insert into st_smallint_e14 using mt_smallint tags (033) values (now, 00062) sql insert into st_smallint_e14 using mt_smallint tags (033) values (now, 00062)
@ -427,6 +446,7 @@ sql_error alter table st_smallint_e20 set tag tagname="123abc"
sql_error alter table st_smallint_e22 set tag tagname=abc sql_error alter table st_smallint_e22 set tag tagname=abc
sql_error alter table st_smallint_e23 set tag tagname="abc" sql_error alter table st_smallint_e23 set tag tagname="abc"
sql_error alter table st_smallint_e24 set tag tagname=" " sql_error alter table st_smallint_e24 set tag tagname=" "
sql alter table st_smallint_e25 set tag tagname='' sql_error alter table st_smallint_e25 set tag tagname=''
sql alter table st_smallint_e26 set tag tagname='123'
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -29,10 +29,26 @@ if $data05 != NULL then
return -1 return -1
endi endi
sql_error create table st_tinyint_2 using mt_tinyint tags ('NULL') sql create table st_tinyint_2 using mt_tinyint tags ('NULL')
sql_error create table st_tinyint_3 using mt_tinyint tags ('NULL') sql show tags from st_tinyint_2
sql_error create table st_tinyint_4 using mt_tinyint tags ("NULL") if $data05 != NULL then
sql_error create table st_tinyint_5 using mt_tinyint tags ("NULL") return -1
endi
sql create table st_tinyint_3 using mt_tinyint tags ('NULL')
sql show tags from st_tinyint_3
if $data05 != NULL then
return -1
endi
sql create table st_tinyint_4 using mt_tinyint tags ("NULL")
sql show tags from st_tinyint_4
if $data05 != NULL then
return -1
endi
sql create table st_tinyint_5 using mt_tinyint tags ("NULL")
sql show tags from st_tinyint_5
if $data05 != NULL then
return -1
endi
sql create table st_tinyint_6 using mt_tinyint tags (-127) sql create table st_tinyint_6 using mt_tinyint tags (-127)
sql show tags from st_tinyint_6 sql show tags from st_tinyint_6
@ -97,6 +113,40 @@ endi
if $data01 != NULL then if $data01 != NULL then
return -1 return -1
endi endi
sql insert into st_tinyint_2 values (now, NULL)
sql select * from st_tinyint_2
if $rows != 1 then
return -1
endi
if $data01 != NULL then
return -1
endi
sql insert into st_tinyint_3 values (now, NULL)
sql select * from st_tinyint_3
if $rows != 1 then
return -1
endi
if $data01 != NULL then
return -1
endi
sql insert into st_tinyint_4 values (now, NULL)
sql select * from st_tinyint_4
if $rows != 1 then
return -1
endi
if $data01 != NULL then
return -1
endi
sql insert into st_tinyint_5 values (now, NULL)
sql select * from st_tinyint_5
if $rows != 1 then
return -1
endi
if $data01 != NULL then
return -1
endi
sql insert into st_tinyint_6 values (now, 127) sql insert into st_tinyint_6 values (now, 127)
sql select * from st_tinyint_6 sql select * from st_tinyint_6
if $rows != 1 then if $rows != 1 then
@ -347,7 +397,7 @@ sql_error create table st_tinyint_e0 using mt_tinyint tags ("123abc")
sql_error create table st_tinyint_e0 using mt_tinyint tags (abc) sql_error create table st_tinyint_e0 using mt_tinyint tags (abc)
sql_error create table st_tinyint_e0 using mt_tinyint tags ("abc") sql_error create table st_tinyint_e0 using mt_tinyint tags ("abc")
sql_error create table st_tinyint_e0 using mt_tinyint tags (" ") sql_error create table st_tinyint_e0 using mt_tinyint tags (" ")
sql create table st_tinyint_e0_2 using mt_tinyint tags ('') sql_error create table st_tinyint_e0_2 using mt_tinyint tags ('')
sql create table st_tinyint_e0 using mt_tinyint tags (123) sql create table st_tinyint_e0 using mt_tinyint tags (123)
sql create table st_tinyint_e1 using mt_tinyint tags (123) sql create table st_tinyint_e1 using mt_tinyint tags (123)
@ -400,7 +450,7 @@ sql_error insert into st_tinyint_e20 using mt_tinyint tags ("123abc") values (no
sql_error insert into st_tinyint_e22 using mt_tinyint tags (abc) values (now, -033) sql_error insert into st_tinyint_e22 using mt_tinyint tags (abc) values (now, -033)
sql_error insert into st_tinyint_e23 using mt_tinyint tags ("abc") values (now, -033) sql_error insert into st_tinyint_e23 using mt_tinyint tags ("abc") values (now, -033)
sql_error insert into st_tinyint_e24 using mt_tinyint tags (" ") values (now, -033) sql_error insert into st_tinyint_e24 using mt_tinyint tags (" ") values (now, -033)
sql insert into st_tinyint_e25 using mt_tinyint tags ('') values (now, -033) sql_error insert into st_tinyint_e25 using mt_tinyint tags ('') values (now, -033)
sql insert into st_tinyint_e13 using mt_tinyint tags (033) values (now, 00062) sql insert into st_tinyint_e13 using mt_tinyint tags (033) values (now, 00062)
sql insert into st_tinyint_e14 using mt_tinyint tags (033) values (now, 00062) sql insert into st_tinyint_e14 using mt_tinyint tags (033) values (now, 00062)
@ -425,6 +475,6 @@ sql_error alter table st_tinyint_e20 set tag tagname="123abc"
sql_error alter table st_tinyint_e22 set tag tagname=abc sql_error alter table st_tinyint_e22 set tag tagname=abc
sql_error alter table st_tinyint_e23 set tag tagname="abc" sql_error alter table st_tinyint_e23 set tag tagname="abc"
sql_error alter table st_tinyint_e24 set tag tagname=" " sql_error alter table st_tinyint_e24 set tag tagname=" "
sql alter table st_tinyint_e25 set tag tagname='' sql_error alter table st_tinyint_e25 set tag tagname=''
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -187,7 +187,7 @@ sql_error create table $tb using $mt tags (abc)
sql_error create table $tb using $mt tags ('abc') sql_error create table $tb using $mt tags ('abc')
sql drop table if exists $tb sql drop table if exists $tb
sql reset query cache sql reset query cache
sql_error create table $tb using $mt tags (1e1) sql create table $tb using $mt tags (1e1)
sql_error create table $tb using $mt tags ('1e1') sql_error create table $tb using $mt tags ('1e1')
sql_error create table $tb using $mt tags (2147483649) sql_error create table $tb using $mt tags (2147483649)

View File

@ -139,8 +139,8 @@ if $data03 != 0 then
endi endi
### bool: ### bool:
sql create table stx using mt2 tags ('NULL', '123aBc', 104, '123') sql_error create table stx using mt2 tags ('NULL', '123aBc', 104, '123')
sql create table sty using mt2 tags ('NULL', '123aBc', 104, 'xtz') sql_error create table sty using mt2 tags ('NULL', '123aBc', 104, 'xtz')
sql create table st4 using mt2 tags ('NULL', '123aBc', 104, 'NULL') sql create table st4 using mt2 tags ('NULL', '123aBc', 104, 'NULL')
sql insert into st4 (ts, col1) values(now, 1) sql insert into st4 (ts, col1) values(now, 1)
sql select tag1,tag2,tag3,tag5 from st4 sql select tag1,tag2,tag3,tag5 from st4
@ -156,7 +156,7 @@ endi
if $data02 != 104 then if $data02 != 104 then
return -1 return -1
endi endi
if $data03 != 0 then if $data03 != NULL then
print ==6== expect: NULL, actually: $data03 print ==6== expect: NULL, actually: $data03
return -1 return -1
endi endi
@ -306,8 +306,8 @@ if $data02 != NULL then
print ==10== expect: NULL, actually: $data02 print ==10== expect: NULL, actually: $data02
return -1 return -1
endi endi
sql_error alter table st41 set tag tag_int = 'NULL' sql alter table st41 set tag tag_int = 'NULL'
sql alter table st41 set tag tag_int = '' sql_error alter table st41 set tag tag_int = ''
sql_error alter table st41 set tag tag_int = abc379 sql_error alter table st41 set tag tag_int = abc379
################### bool ################### bool
@ -333,8 +333,8 @@ if $data03 != 1 then
endi endi
sql alter table st41 set tag tag_bool = 'NULL' sql alter table st41 set tag tag_bool = 'NULL'
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41 sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
if $data03 != 0 then if $data03 != NULL then
print ==14== expect: 0, actually: $data03 print ==14== expect: NULL, actually: $data03
return -1 return -1
endi endi
sql alter table st41 set tag tag_bool = NULL sql alter table st41 set tag tag_bool = NULL
@ -343,8 +343,8 @@ if $data03 != NULL then
return -1 return -1
endi endi
sql alter table st41 set tag tag_bool = '123' sql_error alter table st41 set tag tag_bool = '123'
sql alter table st41 set tag tag_bool = '' sql_error alter table st41 set tag tag_bool = ''
sql_error alter table st41 set tag tag_bool = abc379 sql_error alter table st41 set tag tag_bool = abc379
################### float ################### float
@ -396,10 +396,10 @@ if $data04 != -54.12346 then
print ==19== expect: -54.12346, actually : $data04 print ==19== expect: -54.12346, actually : $data04
return -1 return -1
endi endi
sql alter table st41 set tag tag_float = '' sql_error alter table st41 set tag tag_float = ''
sql alter table st41 set tag tag_float = 'abc' sql_error alter table st41 set tag tag_float = 'abc'
sql alter table st41 set tag tag_float = '123abc' sql_error alter table st41 set tag tag_float = '123abc'
sql_error alter table st41 set tag tag_float = abc sql_error alter table st41 set tag tag_float = abc
################### double ################### double
@ -428,14 +428,15 @@ if $data05 != NULL then
endi endi
sql alter table st41 set tag tag_double = 'NULL' sql alter table st41 set tag tag_double = 'NULL'
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41 sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
if $data05 != 0.000000000 then if $data05 != NULL then
print ==20== expect: 0.000000000, actually : $data05 print ==20== expect: NULL, actually : $data05
return -1 return -1
endi endi
sql alter table st41 set tag tag_double = '' sql_error alter table st41 set tag tag_double = ''
sql alter table st41 set tag tag_double = 'abc' sql alter table st41 set tag tag_double = '123'
sql alter table st41 set tag tag_double = '123abc' sql_error alter table st41 set tag tag_double = 'abc'
sql_error alter table st41 set tag tag_double = '123abc'
sql_error alter table st41 set tag tag_double = abc sql_error alter table st41 set tag tag_double = abc
################### bigint smallint tinyint ################### bigint smallint tinyint
@ -459,8 +460,8 @@ if $data00 != -9223372036854775807 then
endi endi
sql alter table st51 set tag tag_bigint = -9223372036854775808 sql alter table st51 set tag tag_bigint = -9223372036854775808
sql_error alter table st51 set tag tag_bigint = 'NULL' sql alter table st51 set tag tag_bigint = 'NULL'
sql alter table st51 set tag tag_bigint = '' sql_error alter table st51 set tag tag_bigint = ''
sql_error alter table st51 set tag tag_bigint = abc379 sql_error alter table st51 set tag tag_bigint = abc379
#### ####
@ -480,8 +481,8 @@ if $data01 != -32767 then
endi endi
sql alter table st51 set tag tag_smallint = -32768 sql alter table st51 set tag tag_smallint = -32768
sql_error alter table st51 set tag tag_smallint = 'NULL' sql alter table st51 set tag tag_smallint = 'NULL'
sql alter table st51 set tag tag_smallint = '' sql_error alter table st51 set tag tag_smallint = ''
sql_error alter table st51 set tag tag_smallint = abc379 sql_error alter table st51 set tag tag_smallint = abc379
#### ####
@ -499,8 +500,8 @@ if $data02 != -127 then
endi endi
sql alter table st51 set tag tag_tinyint = '-128' sql alter table st51 set tag tag_tinyint = '-128'
sql_error alter table st51 set tag tag_tinyint = 128 sql_error alter table st51 set tag tag_tinyint = 128
sql_error alter table st51 set tag tag_tinyint = 'NULL' sql alter table st51 set tag tag_tinyint = 'NULL'
sql alter table st51 set tag tag_tinyint = '' sql_error alter table st51 set tag tag_tinyint = ''
sql_error alter table st51 set tag tag_tinyint = abc379 sql_error alter table st51 set tag tag_tinyint = abc379
# test end # test end

View File

@ -391,7 +391,7 @@ sql alter table $mt add tag tgcol6 bool
sql reset query cache sql reset query cache
sql alter table $tb set tag tgcol4=4 sql alter table $tb set tag tgcol4=4
sql alter table $tb set tag tgcol5='5' sql alter table $tb set tag tgcol5='5'
sql alter table $tb set tag tgcol6='1' sql_error alter table $tb set tag tgcol6='1'
sql reset query cache sql reset query cache
sql select * from $mt where tgcol5 = '5' sql select * from $mt where tgcol5 = '5'
@ -409,7 +409,7 @@ endi
if $data03 != 5 then if $data03 != 5 then
return -1 return -1
endi endi
if $data04 != 0 then if $data04 != NULL then
return -1 return -1
endi endi

View File

@ -0,0 +1,159 @@
import datetime
from util.log import *
from util.sql import *
from util.cases import *
from util.common import *
from util.dnodes import *
from util.sqlset import *
DBNAME = "db"
class TDTestCase:
def init(self, conn, logSql, replicaVar=1):
self.replicaVar = int(replicaVar)
tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor())
tdSql.execute(f'drop database if exists db')
tdSql.execute(f'create database if not exists db vgroups 1')
def __create_tb(self, dbname="db"):
CREATE_STB_LIST = [ f"create table {dbname}.stb_vc (ts timestamp, c0 binary(50), c1 binary(50)) tags(t0 binary(50), t1 binary(50));",
f"create table {dbname}.stb_nc (ts timestamp, c0 nchar(50), c1 nchar(50)) tags(t0 nchar(50), t1 nchar(50));",
f"create table {dbname}.stb_ts (ts timestamp, c0 timestamp, c1 timestamp) tags(t0 timestamp, t1 timestamp);",
f"create table {dbname}.stb_bo (ts timestamp, c0 bool, c1 bool) tags(t0 bool, t1 bool);",
f"create table {dbname}.stb_vb (ts timestamp, c0 varbinary(50), c1 varbinary(50)) tags(t0 varbinary(50), t1 varbinary(50));",
f"create table {dbname}.stb_in (ts timestamp, c0 int, c1 int) tags(t0 int, t1 int);",
f"create table {dbname}.stb_fl (ts timestamp, c0 float, c1 float) tags(t0 float, t1 float);",
f"create table {dbname}.stb_db (ts timestamp, c0 float, c1 float) tags(t0 float, t1 float);",
f"create table {dbname}.stb_ge (ts timestamp, c0 geometry(512), c1 geometry(512)) tags(t0 geometry(512), t1 geometry(512));",
f"create table {dbname}.stb_js (ts timestamp, c0 int) tags(t0 json);" ]
for _stb in CREATE_STB_LIST:
tdSql.execute(_stb)
tdSql.query(f'show {dbname}.stables')
tdSql.checkRows(len(CREATE_STB_LIST))
def __insert_query_common(self, dbname="db", stbname="", ctbname="", oklist=[], kolist=[], okv=None):
for _l in kolist:
for _e in _l:
tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, {okv})' %(_e))
tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, %s)' %(_e))
tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, %s)' %(_e, _e))
tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, %s) values(now, {okv}, {okv})' %(_e))
tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, {okv}) values(now, {okv}, {okv})' %(_e))
tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, %s, {okv})' %(_e))
tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, {okv}, %s)' %(_e))
tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, %s, %s)' %(_e, _e))
tdSql.execute(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, {okv}) values(now, {okv}, {okv})')
tdSql.query(f'select * from {dbname}.{stbname}')
tdSql.checkRows(1)
tdSql.execute(f'drop table {dbname}.{ctbname}')
for _l in oklist:
for _e in _l:
tdSql.execute(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, {okv})' %(_e))
tdSql.execute(f'insert into {dbname}.{ctbname} values(now + 0s, %s, {okv})' %(_e))
tdSql.execute(f'insert into {dbname}.{ctbname} values(now + 1s, {okv}, %s)' %(_e))
tdSql.execute(f'insert into {dbname}.{ctbname} values(now + 2s, %s, %s)' %(_e, _e))
tdSql.query(f'select * from {dbname}.{stbname}')
tdSql.checkRows(3)
tdSql.execute(f'drop table {dbname}.{ctbname}')
tdSql.execute(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, %s)' %(_e, _e))
tdSql.execute(f'insert into {dbname}.{ctbname} values(now, %s, %s)' %(_e, _e))
tdSql.query(f'select * from {dbname}.{stbname}')
tdSql.checkRows(1)
tdSql.execute(f'drop table {dbname}.{ctbname}')
tdSql.execute(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, {okv}) values(now, %s, {okv})' %(_e, _e))
tdSql.query(f'select * from {dbname}.{stbname}')
tdSql.checkRows(1)
tdSql.execute(f'drop table {dbname}.{ctbname}')
tdSql.execute(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags({okv}, %s) values(now, {okv}, %s)' %(_e, _e))
tdSql.query(f'select * from {dbname}.{stbname}')
tdSql.checkRows(1)
tdSql.execute(f'drop table {dbname}.{ctbname}')
tdSql.execute(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags(%s, %s) values(now, %s, %s)' %(_e, _e, _e, _e))
tdSql.query(f'select * from {dbname}.{stbname}')
tdSql.checkRows(1)
tdSql.execute(f'drop table {dbname}.{ctbname}')
def __insert_query_exec(self):
STR_EMPTY = ['\'\'', "\"\""]
STR_INTEGER = ["\"123\"", '\'+12\'', '\'+0\'', '\'-0\'', '\'-128\'']
STR_FLOAT = ['\'123.1\'', "\"-23.001\"", "\"+0.001\"" ]
STR_FLOAT_E = ['\'1e1\'', "\"-0.1E+1\"", "\"1e-2\""]
STR_MISC = ['\' \'', "\" \"", "\"123ab\"", '\'123d\'', '\'-12s\'', '\'\x012\'', '\'x12\'', '\'x\'', '\'NULL \'']
STR_OPTR = ['\'1*10\'', '\'1+2\'', '\'-2-0\'','\'1%2\'', '\'2/0\'', '\'1&31\'']
STR_TSK = ['\'now\'', '\'today\'']
STR_TSK_MISC = ['\'now+1s\'', '\' now\'', '\'today \'', '\'today+1m\'', '\'today-1w\'']
STR_TSKP = ['\'now()\'', '\'today()\'']
STR_TSKP_MISC = ['\'now()+1s\'', '\' now()\'', '\'now( )\'', '\'today() \'', '\'today())\'', '\'today()+1m\'', '\'today()-1w\'']
STR_BOOL = ['\'true\'', '\'false\'', '\'TRUE\'', '\'FALSE\'', '\'tRuE\'', '\'falsE\'']
STR_TS = ["\"2024-02-01 00:00:01.001-08:00\"", "\'2024-02-01T00:00:01.001+09:00\'", "\"2024-02-01\"", "\'2024-02-02 00:00:01\'", "\'2024-02-02 00:00:01.009\'"]
STR_VARBIN = ['\'\\x\'', '\'\\x12ab\'']
STR_JSON = ['\'{\"k1\":\"v1\"}\'', '\'[]\'', '\'{}\'']
STR_GEO = ['\'POINT(1.0 1.0)\'', '\'LINESTRING(1.00 +2.0, 2.1 -3.2, 5.00 5.01)\'', '\'POLYGON((1.0 1.0, -2.0 +2.0, 1.0 1.0))\'' ]
STR_NULL = ['\'NuLl\'', '\'null\'', '\'NULL\'']
RAW_INTEGER = ['123', '+0123', '-0128', '+0', '-0', '0']
RAW_FLOAT = ['123.012', '-128.001', '-0.0', '0.0', '+0.0']
RAW_FLOAT_E = ['1e-100', "-1E-10", '+0.1E+2']
RAW_MISC = ['123abc', "123c", '-123d', '+', '-', ' *', ' /', '% ', '&', "|", "^", "&&", "||", "!", " =", 'now+1 s', 'now-1','now-1y','now+2 d',
'today+1 s', 'today-1','today-1y','today+2 d', 'now()+1 s', 'now()-1','now()-1y','now()+2 d', 'today()+1 s', 'today()-1','today()-1y','today()+2 d']
RAW_OPTR = ['1*10', '1+2', '-2-0','1%2', '2/0', '1&31']
RAW_TSK = [' now ', 'today ']
RAW_TSK_OPTR = [' now +1s', 'today + 2d']
RAW_TSKP = ['now( ) ', ' toDay() ']
RAW_TSKP_OPTR = [' noW ( ) + 1s', 'nOw( ) + 2D', 'NOW () + 000s', ' today()+1M', 'today( ) - 1w ', 'TodaY ( ) - 1U ']
RAW_BOOL = ['true', 'false', ' TRUE ', 'FALSE ', ' tRuE', ' falsE ']
RAW_NULL = ['NuLl', 'null', 'NULL', ' NULL ']
OK_VC = [STR_EMPTY, STR_INTEGER, STR_FLOAT, STR_FLOAT_E, STR_MISC, STR_TSK, STR_TSK_MISC, STR_TSKP, STR_TSKP_MISC, STR_BOOL, STR_TS, STR_VARBIN,
STR_JSON, STR_GEO, STR_NULL, RAW_INTEGER, RAW_FLOAT, RAW_FLOAT_E, RAW_TSK, RAW_BOOL, RAW_NULL]
KO_VC = [RAW_MISC, RAW_OPTR, RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR]
OK_NC = []
KO_NC = []
OK_TS = [STR_TSK, STR_TSKP, STR_NULL, RAW_INTEGER, RAW_TSK, RAW_TSK_OPTR, RAW_TSKP, RAW_TSKP_OPTR, RAW_NULL]
KO_TS = [STR_EMPTY, STR_INTEGER, STR_FLOAT, STR_FLOAT_E, STR_MISC, STR_OPTR, STR_TSK_MISC, STR_BOOL, STR_VARBIN,
STR_JSON,STR_GEO, STR_FLOAT, RAW_FLOAT_E, RAW_MISC, RAW_OPTR, RAW_BOOL]
OK_BO = []
KO_BO = []
OK_VB = []
KO_VB = []
OK_IN = []
KO_IN = []
OK_FL = []
KO_FL = []
OK_DB = []
KO_DB = []
OK_GE = []
KO_GE = []
OK_JS = []
KO_JS = []
PARAM_LIST = [
["db", "stb_vc", "ctb_vc", OK_VC, KO_VC, "\'vc\'"],
["db", "stb_nc", "ctb_nc", OK_NC, KO_NC, "\'nc\'"],
["db", "stb_ts", "ctb_ts", OK_TS, KO_TS, "now"],
["db", "stb_bo", "ctb_bo", OK_BO, KO_BO, "true"],
["db", "stb_vb", "ctb_vb", OK_VB, KO_VB, "\'\\x\'"],
["db", "stb_in", "ctb_in", OK_IN, KO_IN, "1"],
["db", "stb_fl", "ctb_fl", OK_FL, KO_FL, "1.0"],
["db", "stb_db", "ctb_db", OK_DB, KO_DB, "1.0"],
["db", "stb_ge", "ctb_ge", OK_GE, KO_GE, "\'POINT(1.0 1.0)\'"],
["db", "stb_js", "ctb_js", OK_JS, KO_JS, "\'{\'k1\':\'v1\',\k2\':\'v2\'}\'"],
]
for _pl in PARAM_LIST:
self.__insert_query_common(_pl[0], _pl[1], _pl[2], _pl[3], _pl[4], _pl[5])
def run(self):
tdLog.printNoPrefix("==========step1:create table")
self.__create_tb()
self.__insert_query_exec()
def stop(self):
tdSql.close()
tdLog.success(f"{__file__} successfully executed")
tdCases.addLinux(__file__, TDTestCase())
tdCases.addWindows(__file__, TDTestCase())

View File

@ -22,7 +22,7 @@ class TDTestCase:
for i in range(tb_nums): for i in range(tb_nums):
tbname = f"{dbname}.sub_{stb_name}_{i}" tbname = f"{dbname}.sub_{stb_name}_{i}"
ts = self.ts + i*10000 ts = self.ts + i*10000
tdSql.execute(f"create table {tbname} using {dbname}.{stb_name} tags ({ts} , {i} , {i}*10 ,{i}*1.0,{i}*1.0 , 1 , 2, 'true', 'binary_{i}' ,'nchar_{i}',{i},{i},10,20 )") tdSql.execute(f"create table {tbname} using {dbname}.{stb_name} tags ({ts} , {i} , %d , %f , %f , 1 , 2, 'true', 'binary_{i}' ,'nchar_{i}',{i},{i},10,20 )"%(i*10,i*1.0,i*1.0))
for row in range(row_nums): for row in range(row_nums):
ts = self.ts + row*1000 ts = self.ts + row*1000

View File

@ -21,7 +21,7 @@ class TDTestCase:
for i in range(tb_nums): for i in range(tb_nums):
tbname = f"{dbname}.sub_{stb_name}_{i}" tbname = f"{dbname}.sub_{stb_name}_{i}"
ts = self.ts + i*1000*120 ts = self.ts + i*1000*120
tdSql.execute(f"create table {tbname} using {dbname}.{stb_name} tags ({ts} , {i} , {i}*10 ,{i}*1.0,{i}*1.0 , 1 , 2, 'true', 'binary_{i}' ,'nchar_{i}',{i},{i},10,20 )") tdSql.execute(f"create table {tbname} using {dbname}.{stb_name} tags ({ts} , {i} , %d , %f , %f , 1 , 2, 'true', 'binary_{i}' ,'nchar_{i}',{i},{i},10,20 )"%(i*10,i*1.0,i*1.0))
for row in range(row_nums): for row in range(row_nums):
ts = ts + row*1000 ts = ts + row*1000

View File

@ -1,3 +1,4 @@
import datetime
from util.log import * from util.log import *
from util.sql import * from util.sql import *
from util.cases import * from util.cases import *
@ -53,55 +54,200 @@ class TDTestCase:
tdSql.checkRows(0) tdSql.checkRows(0)
def __ts4421(self, dbname="db", stbname='stb4421', ctbname='ctb4421'): def __ts4421(self, dbname="db", stbname='stb4421', ctbname='ctb4421'):
TAG_TYPE = ['varchar', 'nchar'] TAG_BIND = [True, False]
TAG_LEN = [2, 8, 200] TAG_TYPE = ['varchar', 'nchar']
TAG_VAL = [0, -200, 123456789] TAG_LEN = [2, 8, 200]
TAG_RESULT = [True,False,False,True,True,False,True,True,True,True,False,False,True,True,False,True,True,True] TAG_VAL_INT = [0, -200, 123456789]
TAG_VAL_STR = ["noW()", "now", "'now'", "todAy()", "today", "\"today\"" ]
TAG_VAL_BOOL_INT = [ -1, 1, 0, -0]
TAG_VAL_BOOL_STR = ["TrUe", "\"true\"","fALse", "'FALSE'"]
TAG_VAL_TIMESTAMP = ["now()", "NoW", "'now'", "\"now()\"", "toDay()", "toDaY", "'today'", "\"today()\"", "\"2200-01-01 08:00:00\"", "'2200-01-02'","\"2200-01-02T00:00:00.000Z\"", "'2200-01-02T00:00:00.000'", "2200-01-01 08:00:00", "\"2200-01-02'", "2200-01-02T00:00:00.000Z"]
TAG_RESULT_INT = [True,False,False,True,True,False,True,True,True,True,False,False,True,True,False,True,True,True]
TAG_RESULT_STR = [False,False,False,False,False,False,False,True,True,False,True,True,False,True,True,False,True,True,False,False,False,False,False,False,False,True,True,False,True,True,False,True,True,False,True,True]
TAG_RESULT_BOOL = ["True","True","False","False"]
TAG_RESULT_TIMESTAMP = [True, True, True, True, True, True, True, True, True, True, True, True, False, False, False]
# check int for vartype(one tag)
nTagCtb = 0 nTagCtb = 0
for tagType in TAG_TYPE: for tagType in TAG_TYPE:
for tagLen in TAG_LEN: for tagLen in TAG_LEN:
tdSql.execute(f'create stable {dbname}.{stbname}(ts timestamp, f1 int) tags(t1 %s(%d))'%(tagType, tagLen)) tdSql.execute(f'create stable {dbname}.{stbname}(ts timestamp, f1 int) tags(t1 %s(%d))'%(tagType,tagLen))
for tagVal in TAG_VAL: for tagVal in TAG_VAL_INT:
if TAG_RESULT[nTagCtb] == False: for tagBind in TAG_BIND:
tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags(%d)'%(tagVal)) if tagBind == True:
tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags(%d) values(now,1)'%(tagVal)) bindStr = "(t1)"
tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} tags("%d")'%(tagVal)) else:
tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags("%d") values(now,1)'%(tagVal)) bindStr = ""
tdSql.error(f"create table {dbname}.{ctbname} using {dbname}.{stbname} tags('%d')"%(tagVal)) tdLog.info(f'nTagCtb={nTagCtb}, tagType={tagType}, tagLen = {tagLen}, tagVal = {tagVal}, tagBind={tagBind}')
tdSql.error(f"insert into {dbname}.{ctbname} using {dbname}.{stbname} tags('%d') values(now,1)"%(tagVal)) if TAG_RESULT_INT[nTagCtb] == False:
else: tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} %s tags(%d)'%(bindStr,tagVal))
# integer as tag value tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} %s tags(%d) values(now,1)'%(bindStr,tagVal))
tdSql.execute(f'create table {dbname}.{ctbname} using {dbname}.stb4421 tags(%d)'%(tagVal)) tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} %s tags("%d")'%(bindStr,tagVal))
tdSql.execute(f'insert into {dbname}.{ctbname} values(now,1)') tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} %s tags("%d") values(now,1)'%(bindStr,tagVal))
tdSql.query(f'select * from {dbname}.{ctbname} where t1="%s"'%(tagVal)) tdSql.error(f"create table {dbname}.{ctbname} using {dbname}.{stbname} %s tags('%d')"%(bindStr,tagVal))
tdSql.checkRows(1) tdSql.error(f"insert into {dbname}.{ctbname} using {dbname}.{stbname} %s tags('%d') values(now,1)"%(bindStr,tagVal))
tdSql.execute(f'drop table {dbname}.{ctbname}') else:
tdSql.execute(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags(%d) values(now,1)'%(tagVal)) # integer as tag value
tdSql.query(f'select * from {dbname}.{ctbname} where t1="%s"'%(tagVal)) tdSql.execute(f'create table {dbname}.{ctbname} using {dbname}.{stbname} %s tags(%d)'%(bindStr,tagVal))
tdSql.checkRows(1) tdSql.execute(f'insert into {dbname}.{ctbname} values(now,1)')
tdSql.execute(f'drop table {dbname}.{ctbname}') tdSql.execute(f'insert into {dbname}.{ctbname}t using {dbname}.{stbname} %s tags(%d) values(now,1)'%(bindStr,tagVal))
# string as tag value tdSql.query(f'select * from {dbname}.{stbname} where t1="%d"'%(tagVal))
tdSql.execute(f'create table {dbname}.{ctbname} using {dbname}.stb4421 tags("%d")'%(tagVal)) tdSql.checkRows(2)
tdSql.execute(f'insert into {dbname}.{ctbname} values(now,1)') tdSql.execute(f'drop table {dbname}.{ctbname}')
tdSql.query(f'select * from {dbname}.{ctbname} where t1="%s"'%(tagVal)) tdSql.execute(f'drop table {dbname}.{ctbname}t')
tdSql.checkRows(1) # string as tag value
tdSql.execute(f'drop table {dbname}.{ctbname}') tdSql.execute(f'create table {dbname}.{ctbname} using {dbname}.{stbname} %s tags("%d")'%(bindStr,tagVal))
tdSql.execute(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} tags("%d") values(now,1)'%(tagVal)) tdSql.execute(f'insert into {dbname}.{ctbname} values(now,1)')
tdSql.query(f'select * from {dbname}.{ctbname} where t1="%s"'%(tagVal)) tdSql.execute(f'insert into {dbname}.{ctbname}t using {dbname}.{stbname} %s tags("%d") values(now,1)'%(bindStr,tagVal))
tdSql.checkRows(1) tdSql.query(f'select * from {dbname}.{stbname} where t1="%d"'%(tagVal))
tdSql.execute(f'drop table {dbname}.{ctbname}') tdSql.checkRows(2)
tdSql.execute(f"create table {dbname}.{ctbname} using {dbname}.stb4421 tags('%d')"%(tagVal)) tdSql.execute(f'drop table {dbname}.{ctbname}')
tdSql.execute(f"insert into {dbname}.{ctbname} values(now,1)") tdSql.execute(f'drop table {dbname}.{ctbname}t')
tdSql.query(f"select * from {dbname}.{ctbname} where t1='%s'"%(tagVal)) tdSql.execute(f"create table {dbname}.{ctbname} using {dbname}.{stbname} %s tags('%d')"%(bindStr,tagVal))
tdSql.checkRows(1) tdSql.execute(f"insert into {dbname}.{ctbname} values(now,1)")
tdSql.execute(f"drop table {dbname}.{ctbname}") tdSql.execute(f"insert into {dbname}.{ctbname}t using {dbname}.{stbname} %s tags('%d') values(now,1)"%(bindStr,tagVal))
tdSql.execute(f"insert into {dbname}.{ctbname} using {dbname}.{stbname} tags('%d') values(now,1)"%(tagVal)) tdSql.query(f"select * from {dbname}.{stbname} where t1='%d'"%(tagVal))
tdSql.query(f"select * from {dbname}.{ctbname} where t1='%s'"%(tagVal)) tdSql.checkRows(2)
tdSql.checkRows(1) tdSql.execute(f'drop table {dbname}.{ctbname}')
tdSql.execute(f"drop table {dbname}.{ctbname}") tdSql.execute(f'drop table {dbname}.{ctbname}t')
nTagCtb += 1 nTagCtb += 1
tdSql.execute(f'drop table {dbname}.{stbname}') tdSql.execute(f'drop table {dbname}.{stbname}')
# check int for vartype(two tags/bind tags)
nTagCtb = 0
for tagType in TAG_TYPE:
for tagLen in TAG_LEN:
tdSql.execute(f'create stable {dbname}.{stbname}(ts timestamp, f1 int) tags(t1 %s(%d),t2 %s(%d) )'%(tagType,tagLen,tagType,tagLen))
for tagVal in TAG_VAL_INT:
for tagBind in TAG_BIND:
if tagBind == True:
bindStr = "(t1,t2)"
else:
bindStr = ""
if TAG_RESULT_INT[nTagCtb] == False:
tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} %s tags(%d,%d)'%(bindStr,tagVal,tagVal))
tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} %s tags(%d,%d) values(now,1)'%(bindStr,tagVal,tagVal))
tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} %s tags("%d","%d")'%(bindStr,tagVal,tagVal))
tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} %s tags("%d","%d") values(now,1)'%(bindStr,tagVal,tagVal))
tdSql.error(f"create table {dbname}.{ctbname} using {dbname}.{stbname} %s tags('%d','%d')"%(bindStr,tagVal,tagVal))
tdSql.error(f"insert into {dbname}.{ctbname} using {dbname}.{stbname} %s tags('%d','%d') values(now,1)"%(bindStr,tagVal,tagVal))
else:
# integer as tag value
tdSql.execute(f'create table {dbname}.{ctbname} using {dbname}.{stbname} %s tags(%d,%d)'%(bindStr,tagVal,tagVal))
tdSql.execute(f'insert into {dbname}.{ctbname} values(now,1)')
tdSql.execute(f'insert into {dbname}.{ctbname}t using {dbname}.{stbname} %s tags(%d,%d) values(now,1)'%(bindStr,tagVal,tagVal))
tdSql.query(f"select * from {dbname}.{stbname} where t1='%d' and t2='%d'"%(tagVal,tagVal))
tdSql.checkRows(2)
tdSql.execute(f'drop table {dbname}.{ctbname}')
tdSql.execute(f'drop table {dbname}.{ctbname}t')
# string as tag value
tdSql.execute(f'create table {dbname}.{ctbname} using {dbname}.{stbname} %s tags("%d","%d")'%(bindStr,tagVal,tagVal))
tdSql.execute(f'insert into {dbname}.{ctbname} values(now,1)')
tdSql.execute(f'insert into {dbname}.{ctbname}t using {dbname}.{stbname} %s tags("%d","%d") values(now,1)'%(bindStr,tagVal,tagVal))
tdSql.query(f'select * from {dbname}.{stbname} where t1="%d" and t2="%d"'%(tagVal,tagVal))
tdSql.checkRows(2)
tdSql.execute(f'drop table {dbname}.{ctbname}')
tdSql.execute(f'drop table {dbname}.{ctbname}t')
tdSql.execute(f"create table {dbname}.{ctbname} using {dbname}.{stbname} %s tags('%d','%d')"%(bindStr,tagVal,tagVal))
tdSql.execute(f"insert into {dbname}.{ctbname} values(now,1)")
tdSql.execute(f"insert into {dbname}.{ctbname}t using {dbname}.{stbname} %s tags('%d','%d') values(now,1)"%(bindStr,tagVal,tagVal))
tdSql.query(f"select * from {dbname}.{stbname} where t1='%d' and t2='%d'"%(tagVal,tagVal))
tdSql.checkRows(2)
tdSql.execute(f'drop table {dbname}.{ctbname}')
tdSql.execute(f'drop table {dbname}.{ctbname}t')
nTagCtb += 1
tdSql.execute(f'drop table {dbname}.{stbname}')
# check now/today for vartype
nTagCtb = 0
for tagType in TAG_TYPE:
for tagLen in TAG_LEN:
tdSql.execute(f'create stable {dbname}.{stbname}(ts timestamp, f1 int) tags(t1 %s(%d))'%(tagType,tagLen))
for tagVal in TAG_VAL_STR:
for tagBind in TAG_BIND:
if tagBind == True:
bindStr = "(t1)"
else:
bindStr = ""
if TAG_RESULT_STR[nTagCtb] == False:
tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} %s tags(%s)'%(bindStr,tagVal))
tdSql.error(f'insert into {dbname}.{ctbname} using {dbname}.{stbname} %s tags(%s) values(now,1)'%(bindStr,tagVal))
else:
tdSql.execute(f'create table {dbname}.{ctbname} using {dbname}.{stbname} %s tags(%s)'%(bindStr,tagVal))
tdSql.execute(f'insert into {dbname}.{ctbname} values(now,1)')
tdSql.execute(f'insert into {dbname}.{ctbname}t using {dbname}.{stbname} %s tags(%s) values(now,1)'%(bindStr,tagVal))
if tagVal.startswith("'") or tagVal.startswith("\""):
tdSql.query(f'select * from {dbname}.{stbname} where t1=%s'%(tagVal))
else:
tdSql.query(f'select * from {dbname}.{stbname} where t1=\"%s\"'%(tagVal))
tdSql.checkRows(2)
tdSql.execute(f'drop table {dbname}.{ctbname}')
tdSql.execute(f'drop table {dbname}.{ctbname}t')
nTagCtb += 1
tdSql.execute(f'drop table {dbname}.{stbname}')
# check int for bool
nTagCtb = 0
tdSql.execute(f'create stable {dbname}.{stbname}(ts timestamp, f1 int) tags(t1 bool)')
for tagVal in TAG_VAL_BOOL_INT:
for tagBind in TAG_BIND:
if tagBind == True:
bindStr = "(t1)"
else:
bindStr = ""
tdSql.execute(f'create table {dbname}.{ctbname} using {dbname}.{stbname} %s tags(%d)'%(bindStr,tagVal))
tdSql.execute(f'insert into {dbname}.{ctbname} values(now,1)')
tdSql.execute(f'insert into {dbname}.{ctbname}t using {dbname}.{stbname} %s tags(%d) values(now,1)'%(bindStr,tagVal))
tdSql.query(f'select * from {dbname}.{stbname} where t1=%s'%(TAG_RESULT_BOOL[nTagCtb]))
tdSql.checkRows(2)
tdSql.execute(f'drop table {dbname}.{ctbname}')
tdSql.execute(f'drop table {dbname}.{ctbname}t')
nTagCtb += 1
tdSql.execute(f'drop table {dbname}.{stbname}')
# check str for bool
nTagCtb = 0
tdSql.execute(f'create stable {dbname}.{stbname}(ts timestamp, f1 int) tags(t1 bool)')
for tagVal in TAG_VAL_BOOL_STR:
for tagBind in TAG_BIND:
if tagBind == True:
bindStr = "(t1)"
else:
bindStr = ""
tdSql.execute(f'create table {dbname}.{ctbname} using {dbname}.{stbname} %s tags(%s)'%(bindStr,tagVal))
tdSql.execute(f'insert into {dbname}.{ctbname} values(now,1)')
tdSql.execute(f'insert into {dbname}.{ctbname}t using {dbname}.{stbname} %s tags(%s) values(now,1)'%(bindStr,tagVal))
tdSql.query(f'select * from {dbname}.{stbname} where t1=%s'%(TAG_RESULT_BOOL[nTagCtb]))
tdSql.checkRows(2)
tdSql.execute(f'drop table {dbname}.{ctbname}')
tdSql.execute(f'drop table {dbname}.{ctbname}t')
nTagCtb += 1
tdSql.execute(f'drop table {dbname}.{stbname}')
# check misc for timestamp
nTagCtb = 0
tdSql.execute(f'create stable {dbname}.{stbname}(ts timestamp, f1 int) tags(t1 timestamp)')
checkTS = datetime.datetime.today() - datetime.timedelta(days=1)
for tagVal in TAG_VAL_TIMESTAMP:
for tagBind in TAG_BIND:
if tagBind == True:
bindStr = "(t1)"
else:
bindStr = ""
if TAG_RESULT_TIMESTAMP[nTagCtb] == False:
tdSql.error(f'create table {dbname}.{ctbname} using {dbname}.{stbname} %s tags(%s)'%(bindStr,tagVal))
tdSql.error(f'insert into {dbname}.{ctbname}t using {dbname}.{stbname} %s tags(%s) values(now,1)'%(bindStr,tagVal))
else:
tdSql.execute(f'create table {dbname}.{ctbname} using {dbname}.{stbname} %s tags(%s)'%(bindStr,tagVal))
tdSql.execute(f'insert into {dbname}.{ctbname} values(now,1)')
tdSql.execute(f'insert into {dbname}.{ctbname}t using {dbname}.{stbname} %s tags(%s) values(now,1)'%(bindStr,tagVal))
tdSql.query(f'select * from {dbname}.{stbname} where t1>"{checkTS}"')
tdSql.checkRows(2)
tdSql.execute(f'drop table {dbname}.{ctbname}')
tdSql.execute(f'drop table {dbname}.{ctbname}t')
nTagCtb += 1
tdSql.execute(f'drop table {dbname}.{stbname}')
def run(self): def run(self):
tdLog.printNoPrefix("==========step1:create table") tdLog.printNoPrefix("==========step1:create table")
@ -118,4 +264,4 @@ class TDTestCase:
tdLog.success(f"{__file__} successfully executed") tdLog.success(f"{__file__} successfully executed")
tdCases.addLinux(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase())
tdCases.addWindows(__file__, TDTestCase()) tdCases.addWindows(__file__, TDTestCase())

View File

@ -33,7 +33,7 @@ class TDTestCase:
for i in range(ctbNum): for i in range(ctbNum):
tagValue = 'beijing' tagValue = 'beijing'
if (i % 10 == 0): if (i % 10 == 0):
sql += f" {dbName}.%s%d using %s (name,fleet,driver,device_version,load_capacity,fuel_capacity,nominal_fuel_consumption) tags('truck_%d', 'South%d','Trish%d','v2.%d', 1500+%d*20, 150+%d*2, 5+%d)"%(ctbPrefix,i,stbName,i,i,i,i,(1500+i*20),(150+i*2),(5+i)) sql += f" {dbName}.%s%d using %s (name,fleet,driver,device_version,load_capacity,fuel_capacity,nominal_fuel_consumption) tags('truck_%d', 'South%d','Trish%d','v2.%d', %d, %d, %d)"%(ctbPrefix,i,stbName,i,i,i,i,1500+(1500+i*20)*20,150+(150+i*2)*2,5+(5+i))
else: else:
model = 'H-%d'%i model = 'H-%d'%i
sql += f" {dbName}.%s%d using %s tags('truck_%d', 'South%d','Trish%d','%s','v2.%d', %d, %d,%d)"%(ctbPrefix,i,stbName,i,i,i,model,i,(1500+i*20),(150+i*2),(5+i)) sql += f" {dbName}.%s%d using %s tags('truck_%d', 'South%d','Trish%d','%s','v2.%d', %d, %d,%d)"%(ctbPrefix,i,stbName,i,i,i,model,i,(1500+i*20),(150+i*2),(5+i))

View File

@ -22,6 +22,7 @@ python3 ./test.py -f 1-insert/update_data_muti_rows.py -P
python3 ./test.py -f 1-insert/db_tb_name_check.py -P python3 ./test.py -f 1-insert/db_tb_name_check.py -P
python3 ./test.py -f 1-insert/InsertFuturets.py -P python3 ./test.py -f 1-insert/InsertFuturets.py -P
python3 ./test.py -f 1-insert/insert_wide_column.py -P python3 ./test.py -f 1-insert/insert_wide_column.py -P
python3 ./test.py -f 1-insert/insert_column_value.py
python3 ./test.py -f 2-query/nestedQuery.py -P python3 ./test.py -f 2-query/nestedQuery.py -P
python3 ./test.py -f 2-query/nestedQuery_str.py -P python3 ./test.py -f 2-query/nestedQuery_str.py -P
python3 ./test.py -f 2-query/nestedQuery_math.py -P python3 ./test.py -f 2-query/nestedQuery_math.py -P

View File

@ -233,6 +233,7 @@ python3 ./test.py -f 1-insert/update_data_muti_rows.py
python3 ./test.py -f 1-insert/db_tb_name_check.py python3 ./test.py -f 1-insert/db_tb_name_check.py
python3 ./test.py -f 1-insert/InsertFuturets.py python3 ./test.py -f 1-insert/InsertFuturets.py
python3 ./test.py -f 1-insert/insert_wide_column.py python3 ./test.py -f 1-insert/insert_wide_column.py
python3 ./test.py -f 1-insert/insert_column_value.py
python3 ./test.py -f 1-insert/rowlength64k_benchmark.py python3 ./test.py -f 1-insert/rowlength64k_benchmark.py
python3 ./test.py -f 1-insert/rowlength64k.py python3 ./test.py -f 1-insert/rowlength64k.py
python3 ./test.py -f 1-insert/rowlength64k.py -R python3 ./test.py -f 1-insert/rowlength64k.py -R