Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ee70606f
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
ee70606f
编写于
3月 01, 2023
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: projection query in descending order result error issue
上级
6bb2c36e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
139 addition
and
1 deletion
+139
-1
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+2
-1
tests/script/api/insertSameTs.c
tests/script/api/insertSameTs.c
+136
-0
tests/script/api/makefile
tests/script/api/makefile
+1
-0
未找到文件。
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
ee70606f
...
...
@@ -3512,6 +3512,7 @@ static int32_t checkForNeighborFileBlock(STsdbReader* pReader, STableBlockScanIn
CHECK_FILEBLOCK_STATE
*
state
)
{
SFileBlockDumpInfo
*
pDumpInfo
=
&
pReader
->
status
.
fBlockDumpInfo
;
SBlockData
*
pBlockData
=
&
pReader
->
status
.
fileBlockData
;
bool
asc
=
ASCENDING_TRAVERSE
(
pReader
->
order
);
*
state
=
CHECK_FILEBLOCK_QUIT
;
int32_t
step
=
ASCENDING_TRAVERSE
(
pReader
->
order
)
?
1
:
-
1
;
...
...
@@ -3522,7 +3523,7 @@ static int32_t checkForNeighborFileBlock(STsdbReader* pReader, STableBlockScanIn
if
(
loadNeighbor
&&
(
code
==
TSDB_CODE_SUCCESS
))
{
pDumpInfo
->
rowIndex
=
doMergeRowsInFileBlockImpl
(
pBlockData
,
pDumpInfo
->
rowIndex
,
key
,
pMerger
,
&
pReader
->
verRange
,
step
);
if
(
pDumpInfo
->
rowIndex
>=
pDumpInfo
->
totalRows
)
{
if
(
(
pDumpInfo
->
rowIndex
>=
pDumpInfo
->
totalRows
&&
asc
)
||
(
pDumpInfo
->
rowIndex
<
0
&&
!
asc
)
)
{
*
state
=
CHECK_FILEBLOCK_CONT
;
}
}
...
...
tests/script/api/insertSameTs.c
0 → 100644
浏览文件 @
ee70606f
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// TAOS standard API example. The same syntax as MySQL, but only a subset
// to compile: gcc -o demo demo.c -ltaos
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "taos.h" // TAOS header file
static
void
queryDB
(
TAOS
*
taos
,
char
*
command
)
{
int
i
;
TAOS_RES
*
pSql
=
NULL
;
int32_t
code
=
-
1
;
for
(
i
=
0
;
i
<
5
;
i
++
)
{
if
(
NULL
!=
pSql
)
{
taos_free_result
(
pSql
);
pSql
=
NULL
;
}
pSql
=
taos_query
(
taos
,
command
);
code
=
taos_errno
(
pSql
);
if
(
0
==
code
)
{
break
;
}
}
if
(
code
!=
0
)
{
fprintf
(
stderr
,
"Failed to run %s, reason: %s
\n
"
,
command
,
taos_errstr
(
pSql
));
taos_free_result
(
pSql
);
taos_close
(
taos
);
exit
(
EXIT_FAILURE
);
}
taos_free_result
(
pSql
);
}
void
Test
(
TAOS
*
taos
,
char
*
qstr
);
int
main
(
int
argc
,
char
*
argv
[])
{
char
qstr
[
1024
];
// connect to server
if
(
argc
<
2
)
{
printf
(
"please input server-ip
\n
"
);
return
0
;
}
TAOS
*
taos
=
taos_connect
(
argv
[
1
],
"root"
,
"taosdata"
,
NULL
,
0
);
if
(
taos
==
NULL
)
{
printf
(
"failed to connect to server, reason:%s
\n
"
,
"null taos"
/*taos_errstr(taos)*/
);
exit
(
1
);
}
Test
(
taos
,
qstr
);
taos_close
(
taos
);
taos_cleanup
();
}
void
Test
(
TAOS
*
taos
,
char
*
qstr
)
{
queryDB
(
taos
,
"drop database if exists demo"
);
queryDB
(
taos
,
"create database demo vgroups 1 minrows 10"
);
TAOS_RES
*
result
;
queryDB
(
taos
,
"use demo"
);
queryDB
(
taos
,
"create table m1 (ts timestamp, ti tinyint, si smallint, i int, bi bigint, f float, d double, b binary(10))"
);
printf
(
"success to create table
\n
"
);
int
i
=
0
;
for
(
int32_t
n
=
0
;
n
<
10
;
++
n
)
{
for
(
i
=
0
;
i
<
10
;
++
i
)
{
int32_t
v
=
n
*
10
+
i
;
sprintf
(
qstr
,
"insert into m1 values (%"
PRId64
", %d, %d, %d, %d, %f, %lf, '%s')"
,
(
uint64_t
)
1546300800000
,
v
,
v
,
v
,
v
*
10000000
,
v
*
1
.
0
,
v
*
2
.
0
,
"hello"
);
printf
(
"qstr: %s
\n
"
,
qstr
);
TAOS_RES
*
result1
=
taos_query
(
taos
,
qstr
);
if
(
result1
==
NULL
||
taos_errno
(
result1
)
!=
0
)
{
printf
(
"failed to insert row, reason:%s
\n
"
,
taos_errstr
(
result1
));
taos_free_result
(
result1
);
exit
(
1
);
}
else
{
printf
(
"insert row: %i
\n
"
,
v
);
}
taos_free_result
(
result1
);
strcpy
(
qstr
,
"flush database demo"
);
result1
=
taos_query
(
taos
,
qstr
);
if
(
result1
==
NULL
||
taos_errno
(
result1
)
!=
0
)
{
printf
(
"failed to fluash database, reason:%s
\n
"
,
taos_errstr
(
result1
));
taos_free_result
(
result1
);
exit
(
1
);
}
taos_free_result
(
result1
);
}
}
// query the records
sprintf
(
qstr
,
"SELECT * FROM m1 order by ts desc"
);
result
=
taos_query
(
taos
,
qstr
);
if
(
result
==
NULL
||
taos_errno
(
result
)
!=
0
)
{
printf
(
"failed to select, reason:%s
\n
"
,
taos_errstr
(
result
));
taos_free_result
(
result
);
exit
(
1
);
}
TAOS_ROW
row
;
int
rows
=
0
;
int
num_fields
=
taos_field_count
(
result
);
TAOS_FIELD
*
fields
=
taos_fetch_fields
(
result
);
printf
(
"num_fields = %d
\n
"
,
num_fields
);
printf
(
"select * from table order by ts desc, result:
\n
"
);
// fetch the records row by row
while
((
row
=
taos_fetch_row
(
result
)))
{
char
temp
[
1024
]
=
{
0
};
rows
++
;
taos_print_row
(
temp
,
row
,
fields
,
num_fields
);
printf
(
"%s
\n
"
,
temp
);
}
taos_free_result
(
result
);
}
tests/script/api/makefile
浏览文件 @
ee70606f
...
...
@@ -14,6 +14,7 @@ exe:
gcc
$(CFLAGS)
./batchprepare.c
-o
$(ROOT)
batchprepare
$(LFLAGS)
gcc
$(CFLAGS)
./stopquery.c
-o
$(ROOT)
stopquery
$(LFLAGS)
gcc
$(CFLAGS)
./dbTableRoute.c
-o
$(ROOT)
dbTableRoute
$(LFLAGS)
gcc
$(CFLAGS)
./insertSameTs.c
-o
$(ROOT)
insertSameTs
$(LFLAGS)
clean
:
rm
$(ROOT)
batchprepare
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录