Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
453f6946
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1181
Star
22014
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
453f6946
编写于
4月 11, 2023
作者:
D
dapan1121
提交者:
GitHub
4月 11, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #20838 from taosdata/szhou/fix-ts3110
fix: select * from (select * from t order by ts desc) order by ts
上级
7d85789d
71d59281
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
70 addition
and
0 deletion
+70
-0
source/libs/planner/src/planOptimizer.c
source/libs/planner/src/planOptimizer.c
+12
-0
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+1
-0
tests/script/tsim/query/multi_order_by.sim
tests/script/tsim/query/multi_order_by.sim
+57
-0
未找到文件。
source/libs/planner/src/planOptimizer.c
浏览文件 @
453f6946
...
...
@@ -1079,11 +1079,23 @@ static bool sortPriKeyOptMayBeOptimized(SLogicNode* pNode) {
if
(
!
sortPriKeyOptIsPriKeyOrderBy
(
pSort
->
pSortKeys
)
||
1
!=
LIST_LENGTH
(
pSort
->
node
.
pChildren
))
{
return
false
;
}
SNode
*
pChild
;
FOREACH
(
pChild
,
pSort
->
node
.
pChildren
)
{
SLogicNode
*
pSortDescendent
=
optFindPossibleNode
((
SLogicNode
*
)
pChild
,
sortPriKeyOptMayBeOptimized
);
if
(
pSortDescendent
!=
NULL
)
{
return
false
;
}
}
return
true
;
}
static
int32_t
sortPriKeyOptGetSequencingNodesImpl
(
SLogicNode
*
pNode
,
bool
groupSort
,
bool
*
pNotOptimize
,
SNodeList
**
pSequencingNodes
)
{
if
(
NULL
!=
pNode
->
pLimit
||
NULL
!=
pNode
->
pSlimit
)
{
*
pNotOptimize
=
false
;
return
TSDB_CODE_SUCCESS
;
}
switch
(
nodeType
(
pNode
))
{
case
QUERY_NODE_LOGIC_PLAN_SCAN
:
{
SScanLogicNode
*
pScan
=
(
SScanLogicNode
*
)
pNode
;
...
...
tests/parallel_test/cases.task
浏览文件 @
453f6946
...
...
@@ -875,6 +875,7 @@
,,y,script,./test.sh -f tsim/query/udf_with_const.sim
,,y,script,./test.sh -f tsim/query/join_interval.sim
,,y,script,./test.sh -f tsim/query/unionall_as_table.sim
,,y,script,./test.sh -f tsim/query/multi_order_by.sim
,,y,script,./test.sh -f tsim/query/sys_tbname.sim
,,y,script,./test.sh -f tsim/query/groupby.sim
,,y,script,./test.sh -f tsim/query/event.sim
...
...
tests/script/tsim/query/multi_order_by.sim
0 → 100644
浏览文件 @
453f6946
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 test;
sql use test;
sql create table t(ts timestamp, f int);
sql insert into t values(now,0)(now+1s, 1)(now+2s, 2)(now+3s,3)(now+4s,4)(now+5s,5)(now+6s,6)(now+7s,7)(now+8s,8)(now+9s,9)
sql select * from (select * from t order by ts desc limit 3 offset 2) order by ts;
print $data01 $data11 $data21
if $data01 != 5 then
return -1
endi
if $data11 != 6 then
return -1
endi
if $data21 != 7 then
return -1
endi
sql select * from (select * from t order by ts limit 3 offset 2) order by ts desc;
print $data01 $data11 $data21
if $data01 != 4 then
return -1
endi
if $data11 != 3 then
return -1
endi
if $data21 != 2 then
return -1
endi
sql select * from (select * from t order by ts desc limit 3 offset 2) order by ts desc;
print $data01 $data11 $data21
if $data01 != 7 then
return -1
endi
if $data11 != 6 then
return -1
endi
if $data21 != 5 then
return -1
endi
sql select * from (select * from t order by ts limit 3 offset 2) order by ts;
print $data01 $data11 $data21
if $data01 != 2 then
return -1
endi
if $data11 != 3 then
return -1
endi
if $data21 != 4 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录