提交 4585cf61 编写于 作者: wmmhello's avatar wmmhello

Merge branch 'develop' into fix/TD-11201

......@@ -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);
}
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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));
......
Subproject commit 0b4a16e96b5cc9cb6e4f8cacf6a1f3028c91adb0
Subproject commit 7eae58a0fbf7c7321dd1bdc96e375d4c832cf373
......@@ -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))
......
......@@ -588,6 +588,12 @@ SArray* createExecOperatorPlan(SQueryAttr* pQueryAttr) {
op = OP_Fill;
taosArrayPush(plan, &op);
}
// outer query order by support
int32_t orderColId = pQueryAttr->order.orderColId;
if (pQueryAttr->vgId == 0 && orderColId != PRIMARYKEY_TIMESTAMP_COL_INDEX && orderColId != INT32_MIN) {
op = OP_Order;
taosArrayPush(plan, &op);
}
}
} else if (pQueryAttr->groupbyColumn) {
......
......@@ -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);
}
......
......@@ -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
......
......@@ -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();
}
}
......
......@@ -88,7 +88,7 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.15.0</version>
<version>2.16.0</version>
</dependency>
<!-- junit -->
<dependency>
......
......@@ -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'")
......
......@@ -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")
......
......@@ -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)
......
......@@ -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
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册