未验证 提交 5a3d3713 编写于 作者: D dapan1121 提交者: GitHub

Merge pull request #21601 from wangjiaming0909/fix/m/TS-3482

fix: select desc and asc return different rows after delete
...@@ -311,6 +311,9 @@ static int32_t calcConstDelete(SCalcConstContext* pCxt, SDeleteStmt* pDelete) { ...@@ -311,6 +311,9 @@ static int32_t calcConstDelete(SCalcConstContext* pCxt, SDeleteStmt* pDelete) {
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = calcConstStmtCondition(pCxt, &pDelete->pWhere, &pDelete->deleteZeroRows); code = calcConstStmtCondition(pCxt, &pDelete->pWhere, &pDelete->deleteZeroRows);
} }
if (code == TSDB_CODE_SUCCESS && pDelete->timeRange.skey > pDelete->timeRange.ekey) {
pDelete->deleteZeroRows = true;
}
return code; return code;
} }
...@@ -465,6 +468,9 @@ static bool isEmptyResultQuery(SNode* pStmt) { ...@@ -465,6 +468,9 @@ static bool isEmptyResultQuery(SNode* pStmt) {
} }
break; break;
} }
case QUERY_NODE_DELETE_STMT:
isEmptyResult = ((SDeleteStmt*)pStmt)->deleteZeroRows;
break;
default: default:
break; break;
} }
......
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect
sql create database if not exists test
sql use test
sql create table t1 (ts timestamp, c2 int)
sql insert into t1 values(now, 1)
sql delete from t1 where ts is null
sql delete from t1 where ts < now
sql select ts from t1 order by ts asc
print ----------rows: $rows
if $rows != 0 then
return -1
endi
sql select ts from t1 order by ts desc
print ----------rows: $rows
if $rows != 0 then
return -1
endi
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册