Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a041c07c
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
a041c07c
编写于
3月 31, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/3.0' into feature/shm
上级
1a8b1753
c80f3239
变更
34
展开全部
显示空白变更内容
内联
并排
Showing
34 changed file
with
2657 addition
and
1890 deletion
+2657
-1890
include/common/ttokendef.h
include/common/ttokendef.h
+56
-53
include/libs/command/command.h
include/libs/command/command.h
+19
-0
include/libs/nodes/cmdnodes.h
include/libs/nodes/cmdnodes.h
+13
-0
include/libs/nodes/nodes.h
include/libs/nodes/nodes.h
+2
-0
include/libs/parser/parser.h
include/libs/parser/parser.h
+1
-0
source/client/CMakeLists.txt
source/client/CMakeLists.txt
+1
-1
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+20
-1
source/dnode/mnode/impl/src/mndShow.c
source/dnode/mnode/impl/src/mndShow.c
+3
-1
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+0
-1
source/dnode/vnode/src/tq/tqRead.c
source/dnode/vnode/src/tq/tqRead.c
+1
-1
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+2
-2
source/libs/CMakeLists.txt
source/libs/CMakeLists.txt
+1
-0
source/libs/command/CMakeLists.txt
source/libs/command/CMakeLists.txt
+16
-0
source/libs/command/src/command.c
source/libs/command/src/command.c
+115
-0
source/libs/command/test/CMakeLists.txt
source/libs/command/test/CMakeLists.txt
+18
-0
source/libs/command/test/commandTest.cpp
source/libs/command/test/commandTest.cpp
+21
-0
source/libs/executor/inc/executil.h
source/libs/executor/inc/executil.h
+2
-0
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+1
-0
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+10
-0
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+45
-16
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+4
-0
source/libs/parser/inc/parAst.h
source/libs/parser/inc/parAst.h
+2
-0
source/libs/parser/inc/parInt.h
source/libs/parser/inc/parInt.h
+1
-0
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+8
-1
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+45
-0
source/libs/parser/src/parTokenizer.c
source/libs/parser/src/parTokenizer.c
+3
-3
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+90
-37
source/libs/parser/src/parser.c
source/libs/parser/src/parser.c
+4
-0
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+1797
-1767
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+3
-0
source/libs/stream/src/tstream.c
source/libs/stream/src/tstream.c
+1
-0
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+1
-0
tests/script/tsim/query/scalarFunction.sim
tests/script/tsim/query/scalarFunction.sim
+350
-6
tests/script/tsim/testCaseSuite.sim
tests/script/tsim/testCaseSuite.sim
+1
-0
未找到文件。
include/common/ttokendef.h
浏览文件 @
a041c07c
...
...
@@ -138,59 +138,62 @@
#define TK_INTERVAL 120
#define TK_TOPIC 121
#define TK_AS 122
#define TK_EXPLAIN 123
#define TK_ANALYZE 124
#define TK_VERBOSE 125
#define TK_NK_BOOL 126
#define TK_RATIO 127
#define TK_NULL 128
#define TK_NK_VARIABLE 129
#define TK_NK_UNDERLINE 130
#define TK_ROWTS 131
#define TK_TBNAME 132
#define TK_QSTARTTS 133
#define TK_QENDTS 134
#define TK_WSTARTTS 135
#define TK_WENDTS 136
#define TK_WDURATION 137
#define TK_BETWEEN 138
#define TK_IS 139
#define TK_NK_LT 140
#define TK_NK_GT 141
#define TK_NK_LE 142
#define TK_NK_GE 143
#define TK_NK_NE 144
#define TK_MATCH 145
#define TK_NMATCH 146
#define TK_IN 147
#define TK_JOIN 148
#define TK_INNER 149
#define TK_SELECT 150
#define TK_DISTINCT 151
#define TK_WHERE 152
#define TK_PARTITION 153
#define TK_BY 154
#define TK_SESSION 155
#define TK_STATE_WINDOW 156
#define TK_SLIDING 157
#define TK_FILL 158
#define TK_VALUE 159
#define TK_NONE 160
#define TK_PREV 161
#define TK_LINEAR 162
#define TK_NEXT 163
#define TK_GROUP 164
#define TK_HAVING 165
#define TK_ORDER 166
#define TK_SLIMIT 167
#define TK_SOFFSET 168
#define TK_LIMIT 169
#define TK_OFFSET 170
#define TK_ASC 171
#define TK_DESC 172
#define TK_NULLS 173
#define TK_FIRST 174
#define TK_LAST 175
#define TK_DESC 123
#define TK_DESCRIBE 124
#define TK_RESET 125
#define TK_QUERY 126
#define TK_EXPLAIN 127
#define TK_ANALYZE 128
#define TK_VERBOSE 129
#define TK_NK_BOOL 130
#define TK_RATIO 131
#define TK_NULL 132
#define TK_NK_VARIABLE 133
#define TK_NK_UNDERLINE 134
#define TK_ROWTS 135
#define TK_TBNAME 136
#define TK_QSTARTTS 137
#define TK_QENDTS 138
#define TK_WSTARTTS 139
#define TK_WENDTS 140
#define TK_WDURATION 141
#define TK_BETWEEN 142
#define TK_IS 143
#define TK_NK_LT 144
#define TK_NK_GT 145
#define TK_NK_LE 146
#define TK_NK_GE 147
#define TK_NK_NE 148
#define TK_MATCH 149
#define TK_NMATCH 150
#define TK_IN 151
#define TK_JOIN 152
#define TK_INNER 153
#define TK_SELECT 154
#define TK_DISTINCT 155
#define TK_WHERE 156
#define TK_PARTITION 157
#define TK_BY 158
#define TK_SESSION 159
#define TK_STATE_WINDOW 160
#define TK_SLIDING 161
#define TK_FILL 162
#define TK_VALUE 163
#define TK_NONE 164
#define TK_PREV 165
#define TK_LINEAR 166
#define TK_NEXT 167
#define TK_GROUP 168
#define TK_HAVING 169
#define TK_ORDER 170
#define TK_SLIMIT 171
#define TK_SOFFSET 172
#define TK_LIMIT 173
#define TK_OFFSET 174
#define TK_ASC 175
#define TK_NULLS 176
#define TK_FIRST 177
#define TK_LAST 178
#define TK_NK_SPACE 300
#define TK_NK_COMMENT 301
...
...
include/libs/command/command.h
0 → 100644
浏览文件 @
a041c07c
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "cmdnodes.h"
#include "tmsg.h"
int32_t
qExecCommand
(
SNode
*
pStmt
,
SRetrieveTableRsp
**
pRsp
);
include/libs/nodes/cmdnodes.h
浏览文件 @
a041c07c
...
...
@@ -20,8 +20,14 @@
extern
"C"
{
#endif
#include "query.h"
#include "querynodes.h"
#define DESCRIBE_RESULT_COLS 4
#define DESCRIBE_RESULT_FIELD_LEN (TSDB_COL_NAME_LEN - 1 + VARSTR_HEADER_SIZE)
#define DESCRIBE_RESULT_TYPE_LEN (20 + VARSTR_HEADER_SIZE)
#define DESCRIBE_RESULT_NOTE_LEN (8 + VARSTR_HEADER_SIZE)
typedef
struct
SDatabaseOptions
{
ENodeType
type
;
int32_t
numOfBlocks
;
...
...
@@ -247,6 +253,13 @@ typedef struct SAlterLocalStmt {
char
value
[
TSDB_DNODE_VALUE_LEN
];
}
SAlterLocalStmt
;
typedef
struct
SDescribeStmt
{
ENodeType
type
;
char
dbName
[
TSDB_DB_NAME_LEN
];
char
tableName
[
TSDB_TABLE_NAME_LEN
];
STableMeta
*
pMeta
;
}
SDescribeStmt
;
#ifdef __cplusplus
}
#endif
...
...
include/libs/nodes/nodes.h
浏览文件 @
a041c07c
...
...
@@ -101,6 +101,8 @@ typedef enum ENodeType {
QUERY_NODE_DROP_TOPIC_STMT
,
QUERY_NODE_ALTER_LOCAL_STMT
,
QUERY_NODE_EXPLAIN_STMT
,
QUERY_NODE_DESCRIBE_STMT
,
QUERY_NODE_RESET_QUERY_CACHE_STMT
,
QUERY_NODE_SHOW_DATABASES_STMT
,
QUERY_NODE_SHOW_TABLES_STMT
,
QUERY_NODE_SHOW_STABLES_STMT
,
...
...
include/libs/parser/parser.h
浏览文件 @
a041c07c
...
...
@@ -55,6 +55,7 @@ typedef struct SQuery {
SArray
*
pDbList
;
SArray
*
pTableList
;
bool
showRewrite
;
bool
localCmd
;
}
SQuery
;
int32_t
qParseQuerySql
(
SParseContext
*
pCxt
,
SQuery
**
pQuery
);
...
...
source/client/CMakeLists.txt
浏览文件 @
a041c07c
...
...
@@ -8,7 +8,7 @@ target_include_directories(
target_link_libraries
(
taos
INTERFACE api
PRIVATE os util common transport nodes parser planner catalog scheduler function qcom
PRIVATE os util common transport nodes parser
command
planner catalog scheduler function qcom
)
if
(
${
BUILD_TEST
}
)
...
...
source/client/src/clientImpl.c
浏览文件 @
a041c07c
#include "clientInt.h"
#include "clientLog.h"
#include "command.h"
#include "scheduler.h"
#include "tdatablock.h"
#include "tdef.h"
...
...
@@ -170,6 +171,15 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery) {
return
code
;
}
int32_t
execLocalCmd
(
SRequestObj
*
pRequest
,
SQuery
*
pQuery
)
{
SRetrieveTableRsp
*
pRsp
=
NULL
;
int32_t
code
=
qExecCommand
(
pQuery
->
pRoot
,
&
pRsp
);
if
(
TSDB_CODE_SUCCESS
==
code
&&
NULL
!=
pRsp
)
{
code
=
setQueryResultFromRsp
(
&
pRequest
->
body
.
resInfo
,
pRsp
);
}
return
code
;
}
int32_t
execDdlQuery
(
SRequestObj
*
pRequest
,
SQuery
*
pQuery
)
{
SCmdMsgInfo
*
pMsgInfo
=
pQuery
->
pCmdMsg
;
pRequest
->
type
=
pMsgInfo
->
msgType
;
...
...
@@ -259,7 +269,9 @@ SRequestObj* execQueryImpl(STscObj* pTscObj, const char* sql, int sqlLen) {
CHECK_CODE_GOTO
(
buildRequest
(
pTscObj
,
sql
,
sqlLen
,
&
pRequest
),
_return
);
CHECK_CODE_GOTO
(
parseSql
(
pRequest
,
false
,
&
pQuery
),
_return
);
if
(
pQuery
->
directRpc
)
{
if
(
pQuery
->
localCmd
)
{
CHECK_CODE_GOTO
(
execLocalCmd
(
pRequest
,
pQuery
),
_return
);
}
else
if
(
pQuery
->
directRpc
)
{
CHECK_CODE_GOTO
(
execDdlQuery
(
pRequest
,
pQuery
),
_return
);
}
else
{
CHECK_CODE_GOTO
(
getPlan
(
pRequest
,
pQuery
,
&
pRequest
->
body
.
pDag
,
pNodeList
),
_return
);
...
...
@@ -464,9 +476,11 @@ static void destroySendMsgInfo(SMsgSendInfo* pMsgBody) {
taosMemoryFreeClear
(
pMsgBody
->
msgInfo
.
pData
);
taosMemoryFreeClear
(
pMsgBody
);
}
bool
persistConnForSpecificMsg
(
void
*
parenct
,
tmsg_t
msgType
)
{
return
msgType
==
TDMT_VND_QUERY_RSP
||
msgType
==
TDMT_VND_FETCH_RSP
||
msgType
==
TDMT_VND_RES_READY_RSP
||
msgType
==
TDMT_VND_QUERY_HEARTBEAT_RSP
;
}
void
processMsgFromServer
(
void
*
parent
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
SMsgSendInfo
*
pSendInfo
=
(
SMsgSendInfo
*
)
pMsg
->
ahandle
;
assert
(
pMsg
->
ahandle
!=
NULL
);
...
...
@@ -647,6 +661,11 @@ void* doFetchRow(SRequestObj* pRequest, bool setupOneRowPtr) {
}
}
if
(
pResultInfo
->
completed
)
{
pResultInfo
->
numOfRows
=
0
;
return
NULL
;
}
SMsgSendInfo
*
body
=
buildMsgInfoImpl
(
pRequest
);
int64_t
transporterId
=
0
;
...
...
source/dnode/mnode/impl/src/mndShow.c
浏览文件 @
a041c07c
...
...
@@ -310,6 +310,8 @@ static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) {
mError
(
"failed to process show-retrieve req:%p since %s"
,
pShow
,
terrstr
());
return
-
1
;
}
pShow
->
numOfReads
=
0
;
}
ShowRetrieveFp
retrieveFp
=
pMgmt
->
retrieveFps
[
pShow
->
type
];
...
...
@@ -374,7 +376,7 @@ static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) {
pReq
->
pRsp
=
pRsp
;
pReq
->
rspLen
=
size
;
if
(
rowsRead
==
0
||
rowsToRead
==
0
||
(
rowsRead
==
rowsToRead
&&
pShow
->
numOfRows
==
pShow
->
numOfReads
))
{
if
(
rowsRead
==
0
||
rowsToRead
==
0
||
(
rowsRead
<
rowsToRead
))
{
pRsp
->
completed
=
1
;
mDebug
(
"show:0x%"
PRIx64
", retrieve completed"
,
pShow
->
id
);
mndReleaseShowObj
((
SShowObj
*
)
pShow
,
true
);
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
a041c07c
...
...
@@ -1608,7 +1608,6 @@ static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, char *data, int32
SStbObj
*
pStb
=
NULL
;
int32_t
cols
=
0
;
char
*
pWrite
;
char
prefix
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
SDbObj
*
pDb
=
NULL
;
if
(
strlen
(
pShow
->
db
)
>
0
)
{
...
...
source/dnode/vnode/src/tq/tqRead.c
浏览文件 @
a041c07c
...
...
@@ -167,7 +167,7 @@ SArray* tqRetrieveDataBlock(STqReadHandle* pHandle) {
if
(
!
tdSTSRowIterNext
(
&
iter
,
pColData
->
info
.
colId
,
pColData
->
info
.
type
,
&
sVal
))
{
break
;
}
if
(
colDataAppend
(
pColData
,
curRow
,
sVal
.
val
,
sVal
.
valType
==
TD_VTYPE_NULL
)
<
0
)
{
if
(
colDataAppend
(
pColData
,
curRow
,
sVal
.
val
,
false
)
<
0
)
{
taosArrayDestroyEx
(
pArray
,
(
void
(
*
)(
void
*
))
tDeleteSSDataBlock
);
return
NULL
;
}
...
...
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
a041c07c
...
...
@@ -69,9 +69,9 @@ int vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) {
return
tqProcessPollReq
(
pVnode
->
pTq
,
pMsg
);
case
TDMT_VND_TASK_PIPE_EXEC
:
case
TDMT_VND_TASK_MERGE_EXEC
:
return
tqProcessTaskExec
(
pVnode
->
pTq
,
msgstr
,
msgLen
,
pInfo
->
workerId
);
return
tqProcessTaskExec
(
pVnode
->
pTq
,
msgstr
,
msgLen
,
0
);
case
TDMT_VND_STREAM_TRIGGER
:
return
tqProcessStreamTrigger
(
pVnode
->
pTq
,
pMsg
->
pCont
,
pMsg
->
contLen
,
pInfo
->
workerId
);
return
tqProcessStreamTrigger
(
pVnode
->
pTq
,
pMsg
->
pCont
,
pMsg
->
contLen
,
0
);
case
TDMT_VND_QUERY_HEARTBEAT
:
return
qWorkerProcessHbMsg
(
pVnode
,
pVnode
->
pQuery
,
pMsg
);
default:
...
...
source/libs/CMakeLists.txt
浏览文件 @
a041c07c
...
...
@@ -17,3 +17,4 @@ add_subdirectory(tfs)
add_subdirectory
(
monitor
)
add_subdirectory
(
nodes
)
add_subdirectory
(
scalar
)
add_subdirectory
(
command
)
source/libs/command/CMakeLists.txt
0 → 100644
浏览文件 @
a041c07c
aux_source_directory
(
src COMMAND_SRC
)
add_library
(
command STATIC
${
COMMAND_SRC
}
)
target_include_directories
(
command
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/libs/command"
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
)
target_link_libraries
(
command
PRIVATE os util nodes catalog function transport qcom
)
if
(
${
BUILD_TEST
}
)
ADD_SUBDIRECTORY
(
test
)
endif
(
${
BUILD_TEST
}
)
\ No newline at end of file
source/libs/command/src/command.c
0 → 100644
浏览文件 @
a041c07c
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "command.h"
#include "tdatablock.h"
// #define SET_VARSTR(pData, val, pOffset)
static
void
buildRspData
(
const
STableMeta
*
pMeta
,
char
*
pData
)
{
int32_t
*
pColSizes
=
(
int32_t
*
)
pData
;
pData
+=
DESCRIBE_RESULT_COLS
*
sizeof
(
int32_t
);
int32_t
numOfRows
=
TABLE_TOTAL_COL_NUM
(
pMeta
);
// Field
int32_t
*
pOffset
=
(
int32_t
*
)
pData
;
pData
+=
numOfRows
*
sizeof
(
int32_t
);
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
STR_TO_VARSTR
(
pData
,
pMeta
->
schema
[
i
].
name
);
int16_t
len
=
varDataTLen
(
pData
);
pData
+=
len
;
*
pOffset
=
pColSizes
[
0
];
pOffset
+=
1
;
pColSizes
[
0
]
+=
len
;
}
// Type
pOffset
=
(
int32_t
*
)
pData
;
pData
+=
numOfRows
*
sizeof
(
int32_t
);
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
STR_TO_VARSTR
(
pData
,
tDataTypes
[
pMeta
->
schema
[
i
].
type
].
name
);
int16_t
len
=
varDataTLen
(
pData
);
pData
+=
len
;
*
pOffset
=
pColSizes
[
1
];
pOffset
+=
1
;
pColSizes
[
1
]
+=
len
;
}
// Length
pData
+=
BitmapLen
(
numOfRows
);
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
*
(
int32_t
*
)
pData
=
pMeta
->
schema
[
i
].
bytes
;
pData
+=
sizeof
(
int32_t
);
}
pColSizes
[
2
]
=
sizeof
(
int32_t
)
*
numOfRows
;
// Note
pOffset
=
(
int32_t
*
)
pData
;
pData
+=
numOfRows
*
sizeof
(
int32_t
);
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
STR_TO_VARSTR
(
pData
,
i
>=
pMeta
->
tableInfo
.
numOfColumns
?
"TAG"
:
""
);
int16_t
len
=
varDataTLen
(
pData
);
pData
+=
len
;
*
pOffset
=
pColSizes
[
3
];
pOffset
+=
1
;
pColSizes
[
3
]
+=
len
;
}
for
(
int32_t
i
=
0
;
i
<
DESCRIBE_RESULT_COLS
;
++
i
)
{
pColSizes
[
i
]
=
htonl
(
pColSizes
[
i
]);
}
}
static
int32_t
calcRspSize
(
const
STableMeta
*
pMeta
)
{
int32_t
numOfRows
=
TABLE_TOTAL_COL_NUM
(
pMeta
);
return
sizeof
(
SRetrieveTableRsp
)
+
(
numOfRows
*
sizeof
(
int32_t
)
+
numOfRows
*
DESCRIBE_RESULT_FIELD_LEN
)
+
(
numOfRows
*
sizeof
(
int32_t
)
+
numOfRows
*
DESCRIBE_RESULT_TYPE_LEN
)
+
(
BitmapLen
(
numOfRows
)
+
numOfRows
*
sizeof
(
int32_t
))
+
(
numOfRows
*
sizeof
(
int32_t
)
+
numOfRows
*
DESCRIBE_RESULT_NOTE_LEN
);
}
static
int32_t
execDescribe
(
SNode
*
pStmt
,
SRetrieveTableRsp
**
pRsp
)
{
SDescribeStmt
*
pDesc
=
(
SDescribeStmt
*
)
pStmt
;
*
pRsp
=
taosMemoryCalloc
(
1
,
calcRspSize
(
pDesc
->
pMeta
));
if
(
NULL
==
*
pRsp
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
(
*
pRsp
)
->
useconds
=
0
;
(
*
pRsp
)
->
completed
=
1
;
(
*
pRsp
)
->
precision
=
0
;
(
*
pRsp
)
->
compressed
=
0
;
(
*
pRsp
)
->
compLen
=
0
;
(
*
pRsp
)
->
numOfRows
=
htonl
(
TABLE_TOTAL_COL_NUM
(
pDesc
->
pMeta
));
buildRspData
(
pDesc
->
pMeta
,
(
*
pRsp
)
->
data
);
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
execResetQueryCache
()
{
// todo
return
TSDB_CODE_SUCCESS
;
}
int32_t
qExecCommand
(
SNode
*
pStmt
,
SRetrieveTableRsp
**
pRsp
)
{
switch
(
nodeType
(
pStmt
))
{
case
QUERY_NODE_DESCRIBE_STMT
:
return
execDescribe
(
pStmt
,
pRsp
);
case
QUERY_NODE_RESET_QUERY_CACHE_STMT
:
return
execResetQueryCache
();
default:
break
;
}
return
TSDB_CODE_FAILED
;
}
source/libs/command/test/CMakeLists.txt
0 → 100644
浏览文件 @
a041c07c
MESSAGE
(
STATUS
"build command unit test"
)
# GoogleTest requires at least C++11
SET
(
CMAKE_CXX_STANDARD 11
)
AUX_SOURCE_DIRECTORY
(
${
CMAKE_CURRENT_SOURCE_DIR
}
SOURCE_LIST
)
ADD_EXECUTABLE
(
commandTest
${
SOURCE_LIST
}
)
TARGET_INCLUDE_DIRECTORIES
(
commandTest
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/libs/command/"
PRIVATE
"
${
CMAKE_SOURCE_DIR
}
/source/libs/command/inc"
)
TARGET_LINK_LIBRARIES
(
commandTest
PUBLIC os util common nodes parser catalog transport gtest function qcom
)
\ No newline at end of file
source/libs/command/test/commandTest.cpp
0 → 100644
浏览文件 @
a041c07c
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <gtest/gtest.h>
int
main
(
int
argc
,
char
*
argv
[])
{
testing
::
InitGoogleTest
(
&
argc
,
argv
);
return
RUN_ALL_TESTS
();
}
source/libs/executor/inc/executil.h
浏览文件 @
a041c07c
...
...
@@ -156,6 +156,8 @@ SArray* interResFromBinary(const char* data, int32_t len);
void
freeInterResult
(
void
*
param
);
void
initGroupResInfo
(
SGroupResInfo
*
pGroupResInfo
,
SResultRowInfo
*
pResultInfo
);
void
initMultiResInfoFromArrayList
(
SGroupResInfo
*
pGroupResInfo
,
SArray
*
pArrayList
);
void
cleanupGroupResInfo
(
SGroupResInfo
*
pGroupResInfo
);
bool
hasRemainDataInCurrentGroup
(
SGroupResInfo
*
pGroupResInfo
);
bool
hasRemainData
(
SGroupResInfo
*
pGroupResInfo
);
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
a041c07c
...
...
@@ -422,6 +422,7 @@ typedef struct SStreamBlockScanInfo {
uint64_t
numOfRows
;
// total scanned rows
uint64_t
numOfExec
;
// execution times
void
*
readerHandle
;
// stream block reader handle
SArray
*
pColMatchInfo
;
//
}
SStreamBlockScanInfo
;
typedef
struct
SSysTableScanInfo
{
...
...
source/libs/executor/src/executil.c
浏览文件 @
a041c07c
...
...
@@ -222,6 +222,16 @@ void initGroupResInfo(SGroupResInfo* pGroupResInfo, SResultRowInfo* pResultInfo)
assert
(
pGroupResInfo
->
index
<=
getNumOfTotalRes
(
pGroupResInfo
));
}
void
initMultiResInfoFromArrayList
(
SGroupResInfo
*
pGroupResInfo
,
SArray
*
pArrayList
)
{
if
(
pGroupResInfo
->
pRows
!=
NULL
)
{
taosArrayDestroy
(
pGroupResInfo
->
pRows
);
}
pGroupResInfo
->
pRows
=
pArrayList
;
pGroupResInfo
->
index
=
0
;
ASSERT
(
pGroupResInfo
->
index
<=
getNumOfTotalRes
(
pGroupResInfo
));
}
bool
hasRemainDataInCurrentGroup
(
SGroupResInfo
*
pGroupResInfo
)
{
if
(
pGroupResInfo
->
pRows
==
NULL
)
{
return
false
;
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
a041c07c
...
...
@@ -1551,8 +1551,8 @@ static SArray* hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pRe
if
(
pSDataBlock
->
pDataBlock
!=
NULL
)
{
SColumnInfoData
*
pColDataInfo
=
taosArrayGet
(
pSDataBlock
->
pDataBlock
,
0
);
tsCols
=
(
int64_t
*
)
pColDataInfo
->
pData
;
assert
(
tsCols
[
0
]
==
pSDataBlock
->
info
.
window
.
skey
&&
tsCols
[
pSDataBlock
->
info
.
rows
-
1
]
==
pSDataBlock
->
info
.
window
.
ekey
);
//
assert(tsCols[0] == pSDataBlock->info.window.skey &&
//
tsCols[pSDataBlock->info.rows - 1] == pSDataBlock->info.window.ekey);
}
int32_t
startPos
=
ascScan
?
0
:
(
pSDataBlock
->
info
.
rows
-
1
);
...
...
@@ -3660,6 +3660,7 @@ void finalizeUpdatedResult(SqlFunctionCtx* pCtx, int32_t numOfOutput, SDiskbased
if
(
pCtx
[
j
].
fpSet
.
process
)
{
// TODO set the dummy function.
pCtx
[
j
].
fpSet
.
finalize
(
&
pCtx
[
j
]);
pResInfo
->
initialized
=
true
;
}
if
(
pRow
->
numOfRows
<
pResInfo
->
numOfRes
)
{
...
...
@@ -3778,10 +3779,6 @@ void setResultRowOutputBufInitCtx_rv(SDiskbasedBuf* pBuf, SResultRow* pResult, S
continue
;
}
// int32_t functionId = pCtx[i].functionId;
// if (functionId < 0) {
// continue;
// }
// if (functionId == FUNCTION_TOP || functionId == FUNCTION_BOTTOM || functionId == FUNCTION_DIFF) {
// if (i > 0) pCtx[i].ptsOutputBuf = pCtx[i - 1].pOutput;
// }
...
...
@@ -4971,7 +4968,20 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator, bool* newgroup)
return
NULL
;
}
pInfo
->
pRes
->
pDataBlock
=
tqRetrieveDataBlock
(
pInfo
->
readerHandle
);
SArray
*
pCols
=
tqRetrieveDataBlock
(
pInfo
->
readerHandle
);
int32_t
numOfCols
=
pInfo
->
pRes
->
info
.
numOfCols
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
p
=
taosArrayGet
(
pCols
,
i
);
SColMatchInfo
*
pColMatchInfo
=
taosArrayGet
(
pInfo
->
pColMatchInfo
,
i
);
if
(
!
pColMatchInfo
->
output
)
{
continue
;
}
ASSERT
(
pColMatchInfo
->
colId
==
p
->
info
.
colId
);
taosArraySet
(
pInfo
->
pRes
->
pDataBlock
,
pColMatchInfo
->
targetSlotId
,
p
);
}
if
(
pInfo
->
pRes
->
pDataBlock
==
NULL
)
{
// TODO add log
pTaskInfo
->
code
=
terrno
;
...
...
@@ -5625,8 +5635,18 @@ SOperatorInfo* createStreamScanOperatorInfo(void* streamReadHandle, SSDataBlock*
return
NULL
;
}
int32_t
numOfOutput
=
taosArrayGetSize
(
pColList
);
SArray
*
pColIds
=
taosArrayInit
(
4
,
sizeof
(
int16_t
));
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
int16_t
*
id
=
taosArrayGet
(
pColList
,
i
);
taosArrayPush
(
pColIds
,
id
);
}
pInfo
->
pColMatchInfo
=
pColList
;
// set the extract column id to streamHandle
tqReadHandleSetColIdList
((
STqReadHandle
*
)
streamReadHandle
,
pCol
List
);
tqReadHandleSetColIdList
((
STqReadHandle
*
)
streamReadHandle
,
pCol
Ids
);
int32_t
code
=
tqReadHandleSetTbUidList
(
streamReadHandle
,
pTableIdList
);
if
(
code
!=
0
)
{
taosMemoryFreeClear
(
pInfo
);
...
...
@@ -5824,6 +5844,10 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator, bool* newgroup) {
// pInfo->totalBytes;
return
(
pInfo
->
pRes
->
info
.
rows
==
0
)
?
NULL
:
pInfo
->
pRes
;
}
else
{
// load the meta from mnode of the given epset
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
return
NULL
;
}
int64_t
startTs
=
taosGetTimestampUs
();
pInfo
->
req
.
type
=
pInfo
->
type
;
...
...
@@ -5863,6 +5887,10 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator, bool* newgroup) {
SRetrieveMetaTableRsp
*
pRsp
=
pInfo
->
pRsp
;
pInfo
->
req
.
showId
=
pRsp
->
handle
;
if
(
pRsp
->
numOfRows
==
0
||
pRsp
->
completed
)
{
pOperator
->
status
=
OP_EXEC_DONE
;
}
if
(
pRsp
->
numOfRows
==
0
)
{
// qDebug("%s vgId:%d, taskID:0x%"PRIx64" %d of total completed, rowsOfSource:%"PRIu64", totalRows:%"PRIu64"
// try next",
...
...
@@ -6964,7 +6992,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo *pOperator, bool* newgroup
if
(
pInfo
->
binfo
.
pRes
->
info
.
rows
==
0
||
!
hasRemainDataInCurrentGroup
(
&
pInfo
->
groupResInfo
))
{
pOperator
->
status
=
OP_EXEC_DONE
;
}
return
pInfo
->
binfo
.
pRes
;
return
pInfo
->
binfo
.
pRes
->
info
.
rows
==
0
?
NULL
:
pInfo
->
binfo
.
pRes
;
}
// STimeWindow win = {0};
...
...
@@ -6993,6 +7021,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo *pOperator, bool* newgroup
finalizeUpdatedResult
(
pInfo
->
binfo
.
pCtx
,
pOperator
->
numOfOutput
,
pInfo
->
aggSup
.
pResultBuf
,
pUpdated
,
pInfo
->
binfo
.
rowCellInfoOffset
);
initMultiResInfoFromArrayList
(
&
pInfo
->
groupResInfo
,
pUpdated
);
blockDataEnsureCapacity
(
pInfo
->
binfo
.
pRes
,
pInfo
->
binfo
.
capacity
);
toSDatablock
(
&
pInfo
->
groupResInfo
,
pInfo
->
aggSup
.
pResultBuf
,
pInfo
->
binfo
.
pRes
,
pInfo
->
binfo
.
capacity
,
pInfo
->
binfo
.
rowCellInfoOffset
);
...
...
@@ -8792,10 +8821,10 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
SArray
*
tableIdList
=
extractTableIdList
(
pTableGroupInfo
);
SSDataBlock
*
pResBlock
=
createOutputBuf_rv1
(
pScanPhyNode
->
node
.
pOutputDataBlockDesc
);
SArray
*
colList
=
extractScanColumnId
(
pScanPhyNode
->
pScanCols
);
SOperatorInfo
*
pOperator
=
createStreamScanOperatorInfo
(
pHandle
->
reader
,
pResBlock
,
colList
,
tableIdList
,
pTaskInfo
);
int32_t
numOfCols
=
0
;
SArray
*
pColList
=
extractColMatchInfo
(
pScanPhyNode
->
pScanCols
,
pScanPhyNode
->
node
.
pOutputDataBlockDesc
,
&
numOfCols
);
SOperatorInfo
*
pOperator
=
createStreamScanOperatorInfo
(
pHandle
->
reader
,
pResBlock
,
pColList
,
tableIdList
,
pTaskInfo
);
taosArrayDestroy
(
tableIdList
);
return
pOperator
;
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN
==
nodeType
(
pPhyNode
))
{
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
a041c07c
...
...
@@ -136,6 +136,10 @@ SNodeptr nodesMakeNode(ENodeType type) {
return
makeNode
(
type
,
sizeof
(
SDropTopicStmt
));
case
QUERY_NODE_EXPLAIN_STMT
:
return
makeNode
(
type
,
sizeof
(
SExplainStmt
));
case
QUERY_NODE_DESCRIBE_STMT
:
return
makeNode
(
type
,
sizeof
(
SDescribeStmt
));
case
QUERY_NODE_RESET_QUERY_CACHE_STMT
:
return
makeNode
(
type
,
sizeof
(
SNode
));
case
QUERY_NODE_SHOW_DATABASES_STMT
:
case
QUERY_NODE_SHOW_TABLES_STMT
:
case
QUERY_NODE_SHOW_STABLES_STMT
:
...
...
source/libs/parser/inc/parAst.h
浏览文件 @
a041c07c
...
...
@@ -163,6 +163,8 @@ SNode* createDefaultExplainOptions(SAstCreateContext* pCxt);
SNode
*
setExplainVerbose
(
SAstCreateContext
*
pCxt
,
SNode
*
pOptions
,
const
SToken
*
pVal
);
SNode
*
setExplainRatio
(
SAstCreateContext
*
pCxt
,
SNode
*
pOptions
,
const
SToken
*
pVal
);
SNode
*
createExplainStmt
(
SAstCreateContext
*
pCxt
,
bool
analyze
,
SNode
*
pOptions
,
SNode
*
pQuery
);
SNode
*
createDescribeStmt
(
SAstCreateContext
*
pCxt
,
SNode
*
pRealTable
);
SNode
*
createResetQueryCacheStmt
(
SAstCreateContext
*
pCxt
);
#ifdef __cplusplus
}
...
...
source/libs/parser/inc/parInt.h
浏览文件 @
a041c07c
...
...
@@ -25,6 +25,7 @@ extern "C" {
int32_t
parseInsertSql
(
SParseContext
*
pContext
,
SQuery
**
pQuery
);
int32_t
doParse
(
SParseContext
*
pParseCxt
,
SQuery
**
pQuery
);
int32_t
doTranslate
(
SParseContext
*
pParseCxt
,
SQuery
*
pQuery
);
int32_t
extractResultSchema
(
const
SNode
*
pRoot
,
int32_t
*
numOfCols
,
SSchema
**
pSchema
);
#ifdef __cplusplus
}
...
...
source/libs/parser/inc/sql.y
浏览文件 @
a041c07c
...
...
@@ -339,7 +339,14 @@ cmd ::= CREATE TOPIC not_exists_opt(A) topic_name(B) AS query_expression(C).
cmd ::= CREATE TOPIC not_exists_opt(A) topic_name(B) AS db_name(C). { pCxt->pRootNode = createCreateTopicStmt(pCxt, A, &B, NULL, &C); }
cmd ::= DROP TOPIC exists_opt(A) topic_name(B). { pCxt->pRootNode = createDropTopicStmt(pCxt, A, &B); }
/************************************************ select **************************************************************/
/************************************************ desc/describe *******************************************************/
cmd ::= DESC full_table_name(A). { pCxt->pRootNode = createDescribeStmt(pCxt, A); }
cmd ::= DESCRIBE full_table_name(A). { pCxt->pRootNode = createDescribeStmt(pCxt, A); }
/************************************************ reset query cache ***************************************************/
cmd ::= RESET QUERY CACHE. { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); }
/************************************************ explain *************************************************************/
cmd ::= EXPLAIN analyze_opt(A) explain_options(B) query_expression(C). { pCxt->pRootNode = createExplainStmt(pCxt, A, B, C); }
%type analyze_opt { bool }
...
...
source/libs/parser/src/parAstCreater.c
浏览文件 @
a041c07c
...
...
@@ -473,6 +473,9 @@ static bool checkPort(SAstCreateContext* pCxt, const SToken* pPortToken, int32_t
static
bool
checkDbName
(
SAstCreateContext
*
pCxt
,
SToken
*
pDbName
,
bool
query
)
{
if
(
NULL
==
pDbName
)
{
pCxt
->
valid
=
(
query
?
NULL
!=
pCxt
->
pQueryCxt
->
db
:
true
);
if
(
!
pCxt
->
valid
)
{
snprintf
(
pCxt
->
pQueryCxt
->
pMsg
,
pCxt
->
pQueryCxt
->
msgLen
,
"db not specified"
);
}
}
else
{
pCxt
->
valid
=
pDbName
->
n
<
TSDB_DB_NAME_LEN
?
true
:
false
;
}
...
...
@@ -1017,6 +1020,9 @@ SDataType createVarLenDataType(uint8_t type, const SToken* pLen) {
SNode
*
createCreateTableStmt
(
SAstCreateContext
*
pCxt
,
bool
ignoreExists
,
SNode
*
pRealTable
,
SNodeList
*
pCols
,
SNodeList
*
pTags
,
SNode
*
pOptions
)
{
if
(
NULL
==
pRealTable
)
{
return
NULL
;
}
SCreateTableStmt
*
pStmt
=
(
SCreateTableStmt
*
)
nodesMakeNode
(
QUERY_NODE_CREATE_TABLE_STMT
);
CHECK_OUT_OF_MEM
(
pStmt
);
strcpy
(
pStmt
->
dbName
,
((
SRealTableNode
*
)
pRealTable
)
->
table
.
dbName
);
...
...
@@ -1031,6 +1037,9 @@ SNode* createCreateTableStmt(SAstCreateContext* pCxt,
SNode
*
createCreateSubTableClause
(
SAstCreateContext
*
pCxt
,
bool
ignoreExists
,
SNode
*
pRealTable
,
SNode
*
pUseRealTable
,
SNodeList
*
pSpecificTags
,
SNodeList
*
pValsOfTags
)
{
if
(
NULL
==
pRealTable
)
{
return
NULL
;
}
SCreateSubTableClause
*
pStmt
=
nodesMakeNode
(
QUERY_NODE_CREATE_SUBTABLE_CLAUSE
);
CHECK_OUT_OF_MEM
(
pStmt
);
strcpy
(
pStmt
->
dbName
,
((
SRealTableNode
*
)
pRealTable
)
->
table
.
dbName
);
...
...
@@ -1053,6 +1062,9 @@ SNode* createCreateMultiTableStmt(SAstCreateContext* pCxt, SNodeList* pSubTables
}
SNode
*
createDropTableClause
(
SAstCreateContext
*
pCxt
,
bool
ignoreNotExists
,
SNode
*
pRealTable
)
{
if
(
NULL
==
pRealTable
)
{
return
NULL
;
}
SDropTableClause
*
pStmt
=
nodesMakeNode
(
QUERY_NODE_DROP_TABLE_CLAUSE
);
CHECK_OUT_OF_MEM
(
pStmt
);
strcpy
(
pStmt
->
dbName
,
((
SRealTableNode
*
)
pRealTable
)
->
table
.
dbName
);
...
...
@@ -1080,6 +1092,9 @@ SNode* createDropSuperTableStmt(SAstCreateContext* pCxt, bool ignoreNotExists, S
}
SNode
*
createAlterTableOption
(
SAstCreateContext
*
pCxt
,
SNode
*
pRealTable
,
SNode
*
pOptions
)
{
if
(
NULL
==
pRealTable
)
{
return
NULL
;
}
SAlterTableStmt
*
pStmt
=
nodesMakeNode
(
QUERY_NODE_ALTER_TABLE_STMT
);
CHECK_OUT_OF_MEM
(
pStmt
);
pStmt
->
alterType
=
TSDB_ALTER_TABLE_UPDATE_OPTIONS
;
...
...
@@ -1088,6 +1103,9 @@ SNode* createAlterTableOption(SAstCreateContext* pCxt, SNode* pRealTable, SNode*
}
SNode
*
createAlterTableAddModifyCol
(
SAstCreateContext
*
pCxt
,
SNode
*
pRealTable
,
int8_t
alterType
,
const
SToken
*
pColName
,
SDataType
dataType
)
{
if
(
NULL
==
pRealTable
)
{
return
NULL
;
}
SAlterTableStmt
*
pStmt
=
nodesMakeNode
(
QUERY_NODE_ALTER_TABLE_STMT
);
CHECK_OUT_OF_MEM
(
pStmt
);
pStmt
->
alterType
=
alterType
;
...
...
@@ -1097,6 +1115,9 @@ SNode* createAlterTableAddModifyCol(SAstCreateContext* pCxt, SNode* pRealTable,
}
SNode
*
createAlterTableDropCol
(
SAstCreateContext
*
pCxt
,
SNode
*
pRealTable
,
int8_t
alterType
,
const
SToken
*
pColName
)
{
if
(
NULL
==
pRealTable
)
{
return
NULL
;
}
SAlterTableStmt
*
pStmt
=
nodesMakeNode
(
QUERY_NODE_ALTER_TABLE_STMT
);
CHECK_OUT_OF_MEM
(
pStmt
);
pStmt
->
alterType
=
alterType
;
...
...
@@ -1105,6 +1126,9 @@ SNode* createAlterTableDropCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_
}
SNode
*
createAlterTableRenameCol
(
SAstCreateContext
*
pCxt
,
SNode
*
pRealTable
,
int8_t
alterType
,
const
SToken
*
pOldColName
,
const
SToken
*
pNewColName
)
{
if
(
NULL
==
pRealTable
)
{
return
NULL
;
}
SAlterTableStmt
*
pStmt
=
nodesMakeNode
(
QUERY_NODE_ALTER_TABLE_STMT
);
CHECK_OUT_OF_MEM
(
pStmt
);
pStmt
->
alterType
=
alterType
;
...
...
@@ -1114,6 +1138,9 @@ SNode* createAlterTableRenameCol(SAstCreateContext* pCxt, SNode* pRealTable, int
}
SNode
*
createAlterTableSetTag
(
SAstCreateContext
*
pCxt
,
SNode
*
pRealTable
,
const
SToken
*
pTagName
,
SNode
*
pVal
)
{
if
(
NULL
==
pRealTable
)
{
return
NULL
;
}
SAlterTableStmt
*
pStmt
=
nodesMakeNode
(
QUERY_NODE_ALTER_TABLE_STMT
);
CHECK_OUT_OF_MEM
(
pStmt
);
pStmt
->
alterType
=
TSDB_ALTER_TABLE_UPDATE_TAG_VAL
;
...
...
@@ -1343,3 +1370,21 @@ SNode* createExplainStmt(SAstCreateContext* pCxt, bool analyze, SNode* pOptions,
pStmt
->
pQuery
=
pQuery
;
return
(
SNode
*
)
pStmt
;
}
SNode
*
createDescribeStmt
(
SAstCreateContext
*
pCxt
,
SNode
*
pRealTable
)
{
if
(
NULL
==
pRealTable
)
{
return
NULL
;
}
SDescribeStmt
*
pStmt
=
nodesMakeNode
(
QUERY_NODE_DESCRIBE_STMT
);
CHECK_OUT_OF_MEM
(
pStmt
);
strcpy
(
pStmt
->
dbName
,
((
SRealTableNode
*
)
pRealTable
)
->
table
.
dbName
);
strcpy
(
pStmt
->
tableName
,
((
SRealTableNode
*
)
pRealTable
)
->
table
.
tableName
);
nodesDestroyNode
(
pRealTable
);
return
(
SNode
*
)
pStmt
;
}
SNode
*
createResetQueryCacheStmt
(
SAstCreateContext
*
pCxt
)
{
SNode
*
pStmt
=
nodesMakeNode
(
QUERY_NODE_RESET_QUERY_CACHE_STMT
);
CHECK_OUT_OF_MEM
(
pStmt
);
return
pStmt
;
}
source/libs/parser/src/parTokenizer.c
浏览文件 @
a041c07c
...
...
@@ -51,6 +51,7 @@ static SKeyword keywordTable[] = {
{
"DAYS"
,
TK_DAYS
},
{
"DELAY"
,
TK_DELAY
},
{
"DESC"
,
TK_DESC
},
{
"DESCRIBE"
,
TK_DESCRIBE
},
{
"DISTINCT"
,
TK_DISTINCT
},
{
"DNODE"
,
TK_DNODE
},
{
"DNODES"
,
TK_DNODES
},
...
...
@@ -111,9 +112,11 @@ static SKeyword keywordTable[] = {
{
"QNODE"
,
TK_QNODE
},
{
"QNODES"
,
TK_QNODES
},
{
"QSTARTTS"
,
TK_QSTARTTS
},
{
"QUERY"
,
TK_QUERY
},
{
"QUORUM"
,
TK_QUORUM
},
{
"RATIO"
,
TK_RATIO
},
{
"REPLICA"
,
TK_REPLICA
},
{
"RESET"
,
TK_RESET
},
{
"RETENTIONS"
,
TK_RETENTIONS
},
{
"ROLLUP"
,
TK_ROLLUP
},
{
"ROWTS"
,
TK_ROWTS
},
...
...
@@ -186,7 +189,6 @@ static SKeyword keywordTable[] = {
// {"SCORES", TK_SCORES},
// {"GRANTS", TK_GRANTS},
// {"DOT", TK_DOT},
// {"DESCRIBE", TK_DESCRIBE},
// {"SYNCDB", TK_SYNCDB},
// {"LOCAL", TK_LOCAL},
// {"PPS", TK_PPS},
...
...
@@ -203,8 +205,6 @@ static SKeyword keywordTable[] = {
// {"EVERY", TK_EVERY},
// {"VARIABLE", TK_VARIABLE},
// {"UPDATE", TK_UPDATE},
// {"RESET", TK_RESET},
// {"QUERY", TK_QUERY},
// {"ADD", TK_ADD},
// {"COLUMN", TK_COLUMN},
// {"TAG", TK_TAG},
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
a041c07c
...
...
@@ -1812,6 +1812,10 @@ static int32_t translateExplain(STranslateContext* pCxt, SExplainStmt* pStmt) {
return
translateQuery
(
pCxt
,
pStmt
->
pQuery
);
}
static
int32_t
translateDescribe
(
STranslateContext
*
pCxt
,
SDescribeStmt
*
pStmt
)
{
return
getTableMeta
(
pCxt
,
pStmt
->
dbName
,
pStmt
->
tableName
,
&
pStmt
->
pMeta
);
}
static
int32_t
translateQuery
(
STranslateContext
*
pCxt
,
SNode
*
pNode
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
switch
(
nodeType
(
pNode
))
{
...
...
@@ -1896,6 +1900,9 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) {
case
QUERY_NODE_EXPLAIN_STMT
:
code
=
translateExplain
(
pCxt
,
(
SExplainStmt
*
)
pNode
);
break
;
case
QUERY_NODE_DESCRIBE_STMT
:
code
=
translateDescribe
(
pCxt
,
(
SDescribeStmt
*
)
pNode
);
break
;
default:
break
;
}
...
...
@@ -1913,13 +1920,7 @@ static int32_t translateSubquery(STranslateContext* pCxt, SNode* pNode) {
return
code
;
}
int32_t
qExtractResultSchema
(
const
SNode
*
pRoot
,
int32_t
*
numOfCols
,
SSchema
**
pSchema
)
{
if
(
NULL
==
pRoot
)
{
return
TSDB_CODE_SUCCESS
;
}
if
(
QUERY_NODE_SELECT_STMT
==
nodeType
(
pRoot
))
{
SSelectStmt
*
pSelect
=
(
SSelectStmt
*
)
pRoot
;
static
int32_t
extractSelectResultSchema
(
const
SSelectStmt
*
pSelect
,
int32_t
*
numOfCols
,
SSchema
**
pSchema
)
{
*
numOfCols
=
LIST_LENGTH
(
pSelect
->
pProjectionList
);
*
pSchema
=
taosMemoryCalloc
((
*
numOfCols
),
sizeof
(
SSchema
));
if
(
NULL
==
(
*
pSchema
))
{
...
...
@@ -1936,7 +1937,11 @@ int32_t qExtractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** p
strcpy
((
*
pSchema
)[
index
].
name
,
pExpr
->
aliasName
);
index
+=
1
;
}
}
else
if
(
QUERY_NODE_EXPLAIN_STMT
==
nodeType
(
pRoot
))
{
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
extractExplainResultSchema
(
int32_t
*
numOfCols
,
SSchema
**
pSchema
)
{
*
numOfCols
=
1
;
*
pSchema
=
taosMemoryCalloc
((
*
numOfCols
),
sizeof
(
SSchema
));
if
(
NULL
==
(
*
pSchema
))
{
...
...
@@ -1944,11 +1949,54 @@ int32_t qExtractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** p
}
(
*
pSchema
)[
0
].
type
=
TSDB_DATA_TYPE_BINARY
;
(
*
pSchema
)[
0
].
bytes
=
TSDB_EXPLAIN_RESULT_ROW_SIZE
;
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
extractDescribeResultSchema
(
int32_t
*
numOfCols
,
SSchema
**
pSchema
)
{
*
numOfCols
=
DESCRIBE_RESULT_COLS
;
*
pSchema
=
taosMemoryCalloc
((
*
numOfCols
),
sizeof
(
SSchema
));
if
(
NULL
==
(
*
pSchema
))
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
(
*
pSchema
)[
0
].
type
=
TSDB_DATA_TYPE_BINARY
;
(
*
pSchema
)[
0
].
bytes
=
DESCRIBE_RESULT_FIELD_LEN
;
strcpy
((
*
pSchema
)[
0
].
name
,
"Field"
);
(
*
pSchema
)[
1
].
type
=
TSDB_DATA_TYPE_BINARY
;
(
*
pSchema
)[
1
].
bytes
=
DESCRIBE_RESULT_TYPE_LEN
;
strcpy
((
*
pSchema
)[
1
].
name
,
"Type"
);
(
*
pSchema
)[
2
].
type
=
TSDB_DATA_TYPE_INT
;
(
*
pSchema
)[
2
].
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_INT
].
bytes
;
strcpy
((
*
pSchema
)[
2
].
name
,
"Length"
);
(
*
pSchema
)[
3
].
type
=
TSDB_DATA_TYPE_BINARY
;
(
*
pSchema
)[
3
].
bytes
=
DESCRIBE_RESULT_NOTE_LEN
;
strcpy
((
*
pSchema
)[
3
].
name
,
"Note"
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
extractResultSchema
(
const
SNode
*
pRoot
,
int32_t
*
numOfCols
,
SSchema
**
pSchema
)
{
if
(
NULL
==
pRoot
)
{
return
TSDB_CODE_SUCCESS
;
}
switch
(
nodeType
(
pRoot
))
{
case
QUERY_NODE_SELECT_STMT
:
return
extractSelectResultSchema
((
SSelectStmt
*
)
pRoot
,
numOfCols
,
pSchema
);
case
QUERY_NODE_EXPLAIN_STMT
:
return
extractExplainResultSchema
(
numOfCols
,
pSchema
);
case
QUERY_NODE_DESCRIBE_STMT
:
return
extractDescribeResultSchema
(
numOfCols
,
pSchema
);
default:
break
;
}
return
TSDB_CODE_FAILED
;
}
static
void
destroyTranslateContext
(
STranslateContext
*
pCxt
)
{
if
(
NULL
!=
pCxt
->
pNsLevel
)
{
size_t
size
=
taosArrayGetSize
(
pCxt
->
pNsLevel
);
...
...
@@ -2530,26 +2578,31 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) {
case
QUERY_NODE_SELECT_STMT
:
case
QUERY_NODE_EXPLAIN_STMT
:
pQuery
->
haveResultSet
=
true
;
pQuery
->
directRpc
=
false
;
pQuery
->
msgType
=
TDMT_VND_QUERY
;
if
(
TSDB_CODE_SUCCESS
!=
qExtractResultSchema
(
pQuery
->
pRoot
,
&
pQuery
->
numOfResCols
,
&
pQuery
->
pResSchema
))
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
break
;
case
QUERY_NODE_VNODE_MODIF_STMT
:
pQuery
->
haveResultSet
=
false
;
pQuery
->
directRpc
=
false
;
pQuery
->
msgType
=
TDMT_VND_CREATE_TABLE
;
break
;
case
QUERY_NODE_DESCRIBE_STMT
:
pQuery
->
localCmd
=
true
;
pQuery
->
haveResultSet
=
true
;
break
;
case
QUERY_NODE_RESET_QUERY_CACHE_STMT
:
pQuery
->
localCmd
=
true
;
break
;
default:
pQuery
->
haveResultSet
=
false
;
pQuery
->
directRpc
=
true
;
pQuery
->
pCmdMsg
=
pCxt
->
pCmdMsg
;
pCxt
->
pCmdMsg
=
NULL
;
TSWAP
(
pQuery
->
pCmdMsg
,
pCxt
->
pCmdMsg
,
SCmdMsgInfo
*
);
pQuery
->
msgType
=
pQuery
->
pCmdMsg
->
msgType
;
break
;
}
if
(
pQuery
->
haveResultSet
)
{
if
(
TSDB_CODE_SUCCESS
!=
extractResultSchema
(
pQuery
->
pRoot
,
&
pQuery
->
numOfResCols
,
&
pQuery
->
pResSchema
))
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
if
(
NULL
!=
pCxt
->
pDbs
)
{
pQuery
->
pDbList
=
taosArrayInit
(
taosHashGetSize
(
pCxt
->
pDbs
),
TSDB_DB_FNAME_LEN
);
if
(
NULL
==
pQuery
->
pDbList
)
{
...
...
source/libs/parser/src/parser.c
浏览文件 @
a041c07c
...
...
@@ -62,3 +62,7 @@ void qDestroyQuery(SQuery* pQueryNode) {
taosArrayDestroy
(
pQueryNode
->
pTableList
);
taosMemoryFreeClear
(
pQueryNode
);
}
int32_t
qExtractResultSchema
(
const
SNode
*
pRoot
,
int32_t
*
numOfCols
,
SSchema
**
pSchema
)
{
return
extractResultSchema
(
pRoot
,
numOfCols
,
pSchema
);
}
\ No newline at end of file
source/libs/parser/src/sql.c
浏览文件 @
a041c07c
此差异已折叠。
点击以展开。
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
a041c07c
...
...
@@ -719,6 +719,9 @@ static int32_t createStreamScanPhysiNodeByExchange(SPhysiPlanContext* pCxt, SExc
if
(
NULL
==
pScan
->
pScanCols
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
sortScanCols
(
pScan
->
pScanCols
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
addDataBlockSlots
(
pCxt
,
pScan
->
pScanCols
,
pScan
->
node
.
pOutputDataBlockDesc
);
}
...
...
source/libs/stream/src/tstream.c
浏览文件 @
a041c07c
...
...
@@ -152,6 +152,7 @@ int32_t streamExecTask(SStreamTask* pTask, SMsgCb* pMsgCb, const void* input, in
// sink
if
(
pTask
->
sinkType
==
TASK_SINK__TABLE
)
{
//
blockDebugShowData
(
pRes
);
}
else
if
(
pTask
->
sinkType
==
TASK_SINK__SMA
)
{
pTask
->
smaSink
.
smaHandle
(
pTask
->
ahandle
,
pTask
->
smaSink
.
smaId
,
pRes
);
//
...
...
tests/script/jenkins/basic.txt
浏览文件 @
a041c07c
...
...
@@ -28,6 +28,7 @@
# ---- query
./test.sh -f tsim/query/interval.sim
./test.sh -f tsim/query/interval-offset.sim
./test.sh -f tsim/query/scalarFunction.sim
# ---- show
./test.sh -f tsim/show/basic.sim
...
...
tests/script/tsim/query/scalarFunction.sim
浏览文件 @
a041c07c
...
...
@@ -37,11 +37,11 @@ print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $d
sql use $dbNamme
print =============== create super table
sql create table
if not exists
stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int)
sql create table stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int)
print =============== create child table
$tbPrefix = ct
$tbNum =
2
$tbNum =
100
$i = 0
while $i < $tbNum
...
...
@@ -54,7 +54,7 @@ print =============== create normal table
sql create table ntb (ts timestamp, c1 int, c2 float, c3 double)
sql show tables
if $rows !=
3
then
if $rows !=
101
then
return -1
endi
...
...
@@ -83,6 +83,12 @@ while $i < $tbNum
$tstart = 1640966400000
endw
$totalRows = $rowNum * $tbNum
print ====> totalRows of stb: $totalRows
$loop_test = 0
loop_test_pos:
print ====> abs
sql select c1, abs(c1), c2, abs(c2), c3, abs(c3) from ct1
print ====> select c1, abs(c1), c2, abs(c2), c3, abs(c3) from ct1
...
...
@@ -97,11 +103,106 @@ print ====> $data60 $data61 $data62 $data63 $data64 $data65
print ====> $data70 $data71 $data72 $data73 $data74 $data75
print ====> $data80 $data81 $data82 $data83 $data84 $data85
print ====> $data90 $data91 $data92 $data93 $data94 $data95
if $rows != 10 then
if $rows != $rowNum then
return -1
endi
print ====> select c1, abs(c1), c2, abs(c2), c3, abs(c3) from stb
sql select c1, abs(c1), c2, abs(c2), c3, abs(c3) from stb
if $rows != $totalRows then
return -1
endi
print ====> select c1, abs(c1), c2, abs(c2), c3, abs(c3) from ntb
sql select c1, abs(c1), c2, abs(c2), c3, abs(c3) from ntb
if $rows != $rowNum then
return -1
endi
print ====> log
sql select c1, log(c1, 10), c2, log(c2, 10), c3, log(c3, 10) from ct1
print ====> select c1, log(c1, 10), c2, log(c2, 10), c3, log(c3, 10) from ct1
print ====> rows: $rows
print ====> $data00 $data01 $data02 $data03 $data04 $data05
print ====> $data10 $data11 $data12 $data13 $data14 $data15
print ====> $data20 $data21 $data22 $data23 $data24 $data25
print ====> $data30 $data31 $data32 $data33 $data34 $data35
print ====> $data40 $data41 $data42 $data43 $data44 $data45
print ====> $data50 $data51 $data52 $data53 $data54 $data55
print ====> $data60 $data61 $data62 $data63 $data64 $data65
print ====> $data70 $data71 $data72 $data73 $data74 $data75
print ====> $data80 $data81 $data82 $data83 $data84 $data85
print ====> $data90 $data91 $data92 $data93 $data94 $data95
if $rows != $rowNum then
return -1
endi
print ====> select c1, log(c1, 10), c2, log(c2, 10), c3, log(c3, 10) from stb
sql select c1, log(c1, 10), c2, log(c2, 10), c3, log(c3, 10) from stb
if $rows != $totalRows then
return -1
endi
print ====> select c1, log(c1, 10), c2, log(c2, 10), c3, log(c3, 10) from ntb
sql select c1, log(c1, 10), c2, log(c2, 10), c3, log(c3, 10) from ntb
if $rows != $rowNum then
return -1
endi
print ====> pow
sql select c1, pow(c1, 2), c2, pow(c2, 2), c3, pow(c3, 2) from ct1
print ====> select c1, pow(c1, 2), c2, pow(c2, 2), c3, pow(c3, 2) from ct1
print ====> rows: $rows
print ====> $data00 $data01 $data02 $data03 $data04 $data05
print ====> $data10 $data11 $data12 $data13 $data14 $data15
print ====> $data20 $data21 $data22 $data23 $data24 $data25
print ====> $data30 $data31 $data32 $data33 $data34 $data35
print ====> $data40 $data41 $data42 $data43 $data44 $data45
print ====> $data50 $data51 $data52 $data53 $data54 $data55
print ====> $data60 $data61 $data62 $data63 $data64 $data65
print ====> $data70 $data71 $data72 $data73 $data74 $data75
print ====> $data80 $data81 $data82 $data83 $data84 $data85
print ====> $data90 $data91 $data92 $data93 $data94 $data95
if $rows != $rowNum then
return -1
endi
print ====> select c1, pow(c1, 2), c2, pow(c2, 2), c3, pow(c3, 2) from stb
sql select c1, pow(c1, 2), c2, pow(c2, 2), c3, pow(c3, 2) from stb
if $rows != $totalRows then
return -1
endi
print ====> select c1, pow(c1, 2), c2, pow(c2, 2), c3, pow(c3, 2) from ntb
sql select c1, pow(c1, 2), c2, pow(c2, 2), c3, pow(c3, 2) from ntb
if $rows != $rowNum then
return -1
endi
print ====> sqrt
sql select c1, sqrt(c1), c2, sqrt(c2), c3, sqrt(c3) from ct1
print ====> select c1, sqrt(c1), c2, sqrt(c2), c3, sqrt(c3) from ct1
print ====> rows: $rows
print ====> $data00 $data01 $data02 $data03 $data04 $data05
print ====> $data10 $data11 $data12 $data13 $data14 $data15
print ====> $data20 $data21 $data22 $data23 $data24 $data25
print ====> $data30 $data31 $data32 $data33 $data34 $data35
print ====> $data40 $data41 $data42 $data43 $data44 $data45
print ====> $data50 $data51 $data52 $data53 $data54 $data55
print ====> $data60 $data61 $data62 $data63 $data64 $data65
print ====> $data70 $data71 $data72 $data73 $data74 $data75
print ====> $data80 $data81 $data82 $data83 $data84 $data85
print ====> $data90 $data91 $data92 $data93 $data94 $data95
if $rows != $rowNum then
return -1
endi
print ====> select c1, sqrt(c1), c2, sqrt(c2), c3, sqrt(c3) from stb
sql select c1, sqrt(c1), c2, sqrt(c2), c3, sqrt(c3) from stb
if $rows != $totalRows then
return -1
endi
print ====> select c1, sqrt(c1), c2, sqrt(c2), c3, sqrt(c3) from ntb
sql select c1, sqrt(c1), c2, sqrt(c2), c3, sqrt(c3) from ntb
if $rows != $rowNum then
return -1
endi
print ====> sin
#sql select c1, sin(c1), sin(c1) * 3.14159265 / 180 from ct1 # TD-14426
sql select c1, sin(c1), c2, sin(c2), c3, sin(c3) from ct1
print ====> select c1, sin(c1), c2, sin(c2), c3, sin(c3) from ct1
print ====> rows: $rows
...
...
@@ -115,7 +216,17 @@ print ====> $data60 $data61 $data62 $data63 $data64 $data65
print ====> $data70 $data71 $data72 $data73 $data74 $data75
print ====> $data80 $data81 $data82 $data83 $data84 $data85
print ====> $data90 $data91 $data92 $data93 $data94 $data95
if $rows != 10 then
if $rows != $rowNum then
return -1
endi
print ====> select c1, sin(c1), c2, sin(c2), c3, sin(c3) from stb
sql select c1, sin(c1), c2, sin(c2), c3, sin(c3) from stb
if $rows != $totalRows then
return -1
endi
print ====> select c1, sin(c1), c2, sin(c2), c3, sin(c3) from ntb
sql select c1, sin(c1), c2, sin(c2), c3, sin(c3) from ntb
if $rows != $rowNum then
return -1
endi
...
...
@@ -133,8 +244,241 @@ print ====> $data60 $data61 $data62 $data63 $data64 $data65
print ====> $data70 $data71 $data72 $data73 $data74 $data75
print ====> $data80 $data81 $data82 $data83 $data84 $data85
print ====> $data90 $data91 $data92 $data93 $data94 $data95
if $rows != 10 then
if $rows != $rowNum then
return -1
endi
print ====> select c1, cos(c1), c2, cos(c2), c3, cos(c3) from stb
sql select c1, cos(c1), c2, cos(c2), c3, cos(c3) from stb
if $rows != $totalRows then
return -1
endi
print ====> select c1, cos(c1), c2, cos(c2), c3, cos(c3) from ntb
sql select c1, cos(c1), c2, cos(c2), c3, cos(c3) from ntb
if $rows != $rowNum then
return -1
endi
print ====> tan
sql select c1, tan(c1), c2, tan(c2), c3, tan(c3) from ct1
print ====> select c1, tan(c1), c2, tan(c2), c3, tan(c3) from ct1
print ====> rows: $rows
print ====> $data00 $data01 $data02 $data03 $data04 $data05
print ====> $data10 $data11 $data12 $data13 $data14 $data15
print ====> $data20 $data21 $data22 $data23 $data24 $data25
print ====> $data30 $data31 $data32 $data33 $data34 $data35
print ====> $data40 $data41 $data42 $data43 $data44 $data45
print ====> $data50 $data51 $data52 $data53 $data54 $data55
print ====> $data60 $data61 $data62 $data63 $data64 $data65
print ====> $data70 $data71 $data72 $data73 $data74 $data75
print ====> $data80 $data81 $data82 $data83 $data84 $data85
print ====> $data90 $data91 $data92 $data93 $data94 $data95
if $rows != $rowNum then
return -1
endi
print ====> select c1, tan(c1), c2, tan(c2), c3, tan(c3) from stb
sql select c1, tan(c1), c2, tan(c2), c3, tan(c3) from stb
if $rows != $totalRows then
return -1
endi
print ====> select c1, tan(c1), c2, tan(c2), c3, tan(c3) from ntb
sql select c1, tan(c1), c2, tan(c2), c3, tan(c3) from ntb
if $rows != $rowNum then
return -1
endi
print ====> asin
sql select c1, asin(c1), c2, asin(c2), c3, asin(c3) from ct1
print ====> select c1, asin(c1), c2, asin(c2), c3, asin(c3) from ct1
print ====> rows: $rows
print ====> $data00 $data01 $data02 $data03 $data04 $data05
print ====> $data10 $data11 $data12 $data13 $data14 $data15
print ====> $data20 $data21 $data22 $data23 $data24 $data25
print ====> $data30 $data31 $data32 $data33 $data34 $data35
print ====> $data40 $data41 $data42 $data43 $data44 $data45
print ====> $data50 $data51 $data52 $data53 $data54 $data55
print ====> $data60 $data61 $data62 $data63 $data64 $data65
print ====> $data70 $data71 $data72 $data73 $data74 $data75
print ====> $data80 $data81 $data82 $data83 $data84 $data85
print ====> $data90 $data91 $data92 $data93 $data94 $data95
if $rows != $rowNum then
return -1
endi
print ====> select c1, asin(c1), c2, asin(c2), c3, asin(c3) from stb
sql select c1, asin(c1), c2, asin(c2), c3, asin(c3) from stb
if $rows != $totalRows then
return -1
endi
print ====> select c1, asin(c1), c2, asin(c2), c3, asin(c3) from ntb
sql select c1, asin(c1), c2, asin(c2), c3, asin(c3) from ntb
if $rows != $rowNum then
return -1
endi
print ====> acos
sql select c1, acos(c1), c2, acos(c2), c3, acos(c3) from ct1
print ====> select c1, acos(c1), c2, acos(c2), c3, acos(c3) from ct1
print ====> rows: $rows
print ====> $data00 $data01 $data02 $data03 $data04 $data05
print ====> $data10 $data11 $data12 $data13 $data14 $data15
print ====> $data20 $data21 $data22 $data23 $data24 $data25
print ====> $data30 $data31 $data32 $data33 $data34 $data35
print ====> $data40 $data41 $data42 $data43 $data44 $data45
print ====> $data50 $data51 $data52 $data53 $data54 $data55
print ====> $data60 $data61 $data62 $data63 $data64 $data65
print ====> $data70 $data71 $data72 $data73 $data74 $data75
print ====> $data80 $data81 $data82 $data83 $data84 $data85
print ====> $data90 $data91 $data92 $data93 $data94 $data95
if $rows != $rowNum then
return -1
endi
print ====> select c1, acos(c1), c2, acos(c2), c3, acos(c3) from stb
sql select c1, acos(c1), c2, acos(c2), c3, acos(c3) from stb
if $rows != $totalRows then
return -1
endi
print ====> select c1, acos(c1), c2, acos(c2), c3, acos(c3) from ntb
sql select c1, acos(c1), c2, acos(c2), c3, acos(c3) from ntb
if $rows != $rowNum then
return -1
endi
print ====> atan
sql select c1, atan(c1), c2, atan(c2), c3, atan(c3) from ct1
print ====> select c1, atan(c1), c2, atan(c2), c3, atan(c3) from ct1
print ====> rows: $rows
print ====> $data00 $data01 $data02 $data03 $data04 $data05
print ====> $data10 $data11 $data12 $data13 $data14 $data15
print ====> $data20 $data21 $data22 $data23 $data24 $data25
print ====> $data30 $data31 $data32 $data33 $data34 $data35
print ====> $data40 $data41 $data42 $data43 $data44 $data45
print ====> $data50 $data51 $data52 $data53 $data54 $data55
print ====> $data60 $data61 $data62 $data63 $data64 $data65
print ====> $data70 $data71 $data72 $data73 $data74 $data75
print ====> $data80 $data81 $data82 $data83 $data84 $data85
print ====> $data90 $data91 $data92 $data93 $data94 $data95
if $rows != $rowNum then
return -1
endi
print ====> select c1, atan(c1), c2, atan(c2), c3, atan(c3) from stb
sql select c1, atan(c1), c2, atan(c2), c3, atan(c3) from stb
if $rows != $totalRows then
return -1
endi
print ====> select c1, atan(c1), c2, atan(c2), c3, atan(c3) from ntb
sql select c1, atan(c1), c2, atan(c2), c3, atan(c3) from ntb
if $rows != $rowNum then
return -1
endi
print ====> ceil
sql select c1, ceil(c1), c2, ceil(c2), c3, ceil(c3) from ct1
print ====> select c1, ceil(c1), c2, ceil(c2), c3, ceil(c3) from ct1
print ====> rows: $rows
print ====> $data00 $data01 $data02 $data03 $data04 $data05
print ====> $data10 $data11 $data12 $data13 $data14 $data15
print ====> $data20 $data21 $data22 $data23 $data24 $data25
print ====> $data30 $data31 $data32 $data33 $data34 $data35
print ====> $data40 $data41 $data42 $data43 $data44 $data45
print ====> $data50 $data51 $data52 $data53 $data54 $data55
print ====> $data60 $data61 $data62 $data63 $data64 $data65
print ====> $data70 $data71 $data72 $data73 $data74 $data75
print ====> $data80 $data81 $data82 $data83 $data84 $data85
print ====> $data90 $data91 $data92 $data93 $data94 $data95
if $rows != $rowNum then
return -1
endi
print ====> select c1, ceil(c1), c2, ceil(c2), c3, ceil(c3) from stb
sql select c1, ceil(c1), c2, ceil(c2), c3, ceil(c3) from stb
if $rows != $totalRows then
return -1
endi
print ====> select c1, ceil(c1), c2, ceil(c2), c3, ceil(c3) from ntb
sql select c1, ceil(c1), c2, ceil(c2), c3, ceil(c3) from ntb
if $rows != $rowNum then
return -1
endi
print ====> floor
sql select c1, floor(c1), c2, floor(c2), c3, floor(c3) from ct1
print ====> select c1, floor(c1), c2, floor(c2), c3, floor(c3) from ct1
print ====> rows: $rows
print ====> $data00 $data01 $data02 $data03 $data04 $data05
print ====> $data10 $data11 $data12 $data13 $data14 $data15
print ====> $data20 $data21 $data22 $data23 $data24 $data25
print ====> $data30 $data31 $data32 $data33 $data34 $data35
print ====> $data40 $data41 $data42 $data43 $data44 $data45
print ====> $data50 $data51 $data52 $data53 $data54 $data55
print ====> $data60 $data61 $data62 $data63 $data64 $data65
print ====> $data70 $data71 $data72 $data73 $data74 $data75
print ====> $data80 $data81 $data82 $data83 $data84 $data85
print ====> $data90 $data91 $data92 $data93 $data94 $data95
if $rows != $rowNum then
return -1
endi
print ====> select c1, floor(c1), c2, floor(c2), c3, floor(c3) from stb
sql select c1, floor(c1), c2, floor(c2), c3, floor(c3) from stb
if $rows != $totalRows then
return -1
endi
print ====> select c1, floor(c1), c2, floor(c2), c3, floor(c3) from ntb
sql select c1, floor(c1), c2, floor(c2), c3, floor(c3) from ntb
if $rows != $rowNum then
return -1
endi
print ====> round
sql select c1, round(c1), c2, round(c2), c3, round(c3) from ct1
print ====> select c1, round(c1), c2, round(c2), c3, round(c3) from ct1
print ====> rows: $rows
print ====> $data00 $data01 $data02 $data03 $data04 $data05
print ====> $data10 $data11 $data12 $data13 $data14 $data15
print ====> $data20 $data21 $data22 $data23 $data24 $data25
print ====> $data30 $data31 $data32 $data33 $data34 $data35
print ====> $data40 $data41 $data42 $data43 $data44 $data45
print ====> $data50 $data51 $data52 $data53 $data54 $data55
print ====> $data60 $data61 $data62 $data63 $data64 $data65
print ====> $data70 $data71 $data72 $data73 $data74 $data75
print ====> $data80 $data81 $data82 $data83 $data84 $data85
print ====> $data90 $data91 $data92 $data93 $data94 $data95
if $rows != $rowNum then
return -1
endi
print ====> select c1, round(c1), c2, round(c2), c3, round(c3) from stb
sql select c1, round(c1), c2, round(c2), c3, round(c3) from stb
if $rows != $totalRows then
return -1
endi
print ====> select c1, round(c1), c2, round(c2), c3, round(c3) from ntb
sql select c1, round(c1), c2, round(c2), c3, round(c3) from ntb
if $rows != $rowNum then
return -1
endi
if $loop_test == 0 then
print =============== stop and restart taosd
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start
$loop_cnt = 0
check_dnode_ready_0:
$loop_cnt = $loop_cnt + 1
sleep 200
if $loop_cnt == 10 then
print ====> dnode not ready!
return -1
endi
sql show dnodes
print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05
if $data00 != 1 then
return -1
endi
if $data04 != ready then
goto check_dnode_ready_0
endi
$loop_test = 1
goto loop_test_pos
endi
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
tests/script/tsim/testCaseSuite.sim
浏览文件 @
a041c07c
...
...
@@ -20,6 +20,7 @@ run tsim/insert/null.sim
run tsim/query/interval.sim
run tsim/query/interval-offset.sim
run tsim/query/scalarFunction.sim
run tsim/show/basic.sim
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录