diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 43716a65b1350d8e21783d436da4759b8cfca49c..67df5ac8e825c2efdd8159c706518a6caa55aa89 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -1073,7 +1073,7 @@ static bool isTopBottomUniqueQuery(SQueryInfo* pQueryInfo) { for (int32_t i = 0; i < size; ++i) { int32_t functionId = tscExprGet(pQueryInfo, i)->base.functionId; - if (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM + if (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM || functionId == TSDB_FUNC_SAMPLE || functionId == TSDB_FUNC_UNIQUE || functionId == TSDB_FUNC_TAIL) { return true; } diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 47efc29031b972818fbc540150613b61c0b199c5..c23ba15d44928bb4023c5615edb792f81b1de3d5 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -2701,8 +2701,11 @@ int32_t tscExprTopBottomIndex(SQueryInfo* pQueryInfo){ SExprInfo* pExpr = tscExprGet(pQueryInfo, i); if (pExpr == NULL) continue; - if (pExpr->base.functionId == TSDB_FUNC_TOP || pExpr->base.functionId == TSDB_FUNC_BOTTOM - || pExpr->base.functionId == TSDB_FUNC_UNIQUE || pExpr->base.functionId == TSDB_FUNC_TAIL) { + if (pExpr->base.functionId == TSDB_FUNC_TOP + || pExpr->base.functionId == TSDB_FUNC_BOTTOM + || pExpr->base.functionId == TSDB_FUNC_SAMPLE + || pExpr->base.functionId == TSDB_FUNC_UNIQUE + || pExpr->base.functionId == TSDB_FUNC_TAIL) { return i; } } diff --git a/tests/develop-test/2-query/TD-14745.py b/tests/develop-test/2-query/TD-14745.py new file mode 100644 index 0000000000000000000000000000000000000000..f5360ee91bef6fefa09eff9606d8ce99e5052e7e --- /dev/null +++ b/tests/develop-test/2-query/TD-14745.py @@ -0,0 +1,43 @@ +import sys +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import tdDnodes +from math import inf + +class TDTestCase: + def caseDescription(self): + ''' + case1: [TD-13946]core dump of sampling binary column so that when result from vnode exceeds INT16_MAX bytes + ''' + return + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self._conn = conn + + def run(self): + print("running {}".format(__file__)) + tdSql.execute("drop database if exists td14745") + tdSql.execute("create database td14745") + tdSql.execute("use td14745") + + tdSql.execute("create table st ( ts timestamp, i int) tags (t1 int)") + tdSql.execute("create table ct1 using st tags(1)") + + for i in range(100): + tdSql.execute("insert into ct1 values(now+{}a, {})".format(100*i, i)) + + tdSql.query("select sample(i,3) from ct1 interval(1s)") + tdSql.checkCols(2) + + tdSql.query("select sample(i,3) from ct1 session(ts, 200a)") + tdSql.checkCols(2) + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) + diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index f1abeeab32a3a908805c125e04cfa61e8b5f9175..77ab1f3b6b3a8fec48b38caf1e01c23514331fbc 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -725,6 +725,7 @@ 5,,develop-test,python3 ./test.py -f 2-query/scalar_triangle.py 5,,develop-test,python3 ./test.py -f 2-query/scalar_expression.py 5,,develop-test,python3 ./test.py -f 2-query/scalar_powlog.py +5,,develop-test,python3 ./test.py -f 2-query/TD-14745.py 4,,system-test,python3 test.py -f 4-taosAdapter/TD-12163.py 4,,system-test,python3 ./test.py -f 3-connectors/restful/restful_binddbname.py 4,,system-test,python3 ./test.py -f 2-query/TD-12614.py