Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
af407cb5
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看板
提交
af407cb5
编写于
5月 17, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-225] fix bugs in case of ts disorder in mem/imem and data in file
上级
9376be5f
变更
14
展开全部
隐藏空白更改
内联
并排
Showing
14 changed file
with
400 addition
and
204 deletion
+400
-204
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+1
-1
src/inc/taosdef.h
src/inc/taosdef.h
+1
-1
src/inc/tsdb.h
src/inc/tsdb.h
+0
-6
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+0
-0
src/query/inc/qUtil.h
src/query/inc/qUtil.h
+0
-0
src/query/inc/tlosertree.h
src/query/inc/tlosertree.h
+1
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+4
-4
src/query/src/qFilterFunc.c
src/query/src/qFilterFunc.c
+2
-2
src/query/src/qUtil.c
src/query/src/qUtil.c
+2
-2
src/query/src/qast.c
src/query/src/qast.c
+0
-42
src/query/src/qinterpolation.c
src/query/src/qinterpolation.c
+1
-8
src/query/src/tlosertree.c
src/query/src/tlosertree.c
+2
-2
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+384
-132
tests/examples/c/demo.c
tests/examples/c/demo.c
+2
-3
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
af407cb5
...
@@ -30,10 +30,10 @@ extern "C" {
...
@@ -30,10 +30,10 @@ extern "C" {
#include "tsqlfunction.h"
#include "tsqlfunction.h"
#include "tutil.h"
#include "tutil.h"
#include "qExecutor.h"
#include "qsqlparser.h"
#include "qsqlparser.h"
#include "qsqltype.h"
#include "qsqltype.h"
#include "qtsbuf.h"
#include "qtsbuf.h"
#include "queryExecutor.h"
// forward declaration
// forward declaration
struct
SSqlInfo
;
struct
SSqlInfo
;
...
...
src/inc/taosdef.h
浏览文件 @
af407cb5
...
@@ -32,7 +32,7 @@ extern "C" {
...
@@ -32,7 +32,7 @@ extern "C" {
#define TSKEY int64_t
#define TSKEY int64_t
#endif
#endif
#define TSWINDOW_INITIALIZER
{INT64_MIN, INT64_MAX};
#define TSWINDOW_INITIALIZER
((STimeWindow) {INT64_MIN, INT64_MAX})
#define TSKEY_INITIAL_VAL INT64_MIN
#define TSKEY_INITIAL_VAL INT64_MIN
// ----------------- For variable data types such as TSDB_DATA_TYPE_BINARY and TSDB_DATA_TYPE_NCHAR
// ----------------- For variable data types such as TSDB_DATA_TYPE_BINARY and TSDB_DATA_TYPE_NCHAR
...
...
src/inc/tsdb.h
浏览文件 @
af407cb5
...
@@ -167,12 +167,6 @@ typedef struct {
...
@@ -167,12 +167,6 @@ typedef struct {
SArray
*
pGroupList
;
SArray
*
pGroupList
;
}
STableGroupInfo
;
}
STableGroupInfo
;
typedef
struct
{
}
SFields
;
#define TSDB_TS_GREATER_EQUAL 1
#define TSDB_TS_LESS_EQUAL 2
typedef
struct
SQueryRowCond
{
typedef
struct
SQueryRowCond
{
int32_t
rel
;
int32_t
rel
;
TSKEY
ts
;
TSKEY
ts
;
...
...
src/query/inc/q
uery
Executor.h
→
src/query/inc/qExecutor.h
浏览文件 @
af407cb5
文件已移动
src/query/inc/q
uery
Util.h
→
src/query/inc/qUtil.h
浏览文件 @
af407cb5
文件已移动
src/query/inc/tlosertree.h
浏览文件 @
af407cb5
...
@@ -32,7 +32,7 @@ typedef struct SLoserTreeNode {
...
@@ -32,7 +32,7 @@ typedef struct SLoserTreeNode {
typedef
struct
SLoserTreeInfo
{
typedef
struct
SLoserTreeInfo
{
int32_t
numOfEntries
;
int32_t
numOfEntries
;
int32_t
totalEntries
;
int32_t
totalEntries
;
__merge_compare_fn_t
compar
a
Fn
;
__merge_compare_fn_t
comparFn
;
void
*
param
;
void
*
param
;
SLoserTreeNode
*
pNode
;
SLoserTreeNode
*
pNode
;
...
...
src/query/src/q
uery
Executor.c
→
src/query/src/qExecutor.c
浏览文件 @
af407cb5
...
@@ -17,18 +17,18 @@
...
@@ -17,18 +17,18 @@
#include "hash.h"
#include "hash.h"
#include "hashfunc.h"
#include "hashfunc.h"
#include "qExecutor.h"
#include "qUtil.h"
#include "qast.h"
#include "qast.h"
#include "qresultBuf.h"
#include "qresultBuf.h"
#include "query.h"
#include "query.h"
#include "queryExecutor.h"
#include "queryLog.h"
#include "queryLog.h"
#include "queryUtil.h"
#include "taosmsg.h"
#include "taosmsg.h"
#include "tdataformat.h"
#include "tlosertree.h"
#include "tlosertree.h"
#include "tscUtil.h" // todo move the function to common module
#include "tscompression.h"
#include "tscompression.h"
#include "ttime.h"
#include "ttime.h"
#include "tscUtil.h" // todo move the function to common module
#include "tdataformat.h"
#define DEFAULT_INTERN_BUF_SIZE 16384L
#define DEFAULT_INTERN_BUF_SIZE 16384L
...
...
src/query/src/q
uery
FilterFunc.c
→
src/query/src/qFilterFunc.c
浏览文件 @
af407cb5
...
@@ -16,10 +16,10 @@
...
@@ -16,10 +16,10 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "os.h"
#include "os.h"
#include "qExecutor.h"
#include "taosmsg.h"
#include "taosmsg.h"
#include "tsqlfunction.h"
#include "queryExecutor.h"
#include "tcompare.h"
#include "tcompare.h"
#include "tsqlfunction.h"
bool
less_i8
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
bool
less_i8
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
return
(
*
(
int8_t
*
)
minval
<
pFilter
->
filterInfo
.
upperBndi
);
return
(
*
(
int8_t
*
)
minval
<
pFilter
->
filterInfo
.
upperBndi
);
...
...
src/query/src/q
uery
Util.c
→
src/query/src/qUtil.c
浏览文件 @
af407cb5
...
@@ -23,8 +23,8 @@
...
@@ -23,8 +23,8 @@
#include "qinterpolation.h"
#include "qinterpolation.h"
#include "ttime.h"
#include "ttime.h"
#include "q
uery
Executor.h"
#include "qExecutor.h"
#include "q
uery
Util.h"
#include "qUtil.h"
int32_t
initWindowResInfo
(
SWindowResInfo
*
pWindowResInfo
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
size
,
int32_t
initWindowResInfo
(
SWindowResInfo
*
pWindowResInfo
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
size
,
int32_t
threshold
,
int16_t
type
)
{
int32_t
threshold
,
int16_t
type
)
{
...
...
src/query/src/qast.c
浏览文件 @
af407cb5
...
@@ -476,44 +476,6 @@ typedef struct {
...
@@ -476,44 +476,6 @@ typedef struct {
SEndPoint
*
end
;
SEndPoint
*
end
;
}
SQueryCond
;
}
SQueryCond
;
//static void setInitialValueForRangeQueryCondition(tSKipListQueryCond *q, int8_t type) {
// q->lowerBndRelOptr = TSDB_RELATION_GREATER;
// q->upperBndRelOptr = TSDB_RELATION_LESS;
//
// switch (type) {
// case TSDB_DATA_TYPE_BOOL:
// case TSDB_DATA_TYPE_TINYINT:
// case TSDB_DATA_TYPE_SMALLINT:
// case TSDB_DATA_TYPE_INT:
// case TSDB_DATA_TYPE_BIGINT: {
// q->upperBnd.nType = TSDB_DATA_TYPE_BIGINT;
// q->lowerBnd.nType = TSDB_DATA_TYPE_BIGINT;
//
// q->upperBnd.i64Key = INT64_MAX;
// q->lowerBnd.i64Key = INT64_MIN;
// break;
// };
// case TSDB_DATA_TYPE_FLOAT:
// case TSDB_DATA_TYPE_DOUBLE: {
// q->upperBnd.nType = TSDB_DATA_TYPE_DOUBLE;
// q->lowerBnd.nType = TSDB_DATA_TYPE_DOUBLE;
// q->upperBnd.dKey = DBL_MAX;
// q->lowerBnd.dKey = -DBL_MIN;
// break;
// };
// case TSDB_DATA_TYPE_NCHAR:
// case TSDB_DATA_TYPE_BINARY: {
// q->upperBnd.nType = type;
// q->upperBnd.pz = NULL;
// q->upperBnd.nLen = -1;
//
// q->lowerBnd.nType = type;
// q->lowerBnd.pz = NULL;
// q->lowerBnd.nLen = -1;
// }
// }
//}
// todo check for malloc failure
// todo check for malloc failure
static
int32_t
setQueryCond
(
tQueryInfo
*
queryColInfo
,
SQueryCond
*
pCond
)
{
static
int32_t
setQueryCond
(
tQueryInfo
*
queryColInfo
,
SQueryCond
*
pCond
)
{
int32_t
optr
=
queryColInfo
->
optr
;
int32_t
optr
=
queryColInfo
->
optr
;
...
@@ -788,7 +750,6 @@ static void exprTreeTraverseImpl(tExprNode *pExpr, SArray *pResult, SExprTravers
...
@@ -788,7 +750,6 @@ static void exprTreeTraverseImpl(tExprNode *pExpr, SArray *pResult, SExprTravers
taosArrayCopy
(
pResult
,
array
);
taosArrayCopy
(
pResult
,
array
);
}
}
static
void
tSQLBinaryTraverseOnSkipList
(
tExprNode
*
pExpr
,
SArray
*
pResult
,
SSkipList
*
pSkipList
,
SExprTraverseSupp
*
param
)
{
static
void
tSQLBinaryTraverseOnSkipList
(
tExprNode
*
pExpr
,
SArray
*
pResult
,
SSkipList
*
pSkipList
,
SExprTraverseSupp
*
param
)
{
SSkipListIterator
*
iter
=
tSkipListCreateIter
(
pSkipList
);
SSkipListIterator
*
iter
=
tSkipListCreateIter
(
pSkipList
);
...
@@ -834,8 +795,6 @@ static void tQueryIndexlessColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo,
...
@@ -834,8 +795,6 @@ static void tQueryIndexlessColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo,
tSkipListDestroyIter
(
iter
);
tSkipListDestroyIter
(
iter
);
}
}
// post-root order traverse syntax tree
// post-root order traverse syntax tree
void
tExprTreeTraverse
(
tExprNode
*
pExpr
,
SSkipList
*
pSkipList
,
SArray
*
result
,
SExprTraverseSupp
*
param
)
{
void
tExprTreeTraverse
(
tExprNode
*
pExpr
,
SSkipList
*
pSkipList
,
SArray
*
result
,
SExprTraverseSupp
*
param
)
{
if
(
pExpr
==
NULL
)
{
if
(
pExpr
==
NULL
)
{
...
@@ -1100,7 +1059,6 @@ static char* exception_strdup(const char* str) {
...
@@ -1100,7 +1059,6 @@ static char* exception_strdup(const char* str) {
return
p
;
return
p
;
}
}
static
tExprNode
*
exprTreeFromBinaryImpl
(
SBufferReader
*
br
)
{
static
tExprNode
*
exprTreeFromBinaryImpl
(
SBufferReader
*
br
)
{
int32_t
anchor
=
CLEANUP_GET_ANCHOR
();
int32_t
anchor
=
CLEANUP_GET_ANCHOR
();
...
...
src/query/src/qinterpolation.c
浏览文件 @
af407cb5
...
@@ -185,6 +185,7 @@ int32_t taosNumOfRemainRows(SFillInfo* pFillInfo) {
...
@@ -185,6 +185,7 @@ int32_t taosNumOfRemainRows(SFillInfo* pFillInfo) {
:
pFillInfo
->
rowIdx
+
1
;
:
pFillInfo
->
rowIdx
+
1
;
}
}
// todo: refactor
static
double
linearInterpolationImpl
(
double
v1
,
double
v2
,
double
k1
,
double
k2
,
double
k
)
{
static
double
linearInterpolationImpl
(
double
v1
,
double
v2
,
double
k1
,
double
k2
,
double
k
)
{
return
v1
+
(
v2
-
v1
)
*
(
k
-
k1
)
/
(
k2
-
k1
);
return
v1
+
(
v2
-
v1
)
*
(
k
-
k1
)
/
(
k2
-
k1
);
}
}
...
@@ -449,14 +450,6 @@ int32_t taosDoInterpoResult(SFillInfo* pFillInfo, tFilePage** data, int32_t numO
...
@@ -449,14 +450,6 @@ int32_t taosDoInterpoResult(SFillInfo* pFillInfo, tFilePage** data, int32_t numO
}
}
}
}
void
taosFillInfoSetSource
(
SFillInfo
*
pFillInfo
,
tFilePage
**
data
,
TSKEY
endKey
)
{
pFillInfo
->
endKey
=
endKey
;
for
(
int32_t
i
=
0
;
i
<
pFillInfo
->
numOfCols
;
++
i
)
{
memcpy
(
pFillInfo
->
pData
[
i
],
data
[
i
]
->
data
,
pFillInfo
->
numOfRows
*
pFillInfo
->
pFillCol
[
i
].
col
.
bytes
);
}
}
void
taosGenerateDataBlock
(
SFillInfo
*
pFillInfo
,
tFilePage
**
output
,
int64_t
*
outputRows
,
int32_t
capacity
)
{
void
taosGenerateDataBlock
(
SFillInfo
*
pFillInfo
,
tFilePage
**
output
,
int64_t
*
outputRows
,
int32_t
capacity
)
{
int32_t
remain
=
taosNumOfRemainRows
(
pFillInfo
);
// todo use iterator?
int32_t
remain
=
taosNumOfRemainRows
(
pFillInfo
);
// todo use iterator?
...
...
src/query/src/tlosertree.c
浏览文件 @
af407cb5
...
@@ -54,7 +54,7 @@ uint32_t tLoserTreeCreate(SLoserTreeInfo** pTree, int32_t numOfEntries, void* pa
...
@@ -54,7 +54,7 @@ uint32_t tLoserTreeCreate(SLoserTreeInfo** pTree, int32_t numOfEntries, void* pa
(
*
pTree
)
->
numOfEntries
=
numOfEntries
;
(
*
pTree
)
->
numOfEntries
=
numOfEntries
;
(
*
pTree
)
->
totalEntries
=
totalEntries
;
(
*
pTree
)
->
totalEntries
=
totalEntries
;
(
*
pTree
)
->
param
=
param
;
(
*
pTree
)
->
param
=
param
;
(
*
pTree
)
->
compar
a
Fn
=
compareFn
;
(
*
pTree
)
->
comparFn
=
compareFn
;
// set initial value for loser tree
// set initial value for loser tree
tLoserTreeInit
(
*
pTree
);
tLoserTreeInit
(
*
pTree
);
...
@@ -95,7 +95,7 @@ void tLoserTreeAdjust(SLoserTreeInfo* pTree, int32_t idx) {
...
@@ -95,7 +95,7 @@ void tLoserTreeAdjust(SLoserTreeInfo* pTree, int32_t idx) {
return
;
return
;
}
}
int32_t
ret
=
pTree
->
compar
a
Fn
(
&
pTree
->
pNode
[
parentId
],
&
kLeaf
,
pTree
->
param
);
int32_t
ret
=
pTree
->
comparFn
(
&
pTree
->
pNode
[
parentId
],
&
kLeaf
,
pTree
->
param
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
SLoserTreeNode
t
=
pTree
->
pNode
[
parentId
];
SLoserTreeNode
t
=
pTree
->
pNode
[
parentId
];
pTree
->
pNode
[
parentId
]
=
kLeaf
;
pTree
->
pNode
[
parentId
]
=
kLeaf
;
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
af407cb5
此差异已折叠。
点击以展开。
tests/examples/c/demo.c
浏览文件 @
af407cb5
...
@@ -74,9 +74,8 @@ int main(int argc, char *argv[]) {
...
@@ -74,9 +74,8 @@ int main(int argc, char *argv[]) {
printf
(
"success to connect to server
\n
"
);
printf
(
"success to connect to server
\n
"
);
doQuery
(
taos
,
"create database if not exists test"
);
doQuery
(
taos
,
"create database if not exists test"
);
doQuery
(
taos
,
"create database if not exists test"
);
doQuery
(
taos
,
"use test"
);
// doQuery(taos, "use test");
doQuery
(
taos
,
"select count(*) from m1 where ts>='2020-1-1 1:1:1' and ts<='2020-1-1 1:1:59' interval(500a) fill(value, 99)"
);
// doQuery(taos, "select sum(k)*max(k), sum(k), max(k) from tm99");
// doQuery(taos, "create table t1(ts timestamp, k binary(12), f nchar(2))");
// doQuery(taos, "create table t1(ts timestamp, k binary(12), f nchar(2))");
// for(int32_t i = 0; i< 100000; ++i) {
// for(int32_t i = 0; i< 100000; ++i) {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录