From b4856f62e893a8008a0b5420f19ef25313f3fda7 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Mon, 9 May 2022 19:23:08 +0800 Subject: [PATCH] fix: remove order by ts limitation with top/bottom function --- src/client/src/tscSQLParser.c | 6 +++--- tests/pytest/query/querySort.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 43b8494519..e24f56ba57 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -6900,7 +6900,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq 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* msg7 = "only primary timestamp/column in groupby clause allowed as order column"; - const char* msg8 = "only column in groupby clause allowed as order column"; + //const char* msg8 = "only column in groupby clause allowed as order column"; const char* msg10 = "not support distinct mixed with order by"; const char* msg11 = "not support order with udf"; const char* msg12 = "order by tags not supported with diff/derivative/csum/mavg/stateCount/stateDuration"; @@ -7117,11 +7117,11 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq }else if (isTopBottomUniqueQuery(pQueryInfo)) { SArray *columnInfo = pQueryInfo->groupbyExpr.columnInfo; if (columnInfo != NULL && taosArrayGetSize(columnInfo) > 0) { - SColIndex* pColIndex = taosArrayGet(columnInfo, 0); + /*SColIndex* pColIndex = taosArrayGet(columnInfo, 0); if (pColIndex->colIndex != index.columnIndex) { return invalidOperationMsg(pMsgBuf, msg8); - } + }*/ } else { int32_t pos = tscExprTopBottomIndex(pQueryInfo); assert(pos > 0); diff --git a/tests/pytest/query/querySort.py b/tests/pytest/query/querySort.py index 8abec6cea1..919e2bb83a 100644 --- a/tests/pytest/query/querySort.py +++ b/tests/pytest/query/querySort.py @@ -130,7 +130,7 @@ class TDTestCase: tdSql.error("select top(tbcol1, 12) from st1 order by tbcol1,ts") tdSql.error("select top(tbcol1, 12) from st order by tbcol1,ts,tbcol2") tdSql.error("select top(tbcol1, 12) from st order by ts, tbcol1") - tdSql.error("select top(tbcol1, 2) from st1 group by tbcol1 order by tbcol2") + #tdSql.error("select top(tbcol1, 2) from st1 group by tbcol1 order by tbcol2") fun_list = ['avg','count','twa','sum','stddev','leastsquares','min', 'max','first','last','top','bottom','percentile','apercentile', -- GitLab