diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 38ab4c90b9795d2a5af24d02ef8de9646478b949..c7cf4a4bf430c482915a03db6aa658e5a8416d53 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -191,7 +191,7 @@ bool serializeExprListToVariant(SArray* pList, tVariant **dst, int16_t colType, } if (colType == TSDB_DATA_TYPE_BOOL && (var->i64 > 1 ||var->i64 < 0)) { break; - } + } tbufWriteInt64(&bw, var->i64); } else if (IS_UNSIGNED_NUMERIC_TYPE(colType)) { if (IS_SIGNED_NUMERIC_TYPE(var->nType) || IS_UNSIGNED_NUMERIC_TYPE(var->nType)) { @@ -603,11 +603,11 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { char buf[TSDB_TABLE_FNAME_LEN]; SStrToken sTblToken; sTblToken.z = buf; - + if (pInfo->type != TSDB_SQL_DROP_DNODE) { if ((escapeEnabled && (validateTableName(pzName->z, pzName->n, &sTblToken, &dbIncluded) != TSDB_CODE_SUCCESS)) || ((!escapeEnabled) && (tscValidateName(pzName, escapeEnabled, &dbIncluded) != TSDB_CODE_SUCCESS))){ - return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); } } @@ -623,7 +623,7 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { code = tscSetTableFullName(&pTableMetaInfo->name, &sTblToken, pSql, dbIncluded); if(code != TSDB_CODE_SUCCESS) { - return code; + return code; } } else if (pInfo->type == TSDB_SQL_DROP_DNODE) { if (pzName->type == TK_STRING) { @@ -765,7 +765,7 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { char buf[TSDB_TABLE_FNAME_LEN]; SStrToken sTblToken; sTblToken.z = buf; - + if (validateTableName(pToken->z, pToken->n, &sTblToken, &dbIncluded) != TSDB_CODE_SUCCESS) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); } @@ -788,7 +788,7 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { char buf[TSDB_TABLE_FNAME_LEN]; SStrToken sTblToken; sTblToken.z = buf; - + if (validateTableName(pToken->z, pToken->n, &sTblToken, &dbIncluded) != TSDB_CODE_SUCCESS) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); } @@ -804,7 +804,7 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { const char* msg1 = "invalid database name"; SStrToken* pToken = taosArrayGet(pInfo->pMiscInfo->a, 0); - + if (tscValidateName(pToken, false, NULL) != TSDB_CODE_SUCCESS) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); } @@ -2175,16 +2175,16 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS pQueryInfo->colList = taosArrayInit(4, POINTER_BYTES); } - + bool hasDistinct = false; - bool hasAgg = false; + bool hasAgg = false; size_t numOfExpr = taosArrayGetSize(pSelNodeList); - int32_t distIdx = -1; + int32_t distIdx = -1; for (int32_t i = 0; i < numOfExpr; ++i) { int32_t outputIndex = (int32_t)tscNumOfExprs(pQueryInfo); tSqlExprItem* pItem = taosArrayGet(pSelNodeList, i); if (hasDistinct == false) { - hasDistinct = (pItem->distinct == true); + hasDistinct = (pItem->distinct == true); distIdx = hasDistinct ? i : -1; } if(pItem->aliasName != NULL && validateColumnName(pItem->aliasName) != TSDB_CODE_SUCCESS){ @@ -2202,7 +2202,7 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS return code; } } else if (type == SQL_NODE_SQLFUNCTION) { - hasAgg = true; + hasAgg = true; if (hasDistinct) break; pItem->pNode->functionId = isValidFunction(pItem->pNode->Expr.operand.z, pItem->pNode->Expr.operand.n); @@ -2252,12 +2252,12 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS } } - //TODO(dengyihao), refactor as function - //handle distinct func mixed with other func + //TODO(dengyihao), refactor as function + //handle distinct func mixed with other func if (hasDistinct == true) { if (distIdx != 0 || hasAgg) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4); - } + } if (joinQuery) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg6); } @@ -2267,11 +2267,11 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS if (pQueryInfo->pDownstream != NULL) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg8); } - + pQueryInfo->distinct = true; } - - + + // there is only one user-defined column in the final result field, add the timestamp column. size_t numOfSrcCols = taosArrayGetSize(pQueryInfo->colList); if ((numOfSrcCols <= 0 || !hasNoneUserDefineExpr(pQueryInfo)) && !tscQueryTags(pQueryInfo) && !tscQueryBlockInfo(pQueryInfo)) { @@ -2759,7 +2759,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col if (pItem->pNode->Expr.paramList == NULL || (functionId != TSDB_FUNC_LEASTSQR && functionId != TSDB_FUNC_DERIVATIVE && functionId != TSDB_FUNC_ELAPSED && numOfParams != 1) || ((functionId == TSDB_FUNC_LEASTSQR || functionId == TSDB_FUNC_DERIVATIVE) && numOfParams != 3) || - (functionId == TSDB_FUNC_ELAPSED && numOfParams > 2)) { + (functionId == TSDB_FUNC_ELAPSED && numOfParams != 1 && numOfParams != 2)) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); } @@ -4698,7 +4698,12 @@ static int32_t validateSQLExprItem(SSqlCmd* pCmd, tSqlExpr* pExpr, if (pExpr->value.nType == (uint32_t)-1) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); } - + + //now allowing now +/- value in select expr + if (pExpr->tokenId == TK_TIMESTAMP) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); + } + if (pExpr->type == SQL_NODE_VALUE) { *type = SQLEXPR_TYPE_VALUE; } diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index 5f8964bb34b5939ab768877cb8ae701e20443f75..bcec2ffc57ba46aea9ffd222aa3bf3d3415ab0de 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -3783,7 +3783,7 @@ void tscSetQuerySort(SQueryInfo* pQueryInfo, SQueryAttr* pQueryAttr) { size_t size = taosArrayGetSize(pQueryInfo->pUpstream); for(int32_t i = 0; i < size; ++i) { SQueryInfo* pq = taosArrayGetP(pQueryInfo->pUpstream, i); - if (pq->groupbyTag && pq->interval.interval > 0) { + if (pq->groupbyTag) { pQueryAttr->needSort = true; return; } diff --git a/src/client/src/tscSystem.c b/src/client/src/tscSystem.c index bbd448e2d8b5069fae438d7adb9de14a31446d1b..7041c922d9b8ff32d6c1340fe313769cf4cf9729 100644 --- a/src/client/src/tscSystem.c +++ b/src/client/src/tscSystem.c @@ -113,7 +113,7 @@ int32_t tscAcquireRpc(const char *key, const char *user, const char *secretEncry SRpcObj rpcObj; memset(&rpcObj, 0, sizeof(rpcObj)); - strncpy(rpcObj.key, key, strlen(key)); + tstrncpy(rpcObj.key, key, sizeof(rpcObj.key)); rpcObj.pDnodeConn = rpcOpen(&rpcInit); if (rpcObj.pDnodeConn == NULL) { pthread_mutex_unlock(&rpcObjMutex); diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 3367c4a36acc33413fae256290ddc5926f2720e3..874a022a7104860fce8f6389bcc933b36a2fef22 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -4928,7 +4928,11 @@ int32_t createProjectionExpr(SQueryInfo* pQueryInfo, STableMetaInfo* pTableMetaI } } - pse->colInfo.flag = pSource->base.colInfo.flag; //TSDB_COL_NORMAL; + if (!pQueryInfo->stableQuery && TSDB_COL_IS_TAG(pSource->base.colInfo.flag)) { + pse->colInfo.flag = (pSource->base.colInfo.flag) & (~TSDB_COL_TAG); + } else { + pse->colInfo.flag = pSource->base.colInfo.flag; + } pse->resType = pSource->base.resType; pse->resBytes = pSource->base.resBytes; strncpy(pse->colInfo.name, pSource->base.aliasName, tListLen(pse->colInfo.name)); diff --git a/src/kit/taos-tools b/src/kit/taos-tools index 0b4a16e96b5cc9cb6e4f8cacf6a1f3028c91adb0..7eae58a0fbf7c7321dd1bdc96e375d4c832cf373 160000 --- a/src/kit/taos-tools +++ b/src/kit/taos-tools @@ -1 +1 @@ -Subproject commit 0b4a16e96b5cc9cb6e4f8cacf6a1f3028c91adb0 +Subproject commit 7eae58a0fbf7c7321dd1bdc96e375d4c832cf373 diff --git a/src/query/inc/tdigest.h b/src/query/inc/tdigest.h index 625311eaabebec1f3d3b8303f34a361ba0129094..f9b615318f5c33f0cf386653367ddfe36ae759f8 100644 --- a/src/query/inc/tdigest.h +++ b/src/query/inc/tdigest.h @@ -29,7 +29,7 @@ #define DOUBLE_MAX 1.79e+308 #define ADDITION_CENTROID_NUM 2 -#define COMPRESSION 400 +#define COMPRESSION 300 #define GET_CENTROID(compression) (ceil(compression * M_PI / 2) + 1 + ADDITION_CENTROID_NUM) #define GET_THRESHOLD(compression) (7.5 + 0.37 * compression - 2e-4 * pow(compression, 2)) #define TDIGEST_SIZE(compression) (sizeof(TDigest) + sizeof(SCentroid)*GET_CENTROID(compression) + sizeof(SPt)*GET_THRESHOLD(compression)) diff --git a/src/query/src/qPlan.c b/src/query/src/qPlan.c index bd8a77b352b05ee7a8f5ceeaee0b3223c1d17287..389f188258bbb471addf21c08562bba3bb56da40 100644 --- a/src/query/src/qPlan.c +++ b/src/query/src/qPlan.c @@ -590,6 +590,7 @@ SArray* createExecOperatorPlan(SQueryAttr* pQueryAttr) { } // outer query order by support int32_t orderColId = pQueryAttr->order.orderColId; + if (pQueryAttr->vgId == 0 && orderColId != INT32_MIN) { op = OP_Order; taosArrayPush(plan, &op); diff --git a/src/query/src/queryMain.c b/src/query/src/queryMain.c index 2a2ccf9cae0f9e2aab60bddca7c27a8ceb719239..9bdb0efc4d3ed7769aa99ded02e460fe0624ae27 100644 --- a/src/query/src/queryMain.c +++ b/src/query/src/queryMain.c @@ -279,6 +279,7 @@ bool qTableQuery(qinfo_t qinfo, uint64_t *qId) { if (isQueryKilled(pQInfo)) { qDebug("QInfo:0x%"PRIx64" it is already killed, abort", pQInfo->qId); + setQueryKilled(pQInfo); pQInfo->runtimeEnv.outputBuf = NULL; return doBuildResCheck(pQInfo); } diff --git a/src/util/src/tlog.c b/src/util/src/tlog.c index 232d10a7d07594c9c62cd13767c320da27af2a73..7b5dafcc8e771ba7d6e7b5691226bbc84a556ef8 100644 --- a/src/util/src/tlog.c +++ b/src/util/src/tlog.c @@ -131,7 +131,7 @@ void taosCloseLog() { taosStopLog(); //tsem_post(&(tsLogObj.logHandle->buffNotEmpty)); taosMsleep(MAX_LOG_INTERVAL/1000); - if (taosCheckPthreadValid(tsLogObj.logHandle->asyncThread)) { + if (tsLogObj.logHandle && taosCheckPthreadValid(tsLogObj.logHandle->asyncThread)) { pthread_join(tsLogObj.logHandle->asyncThread, NULL); } // In case that other threads still use log resources causing invalid write in valgrind diff --git a/tests/examples/C#/taosdemo/taosdemo.cs b/tests/examples/C#/taosdemo/taosdemo.cs index 2c77285488830323ed03a04a1d1c89c048ad2ea8..e62a502d1508c1339e559160b50da39e622a021f 100644 --- a/tests/examples/C#/taosdemo/taosdemo.cs +++ b/tests/examples/C#/taosdemo/taosdemo.cs @@ -361,7 +361,10 @@ namespace TDengineDriver threadArr[i] = new Thread(createTableThread.ThreadMain); threadArr[i].Start(); - threadArr[i].Join(); + } + for (int j = 0; j < numOfThreads; j++) + { + threadArr[j].Join(); } } @@ -482,7 +485,10 @@ namespace TDengineDriver threadArr[i] = new Thread(insertThread.ThreadMain); threadArr[i].Start(); - threadArr[i].Join(); + } + for (int j = 0; j < numOfThreads; j++) + { + threadArr[j].Join(); } } diff --git a/tests/examples/JDBC/taosdemo/pom.xml b/tests/examples/JDBC/taosdemo/pom.xml index c6e61f5d22ca83c5d56deef7db9354913a3321b1..4969ac707daca541c2a06f3298599d38fe0e6515 100644 --- a/tests/examples/JDBC/taosdemo/pom.xml +++ b/tests/examples/JDBC/taosdemo/pom.xml @@ -88,7 +88,7 @@ org.apache.logging.log4j log4j-core - 2.15.0 + 2.16.0 diff --git a/tests/pytest/functions/function_elapsed_case.py b/tests/pytest/functions/function_elapsed_case.py index 4e6ffe9d89a99137f1b7ef064eb641ac066ea8ef..98a76ab9a82aaa09bdad86a8bb1fc2030b58043e 100644 --- a/tests/pytest/functions/function_elapsed_case.py +++ b/tests/pytest/functions/function_elapsed_case.py @@ -320,6 +320,8 @@ class ElapsedCase: def selectIllegalTest(self): tdSql.execute("use wxy_db") + tdSql.error("select elapsed() from t1") + tdSql.error("select elapsed(,) from t1") tdSql.error("select elapsed(1) from t1 where ts > '2021-11-22 00:00:00' and ts < '2021-11-23 00:00:00'") tdSql.error("select elapsed('2021-11-18 00:00:10') from t1 where ts > '2021-11-22 00:00:00' and ts < '2021-11-23 00:00:00'") tdSql.error("select elapsed(now) from t1 where ts > '2021-11-22 00:00:00' and ts < '2021-11-23 00:00:00'") diff --git a/tests/pytest/tools/taosdumpTest2.py b/tests/pytest/tools/taosdumpTest2.py index 839988375b652b0cfad09d8a6de7697de19609ea..c60fb42266c6d23ad9aeabc9bf9f48ac5feec17b 100644 --- a/tests/pytest/tools/taosdumpTest2.py +++ b/tests/pytest/tools/taosdumpTest2.py @@ -69,7 +69,7 @@ class TDTestCase: os.system("rm /tmp/*.sql") os.system( - "%staosdump --databases db -o /tmp -B 32766 -L 1048576" % + "%staosdump --databases db -o /tmp -B 16384 -L 1048576" % binPath) tdSql.execute("drop database db") diff --git a/tests/pytest/tools/taosdumpTest3.py b/tests/pytest/tools/taosdumpTest3.py index d13c502fd5887d47b5094ef5bd08691372f9648b..ed83fe1ffb39f24f6eb7073d91bcaf62437527c3 100644 --- a/tests/pytest/tools/taosdumpTest3.py +++ b/tests/pytest/tools/taosdumpTest3.py @@ -137,7 +137,6 @@ class TDTestCase: # verify ns os.system("%staosdump -o ./taosdumptest/tmp6 dp3 st0_0" % binPath) - assert os.system("%staosdump -o ./taosdumptest/tmp6 dp3 st0_0 -C ns " % binPath) != 0 # verify -D:--database os.system("%staosdump -o ./taosdumptest/tmp5 --databases dp1,dp2 " % binPath) diff --git a/tests/script/general/parser/col_arithmetic_query.sim b/tests/script/general/parser/col_arithmetic_query.sim index 9b0dc8e964cf39909b803fe5ea20a7bdff8ceb59..fa1bf5e54fc1570f21160161371833b1e701f846 100644 --- a/tests/script/general/parser/col_arithmetic_query.sim +++ b/tests/script/general/parser/col_arithmetic_query.sim @@ -660,6 +660,19 @@ sql select c2-c2 from $tb sql select first(c1)-last(c1), spread(c2), max(c3) - min(c3), avg(c4)*count(c4) from $tb +# arithmetic operation with now [d.21]=============================================================== +sql_error select now from $tb +sql_error select now + 123 from $tb +sql_error select 123 + now from $tb +sql_error select now - 123 from $tb +sql_error select 123 - now from $tb +sql_error select now * 123 from $tb +sql_error select 123 * now from $tb +sql_error select now / 123 from $tb +sql_error select 123 / now from $tb +sql_error select now % 123 from $tb +sql_error select 123 % now from $tb +sql_error select 12 * now / 12 + 12 - 12 * 12 from $tb #====================================================super table query================================================== diff --git a/tests/script/general/parser/nestquery.sim b/tests/script/general/parser/nestquery.sim index 16803ea0965a66107a90aaf7ad37d715314a8258..a721e19b99f95274c658497a0fcbeb097903edf2 100644 --- a/tests/script/general/parser/nestquery.sim +++ b/tests/script/general/parser/nestquery.sim @@ -941,4 +941,207 @@ if $data02 != 0 then return -1 endi +print ==========================================> TD-11097 +sql create database td11097 +sql use td11097 +sql create table meters2 (ts timestamp, voltage bigint,num int) tags (location binary(30), groupid int); +sql create table D001 using meters2 tags ("Beijing.Chaoyang", 1); +sql create table D002 using meters2 tags ("Beijing.haidian", 2); +sql create table D003 using meters2 tags ('"Beijing.Tongzhou"', 3); +$ts = 1639556426000 +sql insert into d001 values ( $ts ,1,2); +sql insert into d001 values ( $ts +1m,2,3); +sql insert into d001 values ( $ts +2m,4,3); +sql insert into d001 values ( $ts +4m,8,3); +sql insert into d002 values ( $ts ,4,3); +sql insert into d002 values ( $ts +3m,40,3); +sql insert into d002 values ( $ts +1m,46,3); +sql insert into d001 values ( $ts +20m,1,2); +sql insert into d002 values ( $ts +21m,4,3); +sql select diff(voltage) value from meters2 group by tbname; +sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) ; +sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts; +sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts desc; + +$emptyString = @@ +print execute sql select diff(voltage) value from meters2 group by tbname; +sql select diff(voltage) value from meters2 group by tbname; +if $data00 != @21-12-15 16:21:26.000@ then + return -1 +endi +if $data01 != @1@ then + return -1 +endi +if $data02 != @d001@ then + return -1 +endi +if $data10 != @21-12-15 16:22:26.000@ then + return -1 +endi +if $data11 != @2@ then + return -1 +endi +if $data12 != @d001@ then + return -1 +endi +if $data20 != @21-12-15 16:24:26.000@ then + return -1 +endi +if $data21 != @4@ then + return -1 +endi +if $data22 != @d001@ then + return -1 +endi +if $data30 != @21-12-15 16:40:26.000@ then + return -1 +endi +if $data31 != @-7@ then + return -1 +endi +if $data32 != @d001@ then + return -1 +endi +if $data40 != @21-12-15 16:21:26.000@ then + return -1 +endi +if $data41 != @42@ then + return -1 +endi +if $data42 != @d002@ then + return -1 +endi +if $data50 != @21-12-15 16:23:26.000@ then + return -1 +endi +if $data51 != @-6@ then + return -1 +endi +if $data52 != @d002@ then + return -1 +endi +if $data60 != @21-12-15 16:41:26.000@ then + return -1 +endi +if $data61 != @-36@ then + return -1 +endi +if $data62 != @d002@ then + return -1 +endi +print execute sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) ; +sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) ; +if $data00 != @21-12-15 16:21:00.000@ then + return -1 +endi +if $data01 != @43@ then + return -1 +endi +if $data10 != @21-12-15 16:22:00.000@ then + return -1 +endi +if $data11 != @2@ then + return -1 +endi +if $data20 != @21-12-15 16:23:00.000@ then + return -1 +endi +if $data21 != @-6@ then + return -1 +endi +if $data30 != @21-12-15 16:24:00.000@ then + return -1 +endi +if $data31 != @4@ then + return -1 +endi +if $data40 != @21-12-15 16:40:00.000@ then + return -1 +endi +if $data41 != @-7@ then + return -1 +endi +if $data50 != @21-12-15 16:41:00.000@ then + return -1 +endi +if $data51 != @-36@ then + return -1 +endi +print execute sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts; +sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts; +if $data00 != @21-12-15 16:21:00.000@ then + return -1 +endi +if $data01 != @43@ then + return -1 +endi +if $data10 != @21-12-15 16:22:00.000@ then + return -1 +endi +if $data11 != @2@ then + return -1 +endi +if $data20 != @21-12-15 16:23:00.000@ then + return -1 +endi +if $data21 != @-6@ then + return -1 +endi +if $data30 != @21-12-15 16:24:00.000@ then + return -1 +endi +if $data31 != @4@ then + return -1 +endi +if $data40 != @21-12-15 16:40:00.000@ then + return -1 +endi +if $data41 != @-7@ then + return -1 +endi +if $data50 != @21-12-15 16:41:00.000@ then + return -1 +endi +if $data51 != @-36@ then + return -1 +endi +print execute sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts desc; +sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts desc; +if $data00 != @21-12-15 16:41:00.000@ then + return -1 +endi +if $data01 != @-36@ then + return -1 +endi +if $data10 != @21-12-15 16:40:00.000@ then + return -1 +endi +if $data11 != @-7@ then + return -1 +endi +if $data20 != @21-12-15 16:24:00.000@ then + return -1 +endi +if $data21 != @4@ then + return -1 +endi +if $data30 != @21-12-15 16:23:00.000@ then + return -1 +endi +if $data31 != @-6@ then + return -1 +endi +if $data40 != @21-12-15 16:22:00.000@ then + return -1 +endi +if $data41 != @2@ then + return -1 +endi +if $data50 != @21-12-15 16:21:00.000@ then + return -1 +endi +if $data51 != @43@ then + return -1 +endi +sql drop database td11097 system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/parser/select_with_tags.sim b/tests/script/general/parser/select_with_tags.sim index 195eca928fa4ddbf3795ae3e40f973ea0a5e8def..258b59f4ae5ffd75878bca469efc226a6d2d0825 100644 --- a/tests/script/general/parser/select_with_tags.sim +++ b/tests/script/general/parser/select_with_tags.sim @@ -956,4 +956,39 @@ sql_error select first(c1), count(*), t2, t1, tbname from select_tags_mt0 group #sql select count(c1) from select_tags_mt0 where c1=99 group by tbname; #sql select count(*),tbname from select_tags_mt0 group by tbname +print ==================================> TD-11943 +sql create database test11943; +sql use test11943; +sql create stable st (ts timestamp , id int ) tags (ind int ); +sql insert into sub1 using st tags(1) values(now ,1); +sql insert into sub1 using st tags(1) values(now ,2); +sql insert into sub2 using st tags(2) values(now ,3); +sql insert into sub2 using st tags(2) values(now ,4); +sql select tbname ,max(id)+5 from sub1; +if $data00 != @sub1@ then + return -1 +endi +if $data01 != @7.000000000@ then + return -1 +endi +sql select ind, max(id)+5 from st group by tbname +if $data00 != @1@ then + return -1 +endi +if $data01 != @7.000000000@ then + return -1 +endi +if $data02 != @sub1@ then + return -1 +endi +if $data10 != @2@ then + return -1 +endi +if $data11 != @9.000000000@ then + return -1 +endi +if $data12 != @sub2@ then + return -1 +endi +sql drop database test11943 system sh/exec.sh -n dnode1 -s stop -x SIGINT