fix: top function with order by clause
This commit is contained in:
parent
62caafa356
commit
98a9789c7e
|
@ -458,7 +458,7 @@ static int32_t createAggLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect,
|
|||
|
||||
static int32_t createIndefRowsFuncLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SLogicNode** pLogicNode) {
|
||||
// top/bottom are both an aggregate function and a indefinite rows function
|
||||
if (!pSelect->hasIndefiniteRowsFunc || pSelect->hasAggFuncs) {
|
||||
if (!pSelect->hasIndefiniteRowsFunc || pSelect->hasAggFuncs || NULL != pSelect->pWindow) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,8 @@ TEST_F(PlanIntervalTest, selectFunc) {
|
|||
run("SELECT MAX(c1), MIN(c1) FROM t1 INTERVAL(10s)");
|
||||
// select function along with the columns of select row, and with INTERVAL clause
|
||||
run("SELECT MAX(c1), c2 FROM t1 INTERVAL(10s)");
|
||||
|
||||
run("SELECT TOP(c1, 1) FROM t1 INTERVAL(10s) ORDER BY c1");
|
||||
}
|
||||
|
||||
TEST_F(PlanIntervalTest, stable) {
|
||||
|
|
|
@ -81,6 +81,8 @@ int32_t getLogLevel() { return g_logLevel; }
|
|||
|
||||
class PlannerTestBaseImpl {
|
||||
public:
|
||||
PlannerTestBaseImpl() : sqlNo_(0) {}
|
||||
|
||||
void useDb(const string& acctId, const string& db) {
|
||||
caseEnv_.acctId_ = acctId;
|
||||
caseEnv_.db_ = db;
|
||||
|
@ -88,6 +90,7 @@ class PlannerTestBaseImpl {
|
|||
}
|
||||
|
||||
void run(const string& sql) {
|
||||
++sqlNo_;
|
||||
if (caseEnv_.nsql_ > 0) {
|
||||
--(caseEnv_.nsql_);
|
||||
return;
|
||||
|
@ -229,7 +232,7 @@ class PlannerTestBaseImpl {
|
|||
return;
|
||||
}
|
||||
|
||||
cout << "==========================================sql : [" << stmtEnv_.sql_ << "]" << endl;
|
||||
cout << "========================================== " << sqlNo_ << " sql : [" << stmtEnv_.sql_ << "]" << endl;
|
||||
|
||||
if (DUMP_MODULE_ALL == module || DUMP_MODULE_PARSER == module) {
|
||||
if (res_.prepareAst_.empty()) {
|
||||
|
@ -382,6 +385,7 @@ class PlannerTestBaseImpl {
|
|||
caseEnv caseEnv_;
|
||||
stmtEnv stmtEnv_;
|
||||
stmtRes res_;
|
||||
int32_t sqlNo_;
|
||||
};
|
||||
|
||||
PlannerTestBase::PlannerTestBase() : impl_(new PlannerTestBaseImpl()) {}
|
||||
|
|
Loading…
Reference in New Issue