Merge pull request #11092 from taosdata/feature/3.0_wxy
TD-14330 bugfix
This commit is contained in:
commit
f37421e7a8
|
@ -139,18 +139,18 @@
|
|||
#define TK_TOPIC 121
|
||||
#define TK_AS 122
|
||||
#define TK_NK_BOOL 123
|
||||
#define TK_NK_VARIABLE 124
|
||||
#define TK_NK_UNDERLINE 125
|
||||
#define TK_ROWTS 126
|
||||
#define TK_TBNAME 127
|
||||
#define TK_QSTARTTS 128
|
||||
#define TK_QENDTS 129
|
||||
#define TK_WSTARTTS 130
|
||||
#define TK_WENDTS 131
|
||||
#define TK_WDURATION 132
|
||||
#define TK_BETWEEN 133
|
||||
#define TK_IS 134
|
||||
#define TK_NULL 135
|
||||
#define TK_NULL 124
|
||||
#define TK_NK_VARIABLE 125
|
||||
#define TK_NK_UNDERLINE 126
|
||||
#define TK_ROWTS 127
|
||||
#define TK_TBNAME 128
|
||||
#define TK_QSTARTTS 129
|
||||
#define TK_QENDTS 130
|
||||
#define TK_WSTARTTS 131
|
||||
#define TK_WENDTS 132
|
||||
#define TK_WDURATION 133
|
||||
#define TK_BETWEEN 134
|
||||
#define TK_IS 135
|
||||
#define TK_NK_LT 136
|
||||
#define TK_NK_GT 137
|
||||
#define TK_NK_LE 138
|
||||
|
|
|
@ -349,6 +349,7 @@ literal(A) ::= NK_STRING(B).
|
|||
literal(A) ::= NK_BOOL(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &B)); }
|
||||
literal(A) ::= TIMESTAMP(B) NK_STRING(C). { A = createRawExprNodeExt(pCxt, &B, &C, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &C)); }
|
||||
literal(A) ::= duration_literal(B). { A = B; }
|
||||
literal(A) ::= NULL(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); }
|
||||
|
||||
duration_literal(A) ::= NK_VARIABLE(B). { A = createRawExprNode(pCxt, &B, createDurationValueNode(pCxt, &B)); }
|
||||
|
||||
|
@ -372,6 +373,7 @@ signed_literal(A) ::= NK_STRING(B).
|
|||
signed_literal(A) ::= NK_BOOL(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &B); }
|
||||
signed_literal(A) ::= TIMESTAMP NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &B); }
|
||||
signed_literal(A) ::= duration_literal(B). { A = releaseRawExprNode(pCxt, B); }
|
||||
signed_literal(A) ::= NULL. { A = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); }
|
||||
|
||||
%type literal_list { SNodeList* }
|
||||
%destructor literal_list { nodesDestroyList($$); }
|
||||
|
|
|
@ -577,11 +577,13 @@ SNode* createColumnNode(SAstCreateContext* pCxt, SToken* pTableAlias, SToken* pC
|
|||
SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral) {
|
||||
SValueNode* val = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE);
|
||||
CHECK_OUT_OF_MEM(val);
|
||||
val->literal = strndup(pLiteral->z, pLiteral->n);
|
||||
if (TK_NK_ID != pLiteral->type && (IS_VAR_DATA_TYPE(dataType) || TSDB_DATA_TYPE_TIMESTAMP == dataType)) {
|
||||
trimString(pLiteral->z, pLiteral->n, val->literal, pLiteral->n);
|
||||
if (NULL != pLiteral) {
|
||||
val->literal = strndup(pLiteral->z, pLiteral->n);
|
||||
if (TK_NK_ID != pLiteral->type && (IS_VAR_DATA_TYPE(dataType) || TSDB_DATA_TYPE_TIMESTAMP == dataType)) {
|
||||
trimString(pLiteral->z, pLiteral->n, val->literal, pLiteral->n);
|
||||
}
|
||||
CHECK_OUT_OF_MEM(val->literal);
|
||||
}
|
||||
CHECK_OUT_OF_MEM(val->literal);
|
||||
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) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -487,7 +487,10 @@ TEST_F(ParserTest, createTable) {
|
|||
bind("create table "
|
||||
"if not exists test.t1 using test.st1 (tag1, tag2) tags(1, 'abc') "
|
||||
"if not exists test.t2 using test.st1 (tag1, tag2) tags(2, 'abc') "
|
||||
"if not exists test.t3 using test.st1 (tag1, tag2) tags(3, 'abc')"
|
||||
"if not exists test.t3 using test.st1 (tag1, tag2) tags(3, 'abc') "
|
||||
"if not exists test.t4 using test.st1 (tag1, tag2) tags(3, null) "
|
||||
"if not exists test.t5 using test.st1 (tag1, tag2) tags(null, 'abc') "
|
||||
"if not exists test.t6 using test.st1 (tag1, tag2) tags(null, null)"
|
||||
);
|
||||
ASSERT_TRUE(run());
|
||||
|
||||
|
|
Loading…
Reference in New Issue