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

<fix>[TD-12342] give error tips if group by ts order by tag

上级 35ba07bd
...@@ -6288,7 +6288,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq ...@@ -6288,7 +6288,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
const char* msg0 = "only one column allowed in orderby"; const char* msg0 = "only one column allowed in orderby";
const char* msg1 = "invalid column name in orderby clause"; const char* msg1 = "invalid column name in orderby clause";
const char* msg2 = "too many order by columns"; const char* msg2 = "too many order by columns";
const char* msg3 = "only primary timestamp, first tag/tbname in groupby clause allowed as order column"; const char* msg3 = "only primary timestamp, tag/tbname in groupby clause allowed as order column";
const char* msg4 = "only tag in groupby clause allowed in order clause"; const char* msg4 = "only tag in groupby clause allowed in order clause";
const char* msg5 = "only primary timestamp/column in top/bottom function allowed as order column"; const char* msg5 = "only primary timestamp/column in top/bottom function allowed as order column";
const char* msg6 = "only primary timestamp allowed as the second order column"; const char* msg6 = "only primary timestamp allowed as the second order column";
...@@ -6310,8 +6310,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq ...@@ -6310,8 +6310,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
SArray* pSortOrder = pSqlNode->pSortOrder; SArray* pSortOrder = pSqlNode->pSortOrder;
/* /*
* for table query, there is only one or none order option is allowed, which is the * for table query, there is only one or none order option is allowed
* ts or values(top/bottom) order is supported.
* *
* for super table query, the order option must be less than 3 and the second must be ts. * for super table query, the order option must be less than 3 and the second must be ts.
* *
...@@ -6386,7 +6385,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq ...@@ -6386,7 +6385,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
return invalidOperationMsg(pMsgBuf, msg4); return invalidOperationMsg(pMsgBuf, msg4);
} }
SColIndex* pColIndex = taosArrayGet(pQueryInfo->groupbyExpr.columnInfo, 0); SColIndex* pColIndex = taosArrayGet(pQueryInfo->groupbyExpr.columnInfo, 0);
if (relTagIndex == pColIndex->colIndex) { if (relTagIndex == pColIndex->colIndex && pColIndex->flag == TSDB_COL_TAG) {
if (tscGetColumnSchemaById(pTableMetaInfo->pTableMeta, pColIndex->colId)->type == TSDB_DATA_TYPE_JSON){ if (tscGetColumnSchemaById(pTableMetaInfo->pTableMeta, pColIndex->colId)->type == TSDB_DATA_TYPE_JSON){
if(!pItem->isJsonExp){ if(!pItem->isJsonExp){
return invalidOperationMsg(pMsgBuf, msg14); return invalidOperationMsg(pMsgBuf, msg14);
......
...@@ -47,18 +47,6 @@ class TDTestCase: ...@@ -47,18 +47,6 @@ class TDTestCase:
pass pass
def check_td12340(self):
# this case expect return two column when using "group by ts"
tdSql.query("select count(*) from stb1 group by ts")
try:
tdSql.checkCols(2)
self.curret_case += 1
tdLog.printNoPrefix("the case1: td-12340 run passed")
except:
self.err_case += 1
tdLog.printNoPrefix("the case1: td-12340 run failed")
pass
def check_td12342(self): def check_td12342(self):
# this case expect return err when using "group by ts order by first-tag" # this case expect return err when using "group by ts order by first-tag"
try: try:
...@@ -73,7 +61,6 @@ class TDTestCase: ...@@ -73,7 +61,6 @@ class TDTestCase:
def run(self): def run(self):
self.create_stb() self.create_stb()
self.check_td12340()
self.check_td12342() self.check_td12342()
if self.err_case > 0: if self.err_case > 0:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册