提交 e630b016 编写于 作者: S Shengliang Guan

Merge remote-tracking branch 'origin/master' into feature/d7

...@@ -967,7 +967,6 @@ SSDataBlock* doGlobalAggregate(void* param, bool* newgroup) { ...@@ -967,7 +967,6 @@ SSDataBlock* doGlobalAggregate(void* param, bool* newgroup) {
if (pOperator->pRuntimeEnv->pQueryAttr->order.order == TSDB_ORDER_DESC) { if (pOperator->pRuntimeEnv->pQueryAttr->order.order == TSDB_ORDER_DESC) {
SWAP(w->skey, w->ekey, TSKEY); SWAP(w->skey, w->ekey, TSKEY);
assert(w->skey <= w->ekey);
} }
} }
} }
......
...@@ -2029,6 +2029,7 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS ...@@ -2029,6 +2029,7 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS
const char* msg6 = "not support distinct mixed with join"; const char* msg6 = "not support distinct mixed with join";
const char* msg7 = "not support distinct mixed with groupby"; const char* msg7 = "not support distinct mixed with groupby";
const char* msg8 = "not support distinct in nest query"; const char* msg8 = "not support distinct in nest query";
const char* msg9 = "invalid alias name";
// too many result columns not support order by in query // too many result columns not support order by in query
if (taosArrayGetSize(pSelNodeList) > TSDB_MAX_COLUMNS) { if (taosArrayGetSize(pSelNodeList) > TSDB_MAX_COLUMNS) {
...@@ -2052,6 +2053,9 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS ...@@ -2052,6 +2053,9 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS
hasDistinct = (pItem->distinct == true); hasDistinct = (pItem->distinct == true);
distIdx = hasDistinct ? i : -1; distIdx = hasDistinct ? i : -1;
} }
if(pItem->aliasName != NULL && validateColumnName(pItem->aliasName) != TSDB_CODE_SUCCESS){
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg9);
}
int32_t type = pItem->pNode->type; int32_t type = pItem->pNode->type;
if (type == SQL_NODE_SQLFUNCTION) { if (type == SQL_NODE_SQLFUNCTION) {
......
...@@ -14,6 +14,7 @@ from util.log import tdLog ...@@ -14,6 +14,7 @@ from util.log import tdLog
from util.cases import tdCases from util.cases import tdCases
from util.sql import tdSql from util.sql import tdSql
from util.common import tdCom from util.common import tdCom
import random
class TDTestCase: class TDTestCase:
def init(self, conn, logSql): def init(self, conn, logSql):
...@@ -48,6 +49,26 @@ class TDTestCase: ...@@ -48,6 +49,26 @@ class TDTestCase:
tdSql.query(f'select {table_name_sub1},{table_name_sub2},{table_name_sub3},{table_name_sub4},{table_name_sub5},{table_name_sub6},{table_name_sub7},{table_name_sub8},{table_name_sub9} from {table_name} where tbname in ("{table_name_sub1}","{table_name_sub2}","{table_name_sub3}","{table_name_sub4}","{table_name_sub5}","{table_name_sub6}","{table_name_sub7}","{table_name_sub8}","{table_name_sub9}") and ts >= "1980-01-01 00:00:00.000"') tdSql.query(f'select {table_name_sub1},{table_name_sub2},{table_name_sub3},{table_name_sub4},{table_name_sub5},{table_name_sub6},{table_name_sub7},{table_name_sub8},{table_name_sub9} from {table_name} where tbname in ("{table_name_sub1}","{table_name_sub2}","{table_name_sub3}","{table_name_sub4}","{table_name_sub5}","{table_name_sub6}","{table_name_sub7}","{table_name_sub8}","{table_name_sub9}") and ts >= "1980-01-01 00:00:00.000"')
tdSql.checkRows(90) tdSql.checkRows(90)
# TS-634
tdLog.info("test case for bug TS-634")
tdSql.execute("create database test")
tdSql.execute("use test")
tdSql.execute("create table meters (ts TIMESTAMP,voltage INT) TAGS (tableid INT)")
tdSql.execute("CREATE TABLE t1 USING meters TAGS (1)")
tdSql.execute("CREATE TABLE t2 USING meters TAGS (2)")
ts = 1605381041000
for i in range(10):
tdSql.execute("INSERT INTO t1 values(%d, %d)" % (ts + i, random.randint(0, 100)))
tdSql.execute("INSERT INTO t2 values(%d, %d)" % (ts + i, random.randint(0, 100)))
tdSql.query("select last_row(*), tbname from meters group by tbname order by ts desc")
tdSql.checkRows(2)
tdSql.execute("INSERT INTO t2 values(now, 2)")
tdSql.query("select last_row(*), tbname from meters group by tbname order by ts desc")
tdSql.checkRows(2)
def run(self): def run(self):
tdSql.prepare() tdSql.prepare()
self.queryGroupTbname() self.queryGroupTbname()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册