Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
24eda742
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
24eda742
编写于
8月 11, 2021
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-5918] add the configuration of max length wild cards
上级
1ab504f9
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
39 addition
and
17 deletion
+39
-17
packaging/cfg/taos.cfg
packaging/cfg/taos.cfg
+3
-0
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+10
-6
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+1
-0
src/common/src/tglobal.c
src/common/src/tglobal.c
+13
-0
src/util/inc/tcompare.h
src/util/inc/tcompare.h
+1
-1
src/util/src/tcompare.c
src/util/src/tcompare.c
+10
-9
tests/pytest/functions/showOfflineThresholdIs864000.py
tests/pytest/functions/showOfflineThresholdIs864000.py
+1
-1
未找到文件。
packaging/cfg/taos.cfg
浏览文件 @
24eda742
...
...
@@ -144,6 +144,9 @@ keepColumnName 1
# max length of an SQL
# maxSQLLength 65480
# max length of WildCards
# maxWildCardsLength 100
# the maximum number of records allowed for super table time sorting
# maxNumOfOrderedRes 100000
...
...
src/client/src/tscSQLParser.c
浏览文件 @
24eda742
...
...
@@ -3218,7 +3218,7 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
pCmd
->
command
=
TSDB_SQL_SHOW
;
const
char
*
msg1
=
"invalid name"
;
const
char
*
msg2
=
"
pattern filter string too long
"
;
const
char
*
msg2
=
"
wildcard string should be less than %d characters
"
;
const
char
*
msg3
=
"database name too long"
;
const
char
*
msg4
=
"invalid ip address"
;
const
char
*
msg5
=
"database name is empty"
;
...
...
@@ -3262,8 +3262,10 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg6
);
}
if
(
!
tscValidateTableNameLength
(
pCmd
->
payloadLen
))
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
if
(
pPattern
->
n
>
tsMaxWildCardsLen
){
char
tmp
[
64
]
=
{
0
};
sprintf
(
tmp
,
msg2
,
tsMaxWildCardsLen
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
tmp
);
}
}
}
else
if
(
showType
==
TSDB_MGMT_TABLE_VNODES
)
{
...
...
@@ -4394,15 +4396,17 @@ static int32_t validateNullExpr(tSqlExpr* pExpr, char* msgBuf) {
// check for like expression
static
int32_t
validateLikeExpr
(
tSqlExpr
*
pExpr
,
STableMeta
*
pTableMeta
,
int32_t
index
,
char
*
msgBuf
)
{
const
char
*
msg1
=
"wildcard string should be less than
20
characters"
;
const
char
*
msg1
=
"wildcard string should be less than
%d
characters"
;
const
char
*
msg2
=
"illegal column name"
;
tSqlExpr
*
pLeft
=
pExpr
->
pLeft
;
tSqlExpr
*
pRight
=
pExpr
->
pRight
;
if
(
pExpr
->
tokenId
==
TK_LIKE
)
{
if
(
pRight
->
value
.
nLen
>
TSDB_PATTERN_STRING_MAX_LEN
)
{
return
invalidOperationMsg
(
msgBuf
,
msg1
);
if
(
pRight
->
value
.
nLen
>
tsMaxWildCardsLen
)
{
char
tmp
[
64
]
=
{
0
};
sprintf
(
tmp
,
msg1
,
tsMaxWildCardsLen
);
return
invalidOperationMsg
(
msgBuf
,
tmp
);
}
SSchema
*
pSchema
=
tscGetTableSchema
(
pTableMeta
);
...
...
src/common/inc/tglobal.h
浏览文件 @
24eda742
...
...
@@ -70,6 +70,7 @@ extern int8_t tsKeepOriginalColumnName;
// client
extern
int32_t
tsMaxSQLStringLen
;
extern
int32_t
tsMaxWildCardsLen
;
extern
int8_t
tsTscEnableRecordSql
;
extern
int32_t
tsMaxNumOfOrderedResults
;
extern
int32_t
tsMinSlidingTime
;
...
...
src/common/src/tglobal.c
浏览文件 @
24eda742
...
...
@@ -25,6 +25,7 @@
#include "tutil.h"
#include "tlocale.h"
#include "ttimezone.h"
#include "tcompare.h"
// cluster
char
tsFirst
[
TSDB_EP_LEN
]
=
{
0
};
...
...
@@ -75,6 +76,7 @@ int32_t tsCompressMsgSize = -1;
// client
int32_t
tsMaxSQLStringLen
=
TSDB_MAX_ALLOWED_SQL_LEN
;
int32_t
tsMaxWildCardsLen
=
TSDB_PATTERN_STRING_MAX_LEN
;
int8_t
tsTscEnableRecordSql
=
0
;
// the maximum number of results for projection query on super table that are returned from
...
...
@@ -984,6 +986,16 @@ static void doInitGlobalConfig(void) {
cfg
.
unitType
=
TAOS_CFG_UTYPE_BYTE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"maxWildCardsLength"
;
cfg
.
ptr
=
&
tsMaxWildCardsLen
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_CLIENT
|
TSDB_CFG_CTYPE_B_SHOW
;
cfg
.
minValue
=
0
;
cfg
.
maxValue
=
TSDB_MAX_FIELD_LEN
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_BYTE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"maxNumOfOrderedRes"
;
cfg
.
ptr
=
&
tsMaxNumOfOrderedResults
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
...
...
@@ -1531,6 +1543,7 @@ static void doInitGlobalConfig(void) {
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
assert
(
tsGlobalConfigNum
<=
TSDB_CFG_MAX_NUM
);
#ifdef TD_TSZ
// lossy compress
cfg
.
option
=
"lossyColumns"
;
...
...
src/util/inc/tcompare.h
浏览文件 @
24eda742
...
...
@@ -25,7 +25,7 @@ extern "C" {
#define TSDB_PATTERN_MATCH 0
#define TSDB_PATTERN_NOMATCH 1
#define TSDB_PATTERN_NOWILDCARDMATCH 2
#define TSDB_PATTERN_STRING_MAX_LEN
2
0
#define TSDB_PATTERN_STRING_MAX_LEN
10
0
#define FLT_COMPAR_TOL_FACTOR 4
#define FLT_EQUAL(_x, _y) (fabs((_x) - (_y)) <= (FLT_COMPAR_TOL_FACTOR * FLT_EPSILON))
...
...
src/util/src/tcompare.c
浏览文件 @
24eda742
...
...
@@ -264,18 +264,19 @@ int WCSPatternMatch(const wchar_t *patterStr, const wchar_t *str, size_t size, c
static
int32_t
compareStrPatternComp
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
SPatternCompareInfo
pInfo
=
{
'%'
,
'_'
};
char
pattern
[
128
]
=
{
0
};
assert
(
varDataLen
(
pRight
)
<=
TSDB_MAX_FIELD_LEN
);
char
*
pattern
=
calloc
(
varDataLen
(
pRight
)
+
1
,
sizeof
(
char
));
memcpy
(
pattern
,
varDataVal
(
pRight
),
varDataLen
(
pRight
));
assert
(
varDataLen
(
pRight
)
<
128
);
size_t
sz
=
varDataLen
(
pLeft
);
char
*
buf
=
malloc
(
sz
+
1
);
memcpy
(
buf
,
varDataVal
(
pLeft
),
sz
);
char
*
buf
=
malloc
(
sz
+
1
);
memcpy
(
buf
,
varDataVal
(
pLeft
),
sz
);
buf
[
sz
]
=
0
;
int32_t
ret
=
patternMatch
(
pattern
,
buf
,
sz
,
&
pInfo
);
free
(
buf
);
free
(
pattern
);
return
(
ret
==
TSDB_PATTERN_MATCH
)
?
0
:
1
;
}
...
...
@@ -297,13 +298,13 @@ static int32_t compareFindItemInSet(const void *pLeft, const void* pRight) {
static
int32_t
compareWStrPatternComp
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
SPatternCompareInfo
pInfo
=
{
'%'
,
'_'
};
wchar_t
pattern
[
128
]
=
{
0
}
;
assert
(
TSDB_PATTERN_STRING_MAX_LEN
<
128
);
assert
(
varDataLen
(
pRight
)
<=
TSDB_MAX_FIELD_LEN
*
TSDB_NCHAR_SIZE
)
;
wchar_t
*
pattern
=
calloc
(
varDataLen
(
pRight
)
+
1
,
sizeof
(
wchar_t
)
);
memcpy
(
pattern
,
varDataVal
(
pRight
),
varDataLen
(
pRight
));
assert
(
varDataLen
(
pRight
)
<
128
);
int32_t
ret
=
WCSPatternMatch
(
pattern
,
varDataVal
(
pLeft
),
varDataLen
(
pLeft
)
/
TSDB_NCHAR_SIZE
,
&
pInfo
);
free
(
pattern
);
return
(
ret
==
TSDB_PATTERN_MATCH
)
?
0
:
1
;
}
...
...
tests/pytest/functions/showOfflineThresholdIs864000.py
浏览文件 @
24eda742
...
...
@@ -25,7 +25,7 @@ class TDTestCase:
def
run
(
self
):
tdSql
.
query
(
"show variables"
)
tdSql
.
checkData
(
5
3
,
1
,
864000
)
tdSql
.
checkData
(
5
4
,
1
,
864000
)
def
stop
(
self
):
tdSql
.
close
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录