Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_46246346
TDengine
提交
3e836ec7
TDengine
项目概览
weixin_46246346
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
3
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
3e836ec7
编写于
12月 11, 2020
作者:
H
haojun Liao
提交者:
GitHub
12月 11, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4539 from taosdata/feature/query
Feature/query
上级
d3ed3cda
2a1c3c1f
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
129 addition
and
52 deletion
+129
-52
packaging/cfg/taos.cfg
packaging/cfg/taos.cfg
+8
-4
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+2
-2
src/common/src/tglobal.c
src/common/src/tglobal.c
+9
-9
src/dnode/src/dnodeShell.c
src/dnode/src/dnodeShell.c
+1
-2
src/dnode/src/dnodeVRead.c
src/dnode/src/dnodeVRead.c
+8
-4
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+1
-1
src/query/src/qFilterfunc.c
src/query/src/qFilterfunc.c
+45
-28
src/vnode/src/vnodeRead.c
src/vnode/src/vnodeRead.c
+2
-2
tests/script/general/parser/tags_filter.sim
tests/script/general/parser/tags_filter.sim
+53
-0
未找到文件。
packaging/cfg/taos.cfg
浏览文件 @
3e836ec7
...
@@ -29,8 +29,12 @@
...
@@ -29,8 +29,12 @@
# number of threads per CPU core
# number of threads per CPU core
# numOfThreadsPerCore 1.0
# numOfThreadsPerCore 1.0
# the proportion of total threads responsible for query
# the proportion of total CPU cores available for query processing
# ratioOfQueryThreads 0.5
# 2.0: the query threads will be set to double of the CPU cores.
# 1.0: all CPU cores are available for query processing [default].
# 0.5: only half of the CPU cores are available for query.
# 0.0: only one core available.
# tsRatioOfQueryCores 1.0
# number of management nodes in the system
# number of management nodes in the system
# numOfMnodes 3
# numOfMnodes 3
...
@@ -265,5 +269,5 @@
...
@@ -265,5 +269,5 @@
# enable/disable stream (continuous query)
# enable/disable stream (continuous query)
# stream 1
# stream 1
#
only 50% CPU resources will be used in query processing
#
in retrieve blocking model, only in 50% query threads will be used in query processing in dnode
#
halfCoresForQuery
0
#
retrieveBlockingModel
0
src/common/inc/tglobal.h
浏览文件 @
3e836ec7
...
@@ -46,7 +46,7 @@ extern int32_t tsShellActivityTimer;
...
@@ -46,7 +46,7 @@ extern int32_t tsShellActivityTimer;
extern
uint32_t
tsMaxTmrCtrl
;
extern
uint32_t
tsMaxTmrCtrl
;
extern
float
tsNumOfThreadsPerCore
;
extern
float
tsNumOfThreadsPerCore
;
extern
int32_t
tsNumOfCommitThreads
;
extern
int32_t
tsNumOfCommitThreads
;
extern
float
tsRatioOfQuery
Threads
;
// todo remove it
extern
float
tsRatioOfQuery
Cores
;
extern
int8_t
tsDaylight
;
extern
int8_t
tsDaylight
;
extern
char
tsTimezone
[];
extern
char
tsTimezone
[];
extern
char
tsLocale
[];
extern
char
tsLocale
[];
...
@@ -57,7 +57,7 @@ extern char tsTempDir[];
...
@@ -57,7 +57,7 @@ extern char tsTempDir[];
//query buffer management
//query buffer management
extern
int32_t
tsQueryBufferSize
;
// maximum allowed usage buffer for each data node during query processing
extern
int32_t
tsQueryBufferSize
;
// maximum allowed usage buffer for each data node during query processing
extern
int32_t
ts
HalfCoresForQuery
;
// only 50% will be used in query processing
extern
int32_t
ts
RetrieveBlockingModel
;
// only 50% will be used in query processing
// client
// client
extern
int32_t
tsTableMetaKeepTimer
;
extern
int32_t
tsTableMetaKeepTimer
;
...
...
src/common/src/tglobal.c
浏览文件 @
3e836ec7
...
@@ -52,7 +52,7 @@ int32_t tsMaxConnections = 5000;
...
@@ -52,7 +52,7 @@ int32_t tsMaxConnections = 5000;
int32_t
tsShellActivityTimer
=
3
;
// second
int32_t
tsShellActivityTimer
=
3
;
// second
float
tsNumOfThreadsPerCore
=
1
.
0
f
;
float
tsNumOfThreadsPerCore
=
1
.
0
f
;
int32_t
tsNumOfCommitThreads
=
1
;
int32_t
tsNumOfCommitThreads
=
1
;
float
tsRatioOfQuery
Threads
=
0
.
5
f
;
float
tsRatioOfQuery
Cores
=
1
.
0
f
;
int8_t
tsDaylight
=
0
;
int8_t
tsDaylight
=
0
;
char
tsTimezone
[
TSDB_TIMEZONE_LEN
]
=
{
0
};
char
tsTimezone
[
TSDB_TIMEZONE_LEN
]
=
{
0
};
char
tsLocale
[
TSDB_LOCALE_LEN
]
=
{
0
};
char
tsLocale
[
TSDB_LOCALE_LEN
]
=
{
0
};
...
@@ -107,8 +107,8 @@ int64_t tsMaxRetentWindow = 24 * 3600L; // maximum time window tolerance
...
@@ -107,8 +107,8 @@ int64_t tsMaxRetentWindow = 24 * 3600L; // maximum time window tolerance
// positive value (in MB)
// positive value (in MB)
int32_t
tsQueryBufferSize
=
-
1
;
int32_t
tsQueryBufferSize
=
-
1
;
//
only 50% cpu will be used in query processing in dnode
//
in retrieve blocking model, the retrieve threads will wait for the completion of the query processing.
int32_t
ts
HalfCoresForQuery
=
0
;
int32_t
ts
RetrieveBlockingModel
=
0
;
// db parameters
// db parameters
int32_t
tsCacheBlockSize
=
TSDB_DEFAULT_CACHE_BLOCK_SIZE
;
int32_t
tsCacheBlockSize
=
TSDB_DEFAULT_CACHE_BLOCK_SIZE
;
...
@@ -444,12 +444,12 @@ static void doInitGlobalConfig(void) {
...
@@ -444,12 +444,12 @@ static void doInitGlobalConfig(void) {
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"ratioOfQuery
Thread
s"
;
cfg
.
option
=
"ratioOfQuery
Core
s"
;
cfg
.
ptr
=
&
tsRatioOfQuery
Thread
s
;
cfg
.
ptr
=
&
tsRatioOfQuery
Core
s
;
cfg
.
valType
=
TAOS_CFG_VTYPE_FLOAT
;
cfg
.
valType
=
TAOS_CFG_VTYPE_FLOAT
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
;
cfg
.
minValue
=
0
.
1
f
;
cfg
.
minValue
=
0
.
0
f
;
cfg
.
maxValue
=
0
.
9
f
;
cfg
.
maxValue
=
2
.
0
f
;
cfg
.
ptrLength
=
0
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
taosInitConfigOption
(
cfg
);
...
@@ -887,8 +887,8 @@ static void doInitGlobalConfig(void) {
...
@@ -887,8 +887,8 @@ static void doInitGlobalConfig(void) {
cfg
.
unitType
=
TAOS_CFG_UTYPE_BYTE
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_BYTE
;
taosInitConfigOption
(
cfg
);
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"
halfCoresForQuery
"
;
cfg
.
option
=
"
retrieveBlockingModel
"
;
cfg
.
ptr
=
&
ts
HalfCoresForQuery
;
cfg
.
ptr
=
&
ts
RetrieveBlockingModel
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_SHOW
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_SHOW
;
cfg
.
minValue
=
0
;
cfg
.
minValue
=
0
;
...
...
src/dnode/src/dnodeShell.c
浏览文件 @
3e836ec7
...
@@ -70,8 +70,7 @@ int32_t dnodeInitShell() {
...
@@ -70,8 +70,7 @@ int32_t dnodeInitShell() {
dnodeProcessShellMsgFp
[
TSDB_MSG_TYPE_NETWORK_TEST
]
=
dnodeSendStartupStep
;
dnodeProcessShellMsgFp
[
TSDB_MSG_TYPE_NETWORK_TEST
]
=
dnodeSendStartupStep
;
int32_t
numOfThreads
=
tsNumOfCores
*
tsNumOfThreadsPerCore
;
int32_t
numOfThreads
=
(
tsNumOfCores
*
tsNumOfThreadsPerCore
)
/
2
.
0
;
numOfThreads
=
(
int32_t
)
((
1
.
0
-
tsRatioOfQueryThreads
)
*
numOfThreads
/
2
.
0
);
if
(
numOfThreads
<
1
)
{
if
(
numOfThreads
<
1
)
{
numOfThreads
=
1
;
numOfThreads
=
1
;
}
}
...
...
src/dnode/src/dnodeVRead.c
浏览文件 @
3e836ec7
...
@@ -26,16 +26,20 @@ static SWorkerPool tsVQueryWP;
...
@@ -26,16 +26,20 @@ static SWorkerPool tsVQueryWP;
static
SWorkerPool
tsVFetchWP
;
static
SWorkerPool
tsVFetchWP
;
int32_t
dnodeInitVRead
()
{
int32_t
dnodeInitVRead
()
{
const
int32_t
maxFetchThreads
=
4
;
// calculate the available query thread
float
threadsForQuery
=
MAX
(
tsNumOfCores
*
tsRatioOfQueryCores
,
1
);
tsVQueryWP
.
name
=
"vquery"
;
tsVQueryWP
.
name
=
"vquery"
;
tsVQueryWP
.
workerFp
=
dnodeProcessReadQueue
;
tsVQueryWP
.
workerFp
=
dnodeProcessReadQueue
;
tsVQueryWP
.
min
=
tsNumOfCores
;
tsVQueryWP
.
min
=
(
int32_t
)
threadsForQuery
;
tsVQueryWP
.
max
=
tsNumOfCores
/* * tsNumOfThreadsPerCore*/
;
tsVQueryWP
.
max
=
tsVQueryWP
.
min
;
// if (tsVQueryWP.max <= tsVQueryWP.min * 2) tsVQueryWP.max = 2 * tsVQueryWP.min;
if
(
tWorkerInit
(
&
tsVQueryWP
)
!=
0
)
return
-
1
;
if
(
tWorkerInit
(
&
tsVQueryWP
)
!=
0
)
return
-
1
;
tsVFetchWP
.
name
=
"vfetch"
;
tsVFetchWP
.
name
=
"vfetch"
;
tsVFetchWP
.
workerFp
=
dnodeProcessReadQueue
;
tsVFetchWP
.
workerFp
=
dnodeProcessReadQueue
;
tsVFetchWP
.
min
=
MIN
(
4
,
tsNumOfCores
);
tsVFetchWP
.
min
=
MIN
(
maxFetchThreads
,
tsNumOfCores
);
tsVFetchWP
.
max
=
tsVFetchWP
.
min
;
tsVFetchWP
.
max
=
tsVFetchWP
.
min
;
if
(
tWorkerInit
(
&
tsVFetchWP
)
!=
0
)
return
-
1
;
if
(
tWorkerInit
(
&
tsVFetchWP
)
!=
0
)
return
-
1
;
...
...
src/query/src/qExecutor.c
浏览文件 @
3e836ec7
...
@@ -7635,7 +7635,7 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex
...
@@ -7635,7 +7635,7 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
(
ts
HalfCoresForQuery
)
{
if
(
ts
RetrieveBlockingModel
)
{
pQInfo
->
rspContext
=
pRspContext
;
pQInfo
->
rspContext
=
pRspContext
;
tsem_wait
(
&
pQInfo
->
ready
);
tsem_wait
(
&
pQInfo
->
ready
);
*
buildRes
=
true
;
*
buildRes
=
true
;
...
...
src/query/src/qFilterfunc.c
浏览文件 @
3e836ec7
...
@@ -21,6 +21,12 @@
...
@@ -21,6 +21,12 @@
#include "tcompare.h"
#include "tcompare.h"
#include "tsqlfunction.h"
#include "tsqlfunction.h"
#define FLT_EQUAL(_x, _y) (fabs((_x) - (_y)) <= (4 * FLT_EPSILON))
#define FLT_GREATER(_x, _y) (!FLT_EQUAL((_x), (_y)) && ((_x) > (_y)))
#define FLT_LESS(_x, _y) (!FLT_EQUAL((_x), (_y)) && ((_x) < (_y)))
#define FLT_GREATEREQUAL(_x, _y) (FLT_EQUAL((_x), (_y)) || ((_x) > (_y)))
#define FLT_LESSEQUAL(_x, _y) (FLT_EQUAL((_x), (_y)) || ((_x) < (_y)))
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
);
}
}
...
@@ -38,35 +44,35 @@ bool less_i64(SColumnFilterElem *pFilter, char *minval, char *maxval) {
...
@@ -38,35 +44,35 @@ bool less_i64(SColumnFilterElem *pFilter, char *minval, char *maxval) {
}
}
bool
less_ds
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
bool
less_ds
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
return
(
*
(
float
*
)
minval
<
pFilter
->
filterInfo
.
upperBndd
);
return
FLT_LESS
(
*
(
float
*
)
minval
,
pFilter
->
filterInfo
.
upperBndd
);
}
}
bool
less_dd
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
bool
less_dd
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
return
(
*
(
double
*
)
minval
<
pFilter
->
filterInfo
.
upperBndd
)
;
return
*
(
double
*
)
minval
<
pFilter
->
filterInfo
.
upperBndd
;
}
}
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
bool
large_i8
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
bool
large
r
_i8
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
return
(
*
(
int8_t
*
)
maxval
>
pFilter
->
filterInfo
.
lowerBndi
);
return
(
*
(
int8_t
*
)
maxval
>
pFilter
->
filterInfo
.
lowerBndi
);
}
}
bool
large_i16
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
bool
large
r
_i16
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
return
(
*
(
int16_t
*
)
maxval
>
pFilter
->
filterInfo
.
lowerBndi
);
return
(
*
(
int16_t
*
)
maxval
>
pFilter
->
filterInfo
.
lowerBndi
);
}
}
bool
large_i32
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
bool
large
r
_i32
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
return
(
*
(
int32_t
*
)
maxval
>
pFilter
->
filterInfo
.
lowerBndi
);
return
(
*
(
int32_t
*
)
maxval
>
pFilter
->
filterInfo
.
lowerBndi
);
}
}
bool
large_i64
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
bool
large
r
_i64
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
return
(
*
(
int64_t
*
)
maxval
>
pFilter
->
filterInfo
.
lowerBndi
);
return
(
*
(
int64_t
*
)
maxval
>
pFilter
->
filterInfo
.
lowerBndi
);
}
}
bool
large_ds
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
bool
large
r
_ds
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
return
(
*
(
float
*
)
maxval
>
pFilter
->
filterInfo
.
lowerBndd
);
return
FLT_GREATER
(
*
(
float
*
)
maxval
,
pFilter
->
filterInfo
.
lowerBndd
);
}
}
bool
large_dd
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
bool
large
r
_dd
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
return
(
*
(
double
*
)
maxval
>
pFilter
->
filterInfo
.
lowerBndd
);
return
(
*
(
double
*
)
maxval
>
pFilter
->
filterInfo
.
lowerBndd
);
}
}
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
...
@@ -88,10 +94,14 @@ bool lessEqual_i64(SColumnFilterElem *pFilter, char *minval, char *maxval) {
...
@@ -88,10 +94,14 @@ bool lessEqual_i64(SColumnFilterElem *pFilter, char *minval, char *maxval) {
}
}
bool
lessEqual_ds
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
bool
lessEqual_ds
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
return
(
*
(
float
*
)
minval
<=
pFilter
->
filterInfo
.
upperBndd
);
return
FLT_LESSEQUAL
(
*
(
float
*
)
minval
,
pFilter
->
filterInfo
.
upperBndd
);
}
}
bool
lessEqual_dd
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
bool
lessEqual_dd
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
if
((
fabs
(
*
(
double
*
)
minval
)
-
pFilter
->
filterInfo
.
upperBndd
)
<=
2
*
DBL_EPSILON
)
{
return
true
;
}
return
(
*
(
double
*
)
minval
<=
pFilter
->
filterInfo
.
upperBndd
);
return
(
*
(
double
*
)
minval
<=
pFilter
->
filterInfo
.
upperBndd
);
}
}
...
@@ -113,11 +123,15 @@ bool largeEqual_i64(SColumnFilterElem *pFilter, char *minval, char *maxval) {
...
@@ -113,11 +123,15 @@ bool largeEqual_i64(SColumnFilterElem *pFilter, char *minval, char *maxval) {
}
}
bool
largeEqual_ds
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
bool
largeEqual_ds
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
return
(
*
(
float
*
)
maxval
>=
pFilter
->
filterInfo
.
lowerBndd
);
return
FLT_GREATEREQUAL
(
*
(
float
*
)
maxval
,
pFilter
->
filterInfo
.
lowerBndd
);
}
}
bool
largeEqual_dd
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
bool
largeEqual_dd
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
return
(
*
(
double
*
)
maxval
>=
pFilter
->
filterInfo
.
lowerBndd
);
if
(
fabs
(
*
(
double
*
)
maxval
-
pFilter
->
filterInfo
.
lowerBndd
)
<=
2
*
DBL_EPSILON
)
{
return
true
;
}
return
(
*
(
double
*
)
maxval
-
pFilter
->
filterInfo
.
lowerBndd
>
(
2
*
DBL_EPSILON
));
}
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
...
@@ -162,10 +176,12 @@ bool equal_i64(SColumnFilterElem *pFilter, char *minval, char *maxval) {
...
@@ -162,10 +176,12 @@ bool equal_i64(SColumnFilterElem *pFilter, char *minval, char *maxval) {
}
}
}
}
// user specified input filter value and the original saved float value may needs to
// increase the tolerance to obtain the correct result.
bool
equal_ds
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
bool
equal_ds
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
if
(
*
(
float
*
)
minval
==
*
(
float
*
)
maxval
)
{
if
(
*
(
float
*
)
minval
==
*
(
float
*
)
maxval
)
{
return
(
fabs
(
*
(
float
*
)
minval
-
pFilter
->
filterInfo
.
lowerBndd
)
<=
FLT_EPSILON
);
return
FLT_EQUAL
(
*
(
float
*
)
minval
,
pFilter
->
filterInfo
.
lowerBndd
);
}
else
{
/
* range filter */
}
else
{
/
/ range filter
assert
(
*
(
float
*
)
minval
<
*
(
float
*
)
maxval
);
assert
(
*
(
float
*
)
minval
<
*
(
float
*
)
maxval
);
return
*
(
float
*
)
minval
<=
pFilter
->
filterInfo
.
lowerBndd
&&
*
(
float
*
)
maxval
>=
pFilter
->
filterInfo
.
lowerBndd
;
return
*
(
float
*
)
minval
<=
pFilter
->
filterInfo
.
lowerBndd
&&
*
(
float
*
)
maxval
>=
pFilter
->
filterInfo
.
lowerBndd
;
}
}
...
@@ -173,10 +189,9 @@ bool equal_ds(SColumnFilterElem *pFilter, char *minval, char *maxval) {
...
@@ -173,10 +189,9 @@ bool equal_ds(SColumnFilterElem *pFilter, char *minval, char *maxval) {
bool
equal_dd
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
bool
equal_dd
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
if
(
*
(
double
*
)
minval
==
*
(
double
*
)
maxval
)
{
if
(
*
(
double
*
)
minval
==
*
(
double
*
)
maxval
)
{
return
(
*
(
double
*
)
minval
==
pFilter
->
filterInfo
.
lowerBndd
);
return
(
fabs
(
*
(
double
*
)
minval
-
pFilter
->
filterInfo
.
lowerBndd
)
<=
2
*
DBL_EPSILON
);
}
else
{
/
* range filter */
}
else
{
/
/ range filter
assert
(
*
(
double
*
)
minval
<
*
(
double
*
)
maxval
);
assert
(
*
(
double
*
)
minval
<
*
(
double
*
)
maxval
);
return
*
(
double
*
)
minval
<=
pFilter
->
filterInfo
.
lowerBndi
&&
*
(
double
*
)
maxval
>=
pFilter
->
filterInfo
.
lowerBndi
;
return
*
(
double
*
)
minval
<=
pFilter
->
filterInfo
.
lowerBndi
&&
*
(
double
*
)
maxval
>=
pFilter
->
filterInfo
.
lowerBndi
;
}
}
}
}
...
@@ -255,7 +270,7 @@ bool nequal_i64(SColumnFilterElem *pFilter, char *minval, char *maxval) {
...
@@ -255,7 +270,7 @@ bool nequal_i64(SColumnFilterElem *pFilter, char *minval, char *maxval) {
bool
nequal_ds
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
bool
nequal_ds
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
if
(
*
(
float
*
)
minval
==
*
(
float
*
)
maxval
)
{
if
(
*
(
float
*
)
minval
==
*
(
float
*
)
maxval
)
{
return
(
*
(
float
*
)
minval
!=
pFilter
->
filterInfo
.
lowerBndd
);
return
!
FLT_EQUAL
(
*
(
float
*
)
minval
,
pFilter
->
filterInfo
.
lowerBndd
);
}
}
return
true
;
return
true
;
...
@@ -364,7 +379,8 @@ bool rangeFilter_i64_ei(SColumnFilterElem *pFilter, char *minval, char *maxval)
...
@@ -364,7 +379,8 @@ bool rangeFilter_i64_ei(SColumnFilterElem *pFilter, char *minval, char *maxval)
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
bool
rangeFilter_ds_ii
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
bool
rangeFilter_ds_ii
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
return
(
*
(
float
*
)
minval
<=
pFilter
->
filterInfo
.
upperBndd
&&
*
(
float
*
)
maxval
>=
pFilter
->
filterInfo
.
lowerBndd
);
return
FLT_LESSEQUAL
(
*
(
float
*
)
minval
,
pFilter
->
filterInfo
.
upperBndd
)
&&
FLT_GREATEREQUAL
(
*
(
float
*
)
maxval
,
pFilter
->
filterInfo
.
lowerBndd
);
}
}
bool
rangeFilter_ds_ee
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
bool
rangeFilter_ds_ee
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
...
@@ -376,7 +392,8 @@ bool rangeFilter_ds_ie(SColumnFilterElem *pFilter, char *minval, char *maxval) {
...
@@ -376,7 +392,8 @@ bool rangeFilter_ds_ie(SColumnFilterElem *pFilter, char *minval, char *maxval) {
}
}
bool
rangeFilter_ds_ei
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
bool
rangeFilter_ds_ei
(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
{
return
(
*
(
float
*
)
minval
<=
pFilter
->
filterInfo
.
upperBndd
&&
*
(
float
*
)
maxval
>
pFilter
->
filterInfo
.
lowerBndd
);
return
FLT_GREATER
(
*
(
float
*
)
maxval
,
pFilter
->
filterInfo
.
lowerBndd
)
&&
FLT_LESSEQUAL
(
*
(
float
*
)
minval
,
pFilter
->
filterInfo
.
upperBndd
);
}
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
...
@@ -400,7 +417,7 @@ bool rangeFilter_dd_ei(SColumnFilterElem *pFilter, char *minval, char *maxval) {
...
@@ -400,7 +417,7 @@ bool rangeFilter_dd_ei(SColumnFilterElem *pFilter, char *minval, char *maxval) {
bool
(
*
filterFunc_i8
[])(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
=
{
bool
(
*
filterFunc_i8
[])(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
=
{
NULL
,
NULL
,
less_i8
,
less_i8
,
large_i8
,
large
r
_i8
,
equal_i8
,
equal_i8
,
lessEqual_i8
,
lessEqual_i8
,
largeEqual_i8
,
largeEqual_i8
,
...
@@ -413,7 +430,7 @@ bool (*filterFunc_i8[])(SColumnFilterElem *pFilter, char *minval, char *maxval)
...
@@ -413,7 +430,7 @@ bool (*filterFunc_i8[])(SColumnFilterElem *pFilter, char *minval, char *maxval)
bool
(
*
filterFunc_i16
[])(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
=
{
bool
(
*
filterFunc_i16
[])(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
=
{
NULL
,
NULL
,
less_i16
,
less_i16
,
large_i16
,
large
r
_i16
,
equal_i16
,
equal_i16
,
lessEqual_i16
,
lessEqual_i16
,
largeEqual_i16
,
largeEqual_i16
,
...
@@ -426,7 +443,7 @@ bool (*filterFunc_i16[])(SColumnFilterElem *pFilter, char *minval, char *maxval)
...
@@ -426,7 +443,7 @@ bool (*filterFunc_i16[])(SColumnFilterElem *pFilter, char *minval, char *maxval)
bool
(
*
filterFunc_i32
[])(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
=
{
bool
(
*
filterFunc_i32
[])(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
=
{
NULL
,
NULL
,
less_i32
,
less_i32
,
large_i32
,
large
r
_i32
,
equal_i32
,
equal_i32
,
lessEqual_i32
,
lessEqual_i32
,
largeEqual_i32
,
largeEqual_i32
,
...
@@ -439,7 +456,7 @@ bool (*filterFunc_i32[])(SColumnFilterElem *pFilter, char *minval, char *maxval)
...
@@ -439,7 +456,7 @@ bool (*filterFunc_i32[])(SColumnFilterElem *pFilter, char *minval, char *maxval)
bool
(
*
filterFunc_i64
[])(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
=
{
bool
(
*
filterFunc_i64
[])(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
=
{
NULL
,
NULL
,
less_i64
,
less_i64
,
large_i64
,
large
r
_i64
,
equal_i64
,
equal_i64
,
lessEqual_i64
,
lessEqual_i64
,
largeEqual_i64
,
largeEqual_i64
,
...
@@ -452,7 +469,7 @@ bool (*filterFunc_i64[])(SColumnFilterElem *pFilter, char *minval, char *maxval)
...
@@ -452,7 +469,7 @@ bool (*filterFunc_i64[])(SColumnFilterElem *pFilter, char *minval, char *maxval)
bool
(
*
filterFunc_ds
[])(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
=
{
bool
(
*
filterFunc_ds
[])(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
=
{
NULL
,
NULL
,
less_ds
,
less_ds
,
large_ds
,
large
r
_ds
,
equal_ds
,
equal_ds
,
lessEqual_ds
,
lessEqual_ds
,
largeEqual_ds
,
largeEqual_ds
,
...
@@ -465,7 +482,7 @@ bool (*filterFunc_ds[])(SColumnFilterElem *pFilter, char *minval, char *maxval)
...
@@ -465,7 +482,7 @@ bool (*filterFunc_ds[])(SColumnFilterElem *pFilter, char *minval, char *maxval)
bool
(
*
filterFunc_dd
[])(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
=
{
bool
(
*
filterFunc_dd
[])(
SColumnFilterElem
*
pFilter
,
char
*
minval
,
char
*
maxval
)
=
{
NULL
,
NULL
,
less_dd
,
less_dd
,
large_dd
,
large
r
_dd
,
equal_dd
,
equal_dd
,
lessEqual_dd
,
lessEqual_dd
,
largeEqual_dd
,
largeEqual_dd
,
...
@@ -551,7 +568,7 @@ bool (*rangeFilterFunc_dd[])(SColumnFilterElem *pFilter, char *minval, char *max
...
@@ -551,7 +568,7 @@ bool (*rangeFilterFunc_dd[])(SColumnFilterElem *pFilter, char *minval, char *max
__filter_func_t
*
getRangeFilterFuncArray
(
int32_t
type
)
{
__filter_func_t
*
getRangeFilterFuncArray
(
int32_t
type
)
{
switch
(
type
)
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
return
rangeFilterFunc_i8
;
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_TINYINT
:
return
rangeFilterFunc_i8
;
case
TSDB_DATA_TYPE_TINYINT
:
return
rangeFilterFunc_i8
;
case
TSDB_DATA_TYPE_SMALLINT
:
return
rangeFilterFunc_i16
;
case
TSDB_DATA_TYPE_SMALLINT
:
return
rangeFilterFunc_i16
;
case
TSDB_DATA_TYPE_INT
:
return
rangeFilterFunc_i32
;
case
TSDB_DATA_TYPE_INT
:
return
rangeFilterFunc_i32
;
...
@@ -565,7 +582,7 @@ __filter_func_t* getRangeFilterFuncArray(int32_t type) {
...
@@ -565,7 +582,7 @@ __filter_func_t* getRangeFilterFuncArray(int32_t type) {
__filter_func_t
*
getValueFilterFuncArray
(
int32_t
type
)
{
__filter_func_t
*
getValueFilterFuncArray
(
int32_t
type
)
{
switch
(
type
)
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
return
filterFunc_i8
;
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_TINYINT
:
return
filterFunc_i8
;
case
TSDB_DATA_TYPE_TINYINT
:
return
filterFunc_i8
;
case
TSDB_DATA_TYPE_SMALLINT
:
return
filterFunc_i16
;
case
TSDB_DATA_TYPE_SMALLINT
:
return
filterFunc_i16
;
case
TSDB_DATA_TYPE_INT
:
return
filterFunc_i32
;
case
TSDB_DATA_TYPE_INT
:
return
filterFunc_i32
;
...
...
src/vnode/src/vnodeRead.c
浏览文件 @
3e836ec7
...
@@ -281,7 +281,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
...
@@ -281,7 +281,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
vTrace
(
"vgId:%d, QInfo:%p, dnode continues to exec query"
,
pVnode
->
vgId
,
*
qhandle
);
vTrace
(
"vgId:%d, QInfo:%p, dnode continues to exec query"
,
pVnode
->
vgId
,
*
qhandle
);
// In the retrieve blocking model, only 50% CPU will be used in query processing
// In the retrieve blocking model, only 50% CPU will be used in query processing
if
(
ts
HalfCoresForQuery
)
{
if
(
ts
RetrieveBlockingModel
)
{
qTableQuery
(
*
qhandle
);
// do execute query
qTableQuery
(
*
qhandle
);
// do execute query
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
qhandle
,
false
);
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
qhandle
,
false
);
}
else
{
}
else
{
...
@@ -380,7 +380,7 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
...
@@ -380,7 +380,7 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
freeHandle
=
true
;
freeHandle
=
true
;
}
else
{
// result is not ready, return immediately
}
else
{
// result is not ready, return immediately
// Only effects in the non-blocking model
// Only effects in the non-blocking model
if
(
!
ts
HalfCoresForQuery
)
{
if
(
!
ts
RetrieveBlockingModel
)
{
if
(
!
buildRes
)
{
if
(
!
buildRes
)
{
assert
(
pRead
->
rpcHandle
!=
NULL
);
assert
(
pRead
->
rpcHandle
!=
NULL
);
...
...
tests/script/general/parser/tags_filter.sim
浏览文件 @
3e836ec7
...
@@ -149,4 +149,57 @@ if $rows != 2 then
...
@@ -149,4 +149,57 @@ if $rows != 2 then
return -1
return -1
endi
endi
print ==================>td-2424
sql create table t1(ts timestamp, k float)
sql insert into t1 values(now, 8.001)
sql select * from t1 where k=8.001
if $rows != 1 then
return -1
endi
sql select * from t1 where k<8.001
if $rows != 0 then
return -1
endi
sql select * from t1 where k<=8.001
if $rows != 1 then
return -1
endi
sql select * from t1 where k>8.001
if $rows != 0 then
return -1
endi
sql select * from t1 where k>=8.001
if $rows != 1 then
return -1
endi
sql select * from t1 where k<>8.001
if $rows != 0 then
return -1
endi
sql select * from t1 where k>=8.001 and k<=8.001
if $rows != 1 then
return -1
endi
sql select * from t1 where k>=8.0009999 and k<=8.001
if $rows != 1 then
return -1
endi
sql select * from t1 where k>8.001 and k<=8.001
if $rows != 0 then
return -1
endi
sql select * from t1 where k>=8.001 and k<8.001
if $rows != 0 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录