Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d63f0e7f
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
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看板
提交
d63f0e7f
编写于
7月 18, 2019
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix issue #91, remove assert for illegal filtering conditions
上级
932da9d5
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
47 addition
and
12 deletion
+47
-12
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+29
-0
src/client/src/tscServer.c
src/client/src/tscServer.c
+1
-4
src/inc/tsdb.h
src/inc/tsdb.h
+1
-0
src/system/inc/vnodeUtil.h
src/system/inc/vnodeUtil.h
+1
-1
src/system/src/vnodeRead.c
src/system/src/vnodeRead.c
+1
-1
src/system/src/vnodeUtil.c
src/system/src/vnodeUtil.c
+14
-6
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
d63f0e7f
...
...
@@ -3055,6 +3055,29 @@ static int32_t setMetersIDForMetricQuery(SSqlObj* pSql, char* tmpTagCondBuf) {
return
TSDB_CODE_SUCCESS
;
}
static
bool
validateFilterExpr
(
SSqlCmd
*
pCmd
)
{
for
(
int32_t
i
=
0
;
i
<
pCmd
->
colList
.
numOfCols
;
++
i
)
{
SColumnBase
*
pColBase
=
&
pCmd
->
colList
.
pColList
[
i
];
if
(
pColBase
->
filterOn
>
0
)
{
int32_t
lowerOptr
=
pColBase
->
lowerRelOptr
;
int32_t
upperOptr
=
pColBase
->
upperRelOptr
;
if
((
lowerOptr
==
TSDB_RELATION_LARGE_EQUAL
||
lowerOptr
==
TSDB_RELATION_LARGE
)
&&
(
upperOptr
==
TSDB_RELATION_LESS_EQUAL
||
upperOptr
==
TSDB_RELATION_LESS
))
{
continue
;
}
// there must be at least two range, not support yet.
if
(
lowerOptr
*
upperOptr
!=
TSDB_RELATION_INVALID
)
{
return
false
;
}
}
}
return
true
;
}
int32_t
buildQueryCond
(
SSqlObj
*
pSql
,
tSQLExpr
*
pExpr
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
...
...
@@ -3064,6 +3087,7 @@ int32_t buildQueryCond(SSqlObj* pSql, tSQLExpr* pExpr) {
char
msg1
[]
=
"invalid expression"
;
char
msg2
[]
=
"meter is not allowed"
;
char
msg3
[]
=
"invalid filter expression"
;
tSQLExpr
*
pLeft
=
pExpr
->
pLeft
;
tSQLExpr
*
pRight
=
pExpr
->
pRight
;
...
...
@@ -3112,6 +3136,11 @@ int32_t buildQueryCond(SSqlObj* pSql, tSQLExpr* pExpr) {
pCmd
->
tagCond
.
pData
[
pCmd
->
tagCond
.
len
]
=
0
;
}
if
(
!
validateFilterExpr
(
pCmd
))
{
setErrMsg
(
pCmd
,
msg3
,
tListLen
(
msg3
));
return
TSDB_CODE_INVALID_SQL
;
}
return
ret
;
}
...
...
src/client/src/tscServer.c
浏览文件 @
d63f0e7f
...
...
@@ -869,9 +869,7 @@ void tscKillMetricQuery(SSqlObj *pSql) {
tscTrace
(
"%p metric query is cancelled"
,
pSql
);
}
static
SSqlObj
*
tscCreateSqlObjForSubquery
(
SSqlObj
*
pSql
,
SRetrieveSupport
*
trsupport
,
SSqlObj
*
prevSqlObj
)
{
static
SSqlObj
*
tscCreateSqlObjForSubquery
(
SSqlObj
*
pSql
,
SRetrieveSupport
*
trsupport
,
SSqlObj
*
prevSqlObj
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlObj
*
pNew
=
(
SSqlObj
*
)
calloc
(
1
,
sizeof
(
SSqlObj
));
...
...
@@ -916,7 +914,6 @@ static SSqlObj* tscCreateSqlObjForSubquery(SSqlObj *pSql, SRetrieveSupport *trsu
assert
(
pNew
->
cmd
.
pMeterMeta
!=
NULL
&&
pNew
->
cmd
.
pMetricMeta
!=
NULL
);
return
pNew
;
}
void
tscRetrieveDataRes
(
void
*
param
,
TAOS_RES
*
tres
,
int
retCode
)
{
...
...
src/inc/tsdb.h
浏览文件 @
d63f0e7f
...
...
@@ -74,6 +74,7 @@ enum _syncstatus {
#define TSDB_KEYSIZE sizeof(TSKEY)
#define TSDB_NCHAR_SIZE sizeof(wchar_t)
#define TSDB_RELATION_INVALID 0
#define TSDB_RELATION_LESS 1
#define TSDB_RELATION_LARGE 2
#define TSDB_RELATION_EQUAL 3
...
...
src/system/inc/vnodeUtil.h
浏览文件 @
d63f0e7f
...
...
@@ -63,7 +63,7 @@ void vnodeFreeFields(SQuery *pQuery);
void
vnodeUpdateFilterColumnIndex
(
SQuery
*
pQuery
);
void
vnodeUpdateQueryColumnIndex
(
SQuery
*
pQuery
,
SMeterObj
*
pMeterObj
);
int32_t
vnodeCreateFilterInfo
(
SQuery
*
pQuery
);
int32_t
vnodeCreateFilterInfo
(
void
*
pQInfo
,
SQuery
*
pQuery
);
bool
vnodeFilterData
(
SQuery
*
pQuery
,
int32_t
*
numOfActualRead
,
int32_t
index
);
bool
vnodeDoFilterData
(
SQuery
*
pQuery
,
int32_t
elemPos
);
...
...
src/system/src/vnodeRead.c
浏览文件 @
d63f0e7f
...
...
@@ -216,7 +216,7 @@ static SQInfo *vnodeAllocateQInfoCommon(SQueryMeterMsg *pQueryMsg, SMeterObj *pM
pQuery
->
pSelectExpr
=
pExprs
;
int32_t
ret
=
vnodeCreateFilterInfo
(
pQuery
);
int32_t
ret
=
vnodeCreateFilterInfo
(
pQ
Info
,
pQ
uery
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
goto
_clean_memory
;
}
...
...
src/system/src/vnodeUtil.c
浏览文件 @
d63f0e7f
...
...
@@ -246,7 +246,11 @@ SSqlFunctionExpr* vnodeCreateSqlFunctionExpr(SQueryMeterMsg* pQueryMsg, int32_t*
// tag column schema is kept in pQueryMsg->pTagSchema
if
(
pColumnIndexExInfo
->
isTag
)
{
assert
(
pColumnIndexExInfo
->
colIdx
<
pQueryMsg
->
numOfTagsCols
);
if
(
pColumnIndexExInfo
->
colIdx
>=
pQueryMsg
->
numOfTagsCols
)
{
*
code
=
TSDB_CODE_INVALID_QUERY_MSG
;
tfree
(
pExprs
);
break
;
}
type
=
pTagSchema
[
pColumnIndexExInfo
->
colIdx
].
type
;
bytes
=
pTagSchema
[
pColumnIndexExInfo
->
colIdx
].
bytes
;
...
...
@@ -356,7 +360,7 @@ void vnodeUpdateFilterColumnIndex(SQuery* pQuery) {
}
// TODO support k<12 and k<>9
int32_t
vnodeCreateFilterInfo
(
SQuery
*
pQuery
)
{
int32_t
vnodeCreateFilterInfo
(
void
*
pQInfo
,
SQuery
*
pQuery
)
{
for
(
int32_t
i
=
0
;
i
<
pQuery
->
numOfCols
;
++
i
)
{
if
(
pQuery
->
colList
[
i
].
data
.
filterOn
>
0
)
{
pQuery
->
numOfFilterCols
++
;
...
...
@@ -384,8 +388,8 @@ int32_t vnodeCreateFilterInfo(SQuery* pQuery) {
__filter_func_t
*
filterArray
=
vnodeGetValueFilterFuncArray
(
type
);
if
(
rangeFilterArray
==
NULL
&&
filterArray
==
NULL
)
{
dError
(
"QInfo:%p failed to get filter function, invalid data type:%d"
,
type
);
return
TSDB_CODE_
APP_ERROR
;
dError
(
"QInfo:%p failed to get filter function, invalid data type:%d"
,
pQInfo
,
type
);
return
TSDB_CODE_
INVALID_QUERY_MSG
;
}
if
((
lower
==
TSDB_RELATION_LARGE_EQUAL
||
lower
==
TSDB_RELATION_LARGE
)
&&
...
...
@@ -406,9 +410,13 @@ int32_t vnodeCreateFilterInfo(SQuery* pQuery) {
}
}
}
else
{
// set callback filter function
if
(
lower
!=
0
)
{
if
(
lower
!=
TSDB_RELATION_INVALID
)
{
pFilterInfo
->
fp
=
filterArray
[
lower
];
assert
(
upper
==
0
);
if
(
upper
!=
TSDB_RELATION_INVALID
)
{
dError
(
"pQInfo:%p failed to get filter function, invalid filter condition"
,
pQInfo
,
type
);
return
TSDB_CODE_INVALID_QUERY_MSG
;
}
}
else
{
pFilterInfo
->
fp
=
filterArray
[
upper
];
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录