Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
5501982f
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5501982f
编写于
3月 07, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-2895] refactor.
上级
e313cf3b
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
410 addition
and
603 deletion
+410
-603
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+135
-246
src/query/inc/qSqlparser.h
src/query/inc/qSqlparser.h
+20
-17
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+71
-165
src/query/src/qParserImpl.c
src/query/src/qParserImpl.c
+55
-46
src/query/src/qTokenizer.c
src/query/src/qTokenizer.c
+43
-43
tests/script/general/parser/testSuite.sim
tests/script/general/parser/testSuite.sim
+86
-86
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
5501982f
此差异已折叠。
点击以展开。
src/query/inc/qSqlparser.h
浏览文件 @
5501982f
...
...
@@ -181,19 +181,32 @@ typedef struct SSqlInfo {
};
}
SSqlInfo
;
#define NON_ARITHMEIC_EXPR 0
#define NORMAL_ARITHMETIC 1
#define AGG_ARIGHTMEIC 2
enum
SQL_NODE_TYPE
{
SQL_NODE_TABLE_COLUMN
=
1
,
SQL_NODE_SQLFUNCTION
=
2
,
SQL_NODE_VALUE
=
3
,
SQL_NODE_EXPR
=
4
,
};
typedef
struct
tSQLExpr
{
uint
32_t
nSQLOptr
;
// TK_FUNCTION: sql function, TK_LE: less than(binary expr)
// the full sql string of function(col, param), which is actually the raw
//
field name, since the function name is kept in nSQLOptr already
uint
16_t
type
;
// sql node type
uint32_t
tokenId
;
// TK_FUNCTION: sql function, TK_LE: less than(binary expr)
//
the whole string of the function(col, param), while the function name is kept in token
SStrToken
operand
;
SStrToken
colInfo
;
// field id
tVariant
val
;
// value only for string, float, int
uint32_t
functionId
;
// function id
SStrToken
colInfo
;
// table column info
tVariant
value
;
// the use input value
SStrToken
token
;
// original sql expr string
struct
tSQLExpr
*
pLeft
;
// left child
struct
tSQLExpr
*
pRight
;
// right child
struct
tSQLExprList
*
pParam
;
// function parameters
struct
tSQLExprList
*
pParam
;
// function parameters
list
}
tSQLExpr
;
// used in select clause. select <tSQLExprList> from xxx
...
...
@@ -287,16 +300,6 @@ void tSqlSetColumnType(TAOS_FIELD *pField, SStrToken *type);
void
*
ParseAlloc
(
void
*
(
*
mallocProc
)(
size_t
));
enum
{
TSQL_NODE_TYPE_EXPR
=
0x1
,
TSQL_NODE_TYPE_ID
=
0x2
,
TSQL_NODE_TYPE_VALUE
=
0x4
,
};
#define NON_ARITHMEIC_EXPR 0
#define NORMAL_ARITHMETIC 1
#define AGG_ARIGHTMEIC 2
SSqlInfo
qSQLParse
(
const
char
*
str
);
#ifdef __cplusplus
...
...
src/query/src/qExecutor.c
浏览文件 @
5501982f
此差异已折叠。
点击以展开。
src/query/src/qParserImpl.c
浏览文件 @
5501982f
...
...
@@ -126,28 +126,33 @@ tSQLExpr *tSqlExprIdValueCreate(SStrToken *pToken, int32_t optrType) {
if
(
optrType
==
TK_INTEGER
||
optrType
==
TK_STRING
||
optrType
==
TK_FLOAT
||
optrType
==
TK_BOOL
)
{
toTSDBType
(
pToken
->
type
);
tVariantCreate
(
&
pSqlExpr
->
val
,
pToken
);
pSqlExpr
->
nSQLOptr
=
optrType
;
tVariantCreate
(
&
pSqlExpr
->
value
,
pToken
);
pSqlExpr
->
tokenId
=
optrType
;
pSqlExpr
->
type
=
SQL_NODE_VALUE
;
}
else
if
(
optrType
==
TK_NOW
)
{
// use microsecond by default
pSqlExpr
->
val
.
i64
=
taosGetTimestamp
(
TSDB_TIME_PRECISION_MICRO
);
pSqlExpr
->
val
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
pSqlExpr
->
nSQLOptr
=
TK_TIMESTAMP
;
// TK_TIMESTAMP used to denote the time value is in microsecond
pSqlExpr
->
value
.
i64
=
taosGetTimestamp
(
TSDB_TIME_PRECISION_MICRO
);
pSqlExpr
->
value
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
pSqlExpr
->
tokenId
=
TK_TIMESTAMP
;
// TK_TIMESTAMP used to denote the time value is in microsecond
pSqlExpr
->
type
=
SQL_NODE_VALUE
;
}
else
if
(
optrType
==
TK_VARIABLE
)
{
int32_t
ret
=
parseAbsoluteDuration
(
pToken
->
z
,
pToken
->
n
,
&
pSqlExpr
->
val
.
i64
);
int32_t
ret
=
parseAbsoluteDuration
(
pToken
->
z
,
pToken
->
n
,
&
pSqlExpr
->
val
ue
.
i64
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
terrno
=
TSDB_CODE_TSC_SQL_SYNTAX_ERROR
;
}
pSqlExpr
->
val
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
pSqlExpr
->
nSQLOptr
=
TK_TIMESTAMP
;
}
else
{
// it must be the column name (tk_id) if it is not the number
pSqlExpr
->
value
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
pSqlExpr
->
tokenId
=
TK_TIMESTAMP
;
pSqlExpr
->
type
=
SQL_NODE_VALUE
;
}
else
{
// Here it must be the column name (tk_id) if it is not a number or string.
assert
(
optrType
==
TK_ID
||
optrType
==
TK_ALL
);
if
(
pToken
!=
NULL
)
{
pSqlExpr
->
colInfo
=
*
pToken
;
}
pSqlExpr
->
nSQLOptr
=
optrType
;
pSqlExpr
->
tokenId
=
optrType
;
pSqlExpr
->
type
=
SQL_NODE_TABLE_COLUMN
;
}
return
pSqlExpr
;
...
...
@@ -162,18 +167,18 @@ tSQLExpr *tSqlExprCreateFunction(tSQLExprList *pList, SStrToken *pFuncToken, SSt
return
NULL
;
}
assert
(
optType
==
TK_ID
);
tSQLExpr
*
pExpr
=
calloc
(
1
,
sizeof
(
tSQLExpr
));
pExpr
->
nSQLOptr
=
TK_FUNCTION
;
pExpr
->
pParam
=
pList
;
pExpr
->
tokenId
=
optType
;
pExpr
->
type
=
SQL_NODE_SQLFUNCTION
;
pExpr
->
pParam
=
pList
;
int32_t
len
=
(
int32_t
)((
endToken
->
z
+
endToken
->
n
)
-
pFuncToken
->
z
);
pExpr
->
operand
.
z
=
pFuncToken
->
z
;
pExpr
->
operand
.
n
=
len
;
// raw field name
pExpr
->
operand
.
type
=
pFuncToken
->
type
;
pExpr
->
operand
=
(
*
pFuncToken
);
pExpr
->
token
.
n
=
len
;
pExpr
->
token
.
z
=
pFuncToken
->
z
;
pExpr
->
token
.
type
=
pFuncToken
->
type
;
pExpr
->
token
=
(
*
pFuncToken
);
return
pExpr
;
}
...
...
@@ -184,6 +189,7 @@ tSQLExpr *tSqlExprCreateFunction(tSQLExprList *pList, SStrToken *pFuncToken, SSt
tSQLExpr
*
tSqlExprCreate
(
tSQLExpr
*
pLeft
,
tSQLExpr
*
pRight
,
int32_t
optrType
)
{
tSQLExpr
*
pExpr
=
calloc
(
1
,
sizeof
(
tSQLExpr
));
pExpr
->
type
=
SQL_NODE_EXPR
;
if
(
pLeft
!=
NULL
&&
pRight
!=
NULL
&&
(
optrType
!=
TK_IN
))
{
char
*
endPos
=
pRight
->
token
.
z
+
pRight
->
token
.
n
;
pExpr
->
token
.
z
=
pLeft
->
token
.
z
;
...
...
@@ -197,32 +203,33 @@ tSQLExpr *tSqlExprCreate(tSQLExpr *pLeft, tSQLExpr *pRight, int32_t optrType) {
* if a token is noted as the TK_TIMESTAMP, the time precision is microsecond
* Otherwise, the time precision is adaptive, determined by the time precision from databases.
*/
if
((
pLeft
->
nSQLOptr
==
TK_INTEGER
&&
pRight
->
nSQLOptr
==
TK_INTEGER
)
||
(
pLeft
->
nSQLOptr
==
TK_TIMESTAMP
&&
pRight
->
nSQLOptr
==
TK_TIMESTAMP
))
{
pExpr
->
val
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
pExpr
->
nSQLOptr
=
pLeft
->
nSQLOptr
;
if
((
pLeft
->
tokenId
==
TK_INTEGER
&&
pRight
->
tokenId
==
TK_INTEGER
)
||
(
pLeft
->
tokenId
==
TK_TIMESTAMP
&&
pRight
->
tokenId
==
TK_TIMESTAMP
))
{
pExpr
->
value
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
pExpr
->
tokenId
=
pLeft
->
tokenId
;
pExpr
->
type
=
SQL_NODE_VALUE
;
switch
(
optrType
)
{
case
TK_PLUS
:
{
pExpr
->
val
.
i64
=
pLeft
->
val
.
i64
+
pRight
->
val
.
i64
;
pExpr
->
val
ue
.
i64
=
pLeft
->
value
.
i64
+
pRight
->
value
.
i64
;
break
;
}
case
TK_MINUS
:
{
pExpr
->
val
.
i64
=
pLeft
->
val
.
i64
-
pRight
->
val
.
i64
;
pExpr
->
val
ue
.
i64
=
pLeft
->
value
.
i64
-
pRight
->
value
.
i64
;
break
;
}
case
TK_STAR
:
{
pExpr
->
val
.
i64
=
pLeft
->
val
.
i64
*
pRight
->
val
.
i64
;
pExpr
->
val
ue
.
i64
=
pLeft
->
value
.
i64
*
pRight
->
value
.
i64
;
break
;
}
case
TK_DIVIDE
:
{
pExpr
->
nSQLOptr
=
TK_FLOAT
;
pExpr
->
val
.
nType
=
TSDB_DATA_TYPE_DOUBLE
;
pExpr
->
val
.
dKey
=
(
double
)
pLeft
->
val
.
i64
/
pRight
->
val
.
i64
;
pExpr
->
tokenId
=
TK_FLOAT
;
pExpr
->
val
ue
.
nType
=
TSDB_DATA_TYPE_DOUBLE
;
pExpr
->
val
ue
.
dKey
=
(
double
)
pLeft
->
value
.
i64
/
pRight
->
value
.
i64
;
break
;
}
case
TK_REM
:
{
pExpr
->
val
.
i64
=
pLeft
->
val
.
i64
%
pRight
->
val
.
i64
;
pExpr
->
val
ue
.
i64
=
pLeft
->
value
.
i64
%
pRight
->
value
.
i64
;
break
;
}
}
...
...
@@ -230,33 +237,35 @@ tSQLExpr *tSqlExprCreate(tSQLExpr *pLeft, tSQLExpr *pRight, int32_t optrType) {
tSqlExprDestroy
(
pLeft
);
tSqlExprDestroy
(
pRight
);
}
else
if
((
pLeft
->
nSQLOptr
==
TK_FLOAT
&&
pRight
->
nSQLOptr
==
TK_INTEGER
)
||
(
pLeft
->
nSQLOptr
==
TK_INTEGER
&&
pRight
->
nSQLOptr
==
TK_FLOAT
)
||
(
pLeft
->
nSQLOptr
==
TK_FLOAT
&&
pRight
->
nSQLOptr
==
TK_FLOAT
))
{
pExpr
->
val
.
nType
=
TSDB_DATA_TYPE_DOUBLE
;
pExpr
->
nSQLOptr
=
TK_FLOAT
;
}
else
if
((
pLeft
->
tokenId
==
TK_FLOAT
&&
pRight
->
tokenId
==
TK_INTEGER
)
||
(
pLeft
->
tokenId
==
TK_INTEGER
&&
pRight
->
tokenId
==
TK_FLOAT
)
||
(
pLeft
->
tokenId
==
TK_FLOAT
&&
pRight
->
tokenId
==
TK_FLOAT
))
{
pExpr
->
value
.
nType
=
TSDB_DATA_TYPE_DOUBLE
;
pExpr
->
tokenId
=
TK_FLOAT
;
pExpr
->
type
=
SQL_NODE_VALUE
;
double
left
=
(
pLeft
->
val
.
nType
==
TSDB_DATA_TYPE_DOUBLE
)
?
pLeft
->
val
.
dKey
:
pLeft
->
val
.
i64
;
double
right
=
(
pRight
->
val
.
nType
==
TSDB_DATA_TYPE_DOUBLE
)
?
pRight
->
val
.
dKey
:
pRight
->
val
.
i64
;
double
left
=
(
pLeft
->
val
ue
.
nType
==
TSDB_DATA_TYPE_DOUBLE
)
?
pLeft
->
value
.
dKey
:
pLeft
->
value
.
i64
;
double
right
=
(
pRight
->
val
ue
.
nType
==
TSDB_DATA_TYPE_DOUBLE
)
?
pRight
->
value
.
dKey
:
pRight
->
value
.
i64
;
switch
(
optrType
)
{
case
TK_PLUS
:
{
pExpr
->
val
.
dKey
=
left
+
right
;
pExpr
->
val
ue
.
dKey
=
left
+
right
;
break
;
}
case
TK_MINUS
:
{
pExpr
->
val
.
dKey
=
left
-
right
;
pExpr
->
val
ue
.
dKey
=
left
-
right
;
break
;
}
case
TK_STAR
:
{
pExpr
->
val
.
dKey
=
left
*
right
;
pExpr
->
val
ue
.
dKey
=
left
*
right
;
break
;
}
case
TK_DIVIDE
:
{
pExpr
->
val
.
dKey
=
left
/
right
;
pExpr
->
val
ue
.
dKey
=
left
/
right
;
break
;
}
case
TK_REM
:
{
pExpr
->
val
.
dKey
=
left
-
((
int64_t
)(
left
/
right
))
*
right
;
pExpr
->
val
ue
.
dKey
=
left
-
((
int64_t
)(
left
/
right
))
*
right
;
break
;
}
}
...
...
@@ -265,21 +274,21 @@ tSQLExpr *tSqlExprCreate(tSQLExpr *pLeft, tSQLExpr *pRight, int32_t optrType) {
tSqlExprDestroy
(
pRight
);
}
else
{
pExpr
->
nSQLOptr
=
optrType
;
pExpr
->
tokenId
=
optrType
;
pExpr
->
pLeft
=
pLeft
;
pExpr
->
pRight
=
pRight
;
}
}
else
if
(
optrType
==
TK_IN
)
{
pExpr
->
nSQLOptr
=
optrType
;
pExpr
->
tokenId
=
optrType
;
pExpr
->
pLeft
=
pLeft
;
tSQLExpr
*
pRSub
=
calloc
(
1
,
sizeof
(
tSQLExpr
));
pRSub
->
nSQLOptr
=
TK_SET
;
// TODO refactor .....
pRSub
->
tokenId
=
TK_SET
;
// TODO refactor .....
pRSub
->
pParam
=
(
tSQLExprList
*
)
pRight
;
pExpr
->
pRight
=
pRSub
;
}
else
{
pExpr
->
nSQLOptr
=
optrType
;
pExpr
->
tokenId
=
optrType
;
pExpr
->
pLeft
=
pLeft
;
if
(
pLeft
!=
NULL
&&
pRight
==
NULL
)
{
...
...
@@ -297,8 +306,8 @@ void tSqlExprNodeDestroy(tSQLExpr *pExpr) {
return
;
}
if
(
pExpr
->
nSQLOptr
==
TK_STRING
)
{
tVariantDestroy
(
&
pExpr
->
val
);
if
(
pExpr
->
tokenId
==
TK_STRING
)
{
tVariantDestroy
(
&
pExpr
->
val
ue
);
}
tSqlExprListDestroy
(
pExpr
->
pParam
);
...
...
src/query/src/qTokenizer.c
浏览文件 @
5501982f
...
...
@@ -268,7 +268,7 @@ int tSQLKeywordCode(const char* z, int n) {
* Return the length of the token that begins at z[0].
* Store the token type in *type before returning.
*/
uint32_t
tSQLGetToken
(
char
*
z
,
uint32_t
*
token
Type
)
{
uint32_t
tSQLGetToken
(
char
*
z
,
uint32_t
*
token
Id
)
{
uint32_t
i
;
switch
(
*
z
)
{
case
' '
:
...
...
@@ -278,121 +278,121 @@ uint32_t tSQLGetToken(char* z, uint32_t* tokenType) {
case
'\r'
:
{
for
(
i
=
1
;
isspace
(
z
[
i
]);
i
++
)
{
}
*
token
Type
=
TK_SPACE
;
*
token
Id
=
TK_SPACE
;
return
i
;
}
case
':'
:
{
*
token
Type
=
TK_COLON
;
*
token
Id
=
TK_COLON
;
return
1
;
}
case
'-'
:
{
if
(
z
[
1
]
==
'-'
)
{
for
(
i
=
2
;
z
[
i
]
&&
z
[
i
]
!=
'\n'
;
i
++
)
{
}
*
token
Type
=
TK_COMMENT
;
*
token
Id
=
TK_COMMENT
;
return
i
;
}
*
token
Type
=
TK_MINUS
;
*
token
Id
=
TK_MINUS
;
return
1
;
}
case
'('
:
{
*
token
Type
=
TK_LP
;
*
token
Id
=
TK_LP
;
return
1
;
}
case
')'
:
{
*
token
Type
=
TK_RP
;
*
token
Id
=
TK_RP
;
return
1
;
}
case
';'
:
{
*
token
Type
=
TK_SEMI
;
*
token
Id
=
TK_SEMI
;
return
1
;
}
case
'+'
:
{
*
token
Type
=
TK_PLUS
;
*
token
Id
=
TK_PLUS
;
return
1
;
}
case
'*'
:
{
*
token
Type
=
TK_STAR
;
*
token
Id
=
TK_STAR
;
return
1
;
}
case
'/'
:
{
if
(
z
[
1
]
!=
'*'
||
z
[
2
]
==
0
)
{
*
token
Type
=
TK_SLASH
;
*
token
Id
=
TK_SLASH
;
return
1
;
}
for
(
i
=
3
;
z
[
i
]
&&
(
z
[
i
]
!=
'/'
||
z
[
i
-
1
]
!=
'*'
);
i
++
)
{
}
if
(
z
[
i
])
i
++
;
*
token
Type
=
TK_COMMENT
;
*
token
Id
=
TK_COMMENT
;
return
i
;
}
case
'%'
:
{
*
token
Type
=
TK_REM
;
*
token
Id
=
TK_REM
;
return
1
;
}
case
'='
:
{
*
token
Type
=
TK_EQ
;
*
token
Id
=
TK_EQ
;
return
1
+
(
z
[
1
]
==
'='
);
}
case
'<'
:
{
if
(
z
[
1
]
==
'='
)
{
*
token
Type
=
TK_LE
;
*
token
Id
=
TK_LE
;
return
2
;
}
else
if
(
z
[
1
]
==
'>'
)
{
*
token
Type
=
TK_NE
;
*
token
Id
=
TK_NE
;
return
2
;
}
else
if
(
z
[
1
]
==
'<'
)
{
*
token
Type
=
TK_LSHIFT
;
*
token
Id
=
TK_LSHIFT
;
return
2
;
}
else
{
*
token
Type
=
TK_LT
;
*
token
Id
=
TK_LT
;
return
1
;
}
}
case
'>'
:
{
if
(
z
[
1
]
==
'='
)
{
*
token
Type
=
TK_GE
;
*
token
Id
=
TK_GE
;
return
2
;
}
else
if
(
z
[
1
]
==
'>'
)
{
*
token
Type
=
TK_RSHIFT
;
*
token
Id
=
TK_RSHIFT
;
return
2
;
}
else
{
*
token
Type
=
TK_GT
;
*
token
Id
=
TK_GT
;
return
1
;
}
}
case
'!'
:
{
if
(
z
[
1
]
!=
'='
)
{
*
token
Type
=
TK_ILLEGAL
;
*
token
Id
=
TK_ILLEGAL
;
return
2
;
}
else
{
*
token
Type
=
TK_NE
;
*
token
Id
=
TK_NE
;
return
2
;
}
}
case
'|'
:
{
if
(
z
[
1
]
!=
'|'
)
{
*
token
Type
=
TK_BITOR
;
*
token
Id
=
TK_BITOR
;
return
1
;
}
else
{
*
token
Type
=
TK_CONCAT
;
*
token
Id
=
TK_CONCAT
;
return
2
;
}
}
case
','
:
{
*
token
Type
=
TK_COMMA
;
*
token
Id
=
TK_COMMA
;
return
1
;
}
case
'&'
:
{
*
token
Type
=
TK_BITAND
;
*
token
Id
=
TK_BITAND
;
return
1
;
}
case
'~'
:
{
*
token
Type
=
TK_BITNOT
;
*
token
Id
=
TK_BITNOT
;
return
1
;
}
case
'?'
:
{
*
token
Type
=
TK_QUESTION
;
*
token
Id
=
TK_QUESTION
;
return
1
;
}
case
'\''
:
...
...
@@ -418,7 +418,7 @@ uint32_t tSQLGetToken(char* z, uint32_t* tokenType) {
if
(
z
[
i
])
i
++
;
if
(
strEnd
)
{
*
token
Type
=
TK_STRING
;
*
token
Id
=
TK_STRING
;
return
i
;
}
...
...
@@ -442,10 +442,10 @@ uint32_t tSQLGetToken(char* z, uint32_t* tokenType) {
}
}
*
token
Type
=
TK_FLOAT
;
*
token
Id
=
TK_FLOAT
;
return
i
;
}
else
{
*
token
Type
=
TK_DOT
;
*
token
Id
=
TK_DOT
;
return
1
;
}
}
...
...
@@ -454,7 +454,7 @@ uint32_t tSQLGetToken(char* z, uint32_t* tokenType) {
char
next
=
z
[
1
];
if
(
next
==
'b'
)
{
// bin number
*
token
Type
=
TK_BIN
;
*
token
Id
=
TK_BIN
;
for
(
i
=
2
;
(
z
[
i
]
==
'0'
||
z
[
i
]
==
'1'
);
++
i
)
{
}
...
...
@@ -464,7 +464,7 @@ uint32_t tSQLGetToken(char* z, uint32_t* tokenType) {
return
i
;
}
else
if
(
next
==
'x'
)
{
//hex number
*
token
Type
=
TK_HEX
;
*
token
Id
=
TK_HEX
;
for
(
i
=
2
;
isdigit
(
z
[
i
])
||
(
z
[
i
]
>=
'a'
&&
z
[
i
]
<=
'f'
)
||
(
z
[
i
]
>=
'A'
&&
z
[
i
]
<=
'F'
);
++
i
)
{
}
...
...
@@ -484,7 +484,7 @@ uint32_t tSQLGetToken(char* z, uint32_t* tokenType) {
case
'7'
:
case
'8'
:
case
'9'
:
{
*
token
Type
=
TK_INTEGER
;
*
token
Id
=
TK_INTEGER
;
for
(
i
=
1
;
isdigit
(
z
[
i
]);
i
++
)
{
}
...
...
@@ -494,7 +494,7 @@ uint32_t tSQLGetToken(char* z, uint32_t* tokenType) {
z
[
i
]
==
'U'
||
z
[
i
]
==
'A'
||
z
[
i
]
==
'S'
||
z
[
i
]
==
'M'
||
z
[
i
]
==
'H'
||
z
[
i
]
==
'D'
||
z
[
i
]
==
'N'
||
z
[
i
]
==
'Y'
||
z
[
i
]
==
'W'
)
&&
(
isIdChar
[(
uint8_t
)
z
[
i
+
1
]]
==
0
))
{
*
token
Type
=
TK_VARIABLE
;
*
token
Id
=
TK_VARIABLE
;
i
+=
1
;
return
i
;
}
...
...
@@ -505,12 +505,12 @@ uint32_t tSQLGetToken(char* z, uint32_t* tokenType) {
while
(
isdigit
(
z
[
i
]))
{
i
++
;
}
*
token
Type
=
TK_FLOAT
;
*
token
Id
=
TK_FLOAT
;
seg
++
;
}
if
(
seg
==
4
)
{
// ip address
*
token
Type
=
TK_IPTOKEN
;
*
token
Id
=
TK_IPTOKEN
;
return
i
;
}
...
...
@@ -520,14 +520,14 @@ uint32_t tSQLGetToken(char* z, uint32_t* tokenType) {
while
(
isdigit
(
z
[
i
]))
{
i
++
;
}
*
token
Type
=
TK_FLOAT
;
*
token
Id
=
TK_FLOAT
;
}
return
i
;
}
case
'['
:
{
for
(
i
=
1
;
z
[
i
]
&&
z
[
i
-
1
]
!=
']'
;
i
++
)
{
}
*
token
Type
=
TK_ID
;
*
token
Id
=
TK_ID
;
return
i
;
}
case
'T'
:
...
...
@@ -538,7 +538,7 @@ uint32_t tSQLGetToken(char* z, uint32_t* tokenType) {
}
if
((
i
==
4
&&
strncasecmp
(
z
,
"true"
,
4
)
==
0
)
||
(
i
==
5
&&
strncasecmp
(
z
,
"false"
,
5
)
==
0
))
{
*
token
Type
=
TK_BOOL
;
*
token
Id
=
TK_BOOL
;
return
i
;
}
}
...
...
@@ -548,12 +548,12 @@ uint32_t tSQLGetToken(char* z, uint32_t* tokenType) {
}
for
(
i
=
1
;
((
z
[
i
]
&
0x80
)
==
0
)
&&
isIdChar
[(
uint8_t
)
z
[
i
]];
i
++
)
{
}
*
token
Type
=
tSQLKeywordCode
(
z
,
i
);
*
token
Id
=
tSQLKeywordCode
(
z
,
i
);
return
i
;
}
}
*
token
Type
=
TK_ILLEGAL
;
*
token
Id
=
TK_ILLEGAL
;
return
0
;
}
...
...
tests/script/general/parser/testSuite.sim
浏览文件 @
5501982f
run general/parser/alter.sim
sleep 100
run general/parser/alter1.sim
sleep 100
run general/parser/alter_stable.sim
sleep 100
run general/parser/auto_create_tb.sim
sleep 100
run general/parser/auto_create_tb_drop_tb.sim
sleep 100
run general/parser/col_arithmetic_operation.sim
sleep 100
run general/parser/columnValue.sim
sleep 100
run general/parser/commit.sim
sleep 100
run general/parser/create_db.sim
sleep 100
run general/parser/create_mt.sim
sleep 100
run general/parser/create_tb.sim
sleep 100
run general/parser/dbtbnameValidate.sim
sleep 100
run general/parser/fill.sim
sleep 100
run general/parser/fill_stb.sim
sleep 100
#run general/parser/fill_us.sim #
sleep 100
run general/parser/first_last.sim
sleep 100
run general/parser/import_commit1.sim
sleep 100
run general/parser/import_commit2.sim
sleep 100
run general/parser/import_commit3.sim
sleep 100
#run general/parser/import_file.sim
sleep 100
run general/parser/insert_tb.sim
sleep 100
run general/parser/tags_dynamically_specifiy.sim
sleep 100
run general/parser/interp.sim
sleep 100
run general/parser/lastrow.sim
sleep 100
run general/parser/limit.sim
sleep 100
run general/parser/limit1.sim
sleep 100
run general/parser/limit1_tblocks100.sim
sleep 100
run general/parser/limit2.sim
sleep 100
run general/parser/mixed_blocks.sim
sleep 100
run general/parser/nchar.sim
sleep 100
run general/parser/null_char.sim
sleep 100
run general/parser/selectResNum.sim
sleep 100
run general/parser/select_across_vnodes.sim
sleep 100
run general/parser/select_from_cache_disk.sim
sleep 100
run general/parser/set_tag_vals.sim
sleep 100
run general/parser/single_row_in_tb.sim
sleep 100
run general/parser/slimit.sim
sleep 100
run general/parser/slimit1.sim
sleep 100
run general/parser/slimit_alter_tags.sim
sleep 100
run general/parser/tbnameIn.sim
sleep 100
run general/parser/slimit_alter_tags.sim # persistent failed
sleep 100
run general/parser/join.sim
sleep 100
run general/parser/join_multivnode.sim
sleep 100
#
run general/parser/alter.sim
#
sleep 100
#
run general/parser/alter1.sim
#
sleep 100
#
run general/parser/alter_stable.sim
#
sleep 100
#
run general/parser/auto_create_tb.sim
#
sleep 100
#
run general/parser/auto_create_tb_drop_tb.sim
#
sleep 100
#
run general/parser/col_arithmetic_operation.sim
#
sleep 100
#
run general/parser/columnValue.sim
#
sleep 100
#
run general/parser/commit.sim
#
sleep 100
#
run general/parser/create_db.sim
#
sleep 100
#
run general/parser/create_mt.sim
#
sleep 100
#
run general/parser/create_tb.sim
#
sleep 100
#
run general/parser/dbtbnameValidate.sim
#
sleep 100
#
run general/parser/fill.sim
#
sleep 100
#
run general/parser/fill_stb.sim
#
sleep 100
#
#
run general/parser/fill_us.sim #
#
sleep 100
#
run general/parser/first_last.sim
#
sleep 100
#
run general/parser/import_commit1.sim
#
sleep 100
#
run general/parser/import_commit2.sim
#
sleep 100
#
run general/parser/import_commit3.sim
#
sleep 100
#
#
run general/parser/import_file.sim
#
sleep 100
#
run general/parser/insert_tb.sim
#
sleep 100
#
run general/parser/tags_dynamically_specifiy.sim
#
sleep 100
#
run general/parser/interp.sim
#
sleep 100
#
run general/parser/lastrow.sim
#
sleep 100
#
run general/parser/limit.sim
#
sleep 100
#
run general/parser/limit1.sim
#
sleep 100
#
run general/parser/limit1_tblocks100.sim
#
sleep 100
#
run general/parser/limit2.sim
#
sleep 100
#
run general/parser/mixed_blocks.sim
#
sleep 100
#
run general/parser/nchar.sim
#
sleep 100
#
run general/parser/null_char.sim
#
sleep 100
#
run general/parser/selectResNum.sim
#
sleep 100
#
run general/parser/select_across_vnodes.sim
#
sleep 100
#
run general/parser/select_from_cache_disk.sim
#
sleep 100
#
run general/parser/set_tag_vals.sim
#
sleep 100
#
run general/parser/single_row_in_tb.sim
#
sleep 100
#
run general/parser/slimit.sim
#
sleep 100
#
run general/parser/slimit1.sim
#
sleep 100
#
run general/parser/slimit_alter_tags.sim
#
sleep 100
#
run general/parser/tbnameIn.sim
#
sleep 100
#
run general/parser/slimit_alter_tags.sim # persistent failed
#
sleep 100
#
run general/parser/join.sim
#
sleep 100
#
run general/parser/join_multivnode.sim
#
sleep 100
run general/parser/projection_limit_offset.sim
sleep 100
run general/parser/select_with_tags.sim
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录