Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
48c0805f
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看板
提交
48c0805f
编写于
4月 02, 2021
作者:
Y
yihaoDeng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of
https://github.com/taosdata/TDengine
into develop
上级
4cbaacb2
763a14c8
变更
27
展开全部
显示空白变更内容
内联
并排
Showing
27 changed file
with
1028 addition
and
718 deletion
+1028
-718
documentation20/cn/02.getting-started/docs.md
documentation20/cn/02.getting-started/docs.md
+14
-13
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+3
-6
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+50
-19
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+1
-1
src/dnode/src/dnodeMain.c
src/dnode/src/dnodeMain.c
+4
-2
src/dnode/src/dnodeVWrite.c
src/dnode/src/dnodeVWrite.c
+1
-1
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+251
-215
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+2
-1
src/query/inc/sql.y
src/query/inc/sql.y
+1
-0
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+50
-5
src/query/src/qSqlParser.c
src/query/src/qSqlParser.c
+11
-2
src/query/src/qUtil.c
src/query/src/qUtil.c
+4
-7
src/query/src/queryMain.c
src/query/src/queryMain.c
+1
-0
src/query/src/sql.c
src/query/src/sql.c
+344
-338
src/sync/inc/syncInt.h
src/sync/inc/syncInt.h
+1
-1
src/sync/src/syncMain.c
src/sync/src/syncMain.c
+6
-1
src/vnode/src/vnodeRead.c
src/vnode/src/vnodeRead.c
+2
-2
src/vnode/src/vnodeWrite.c
src/vnode/src/vnodeWrite.c
+5
-1
tests/examples/go/taosdemo.go
tests/examples/go/taosdemo.go
+100
-95
tests/pytest/tools/insert-tblimit-tboffset-createdb.json
tests/pytest/tools/insert-tblimit-tboffset-createdb.json
+57
-0
tests/pytest/tools/insert-tblimit-tboffset-insertrec.json
tests/pytest/tools/insert-tblimit-tboffset-insertrec.json
+59
-0
tests/pytest/tools/insert-tblimit-tboffset0.json
tests/pytest/tools/insert-tblimit-tboffset0.json
+2
-2
tests/pytest/tools/insert-tblimit1-tboffset.json
tests/pytest/tools/insert-tblimit1-tboffset.json
+2
-2
tests/pytest/tools/taosdemo-sampledata.json
tests/pytest/tools/taosdemo-sampledata.json
+0
-2
tests/pytest/tools/taosdemoTestLimitOffset.py
tests/pytest/tools/taosdemoTestLimitOffset.py
+4
-1
tests/pytest/tools/taosdemoTestSampleData.py
tests/pytest/tools/taosdemoTestSampleData.py
+1
-1
tests/script/general/parser/topbot.sim
tests/script/general/parser/topbot.sim
+52
-0
未找到文件。
documentation20/cn/02.getting-started/docs.md
浏览文件 @
48c0805f
...
...
@@ -179,19 +179,20 @@ taos> select avg(f1), max(f2), min(f3) from test.t10 interval(10s);
### TDengine服务器支持的平台列表
| |
**CentOS 6/7/8**
|
**Ubuntu 16/18/20**
|
**Other Linux**
|
**统信 UOS**
|
**银河/中标麒麟**
|
**凝思 V60/V80**
|
| -------------- | --------------------- | ------------------------ | --------------- | --------------- | ------------------------- | --------------------- |
| X64 | ● | ● | | ○ | ● | ● |
| 树莓派 ARM32 | | ● | ● | | | |
| 龙芯 MIPS64 | | | ● | | | |
| 鲲鹏 ARM64 | | ○ | ○ | | ● | |
| 申威 Alpha64 | | | ○ | ● | | |
| 飞腾 ARM64 | | ○ 优麒麟 | | | | |
| 海光 X64 | ● | ● | ● | ○ | ● | ● |
| 瑞芯微 ARM64/32 | | | ○ | | | |
| 全志 ARM64/32 | | | ○ | | | |
| 炬力 ARM64/32 | | | ○ | | | |
| TI ARM32 | | | ○ | | | |
| |
**CentOS 6/7/8**
|
**Ubuntu 16/18/20**
|
**Other Linux**
|
**统信 UOS**
|
**银河/中标麒麟**
|
**凝思 V60/V80**
|
**华为 EulerOS**
|
| -------------- | --------------------- | ------------------------ | --------------- | --------------- | ------------------------- | --------------------- | --------------------- |
| X64 | ● | ● | | ○ | ● | ● | ● |
| 树莓派 ARM32 | | ● | ● | | | | |
| 龙芯 MIPS64 | | | ● | | | | |
| 鲲鹏 ARM64 | | ○ | ○ | | ● | | |
| 申威 Alpha64 | | | ○ | ● | | | |
| 飞腾 ARM64 | | ○ 优麒麟 | | | | | |
| 海光 X64 | ● | ● | ● | ○ | ● | ● | |
| 瑞芯微 ARM64/32 | | | ○ | | | | |
| 全志 ARM64/32 | | | ○ | | | | |
| 炬力 ARM64/32 | | | ○ | | | | |
| TI ARM32 | | | ○ | | | | |
| 华为云 ARM64 | | | | | | | ● |
注: ● 表示经过官方测试验证, ○ 表示非官方测试验证。
...
...
src/client/src/tscAsync.c
浏览文件 @
48c0805f
...
...
@@ -505,10 +505,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
return
;
_error:
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
pSql
->
res
.
code
=
code
;
pRes
->
code
=
code
;
tscAsyncResultOnError
(
pSql
);
}
taosReleaseRef
(
tscObjRef
,
pSql
->
self
);
}
src/client/src/tscSQLParser.c
浏览文件 @
48c0805f
...
...
@@ -3293,7 +3293,8 @@ static int32_t extractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SC
}
if
(
pSchema
->
type
==
TSDB_DATA_TYPE_BOOL
)
{
if
(
pExpr
->
tokenId
!=
TK_EQ
&&
pExpr
->
tokenId
!=
TK_NE
)
{
int32_t
t
=
pExpr
->
tokenId
;
if
(
t
!=
TK_EQ
&&
t
!=
TK_NE
&&
t
!=
TK_NOTNULL
&&
t
!=
TK_ISNULL
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
}
...
...
@@ -3493,7 +3494,8 @@ static int32_t validateSQLExpr(SSqlCmd* pCmd, tSqlExpr* pExpr, SQueryInfo* pQuer
}
pList
->
ids
[
pList
->
num
++
]
=
index
;
}
else
if
(
pExpr
->
tokenId
==
TK_FLOAT
&&
(
isnan
(
pExpr
->
value
.
dKey
)
||
isinf
(
pExpr
->
value
.
dKey
)))
{
}
else
if
((
pExpr
->
tokenId
==
TK_FLOAT
&&
(
isnan
(
pExpr
->
value
.
dKey
)
||
isinf
(
pExpr
->
value
.
dKey
)))
||
pExpr
->
tokenId
==
TK_NULL
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
}
else
if
(
pExpr
->
type
==
SQL_NODE_SQLFUNCTION
)
{
if
(
*
type
==
NON_ARITHMEIC_EXPR
)
{
...
...
@@ -3727,6 +3729,39 @@ static int32_t setExprToCond(tSqlExpr** parent, tSqlExpr* pExpr, const char* msg
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
validateNullExpr
(
tSqlExpr
*
pExpr
,
char
*
msgBuf
)
{
const
char
*
msg
=
"only support is [not] null"
;
tSqlExpr
*
pRight
=
pExpr
->
pRight
;
if
(
pRight
->
tokenId
==
TK_NULL
&&
(
!
(
pExpr
->
tokenId
==
TK_ISNULL
||
pExpr
->
tokenId
==
TK_NOTNULL
)))
{
return
invalidSqlErrMsg
(
msgBuf
,
msg
);
}
return
TSDB_CODE_SUCCESS
;
}
// 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
*
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
invalidSqlErrMsg
(
msgBuf
,
msg1
);
}
SSchema
*
pSchema
=
tscGetTableSchema
(
pTableMeta
);
if
((
!
isTablenameToken
(
&
pLeft
->
colInfo
))
&&
!
IS_VAR_DATA_TYPE
(
pSchema
[
index
].
type
))
{
return
invalidSqlErrMsg
(
msgBuf
,
msg2
);
}
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
handleExprInQueryCond
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
tSqlExpr
**
pExpr
,
SCondExpr
*
pCondExpr
,
int32_t
*
type
,
int32_t
parentOptr
)
{
const
char
*
msg1
=
"table query cannot use tags filter"
;
...
...
@@ -3736,7 +3771,6 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql
const
char
*
msg5
=
"not support ordinary column join"
;
const
char
*
msg6
=
"only one query condition on tbname allowed"
;
const
char
*
msg7
=
"only in/like allowed in filter table name"
;
const
char
*
msg8
=
"wildcard string should be less than 20 characters"
;
tSqlExpr
*
pLeft
=
(
*
pExpr
)
->
pLeft
;
tSqlExpr
*
pRight
=
(
*
pExpr
)
->
pRight
;
...
...
@@ -3753,6 +3787,18 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
index
.
tableIndex
);
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
// validate the null expression
int32_t
code
=
validateNullExpr
(
*
pExpr
,
tscGetErrorMsgPayload
(
pCmd
));
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
// validate the like expression
code
=
validateLikeExpr
(
*
pExpr
,
pTableMeta
,
index
.
columnIndex
,
tscGetErrorMsgPayload
(
pCmd
));
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
if
(
index
.
columnIndex
==
PRIMARYKEY_TIMESTAMP_COL_INDEX
)
{
// query on time range
if
(
!
validateJoinExprNode
(
pCmd
,
pQueryInfo
,
*
pExpr
,
&
index
))
{
return
TSDB_CODE_TSC_INVALID_SQL
;
...
...
@@ -3774,7 +3820,6 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql
int16_t
leftIdx
=
index
.
tableIndex
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
pCmd
,
&
pRight
->
colInfo
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
...
...
@@ -3821,20 +3866,6 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
// check for like expression
if
((
*
pExpr
)
->
tokenId
==
TK_LIKE
)
{
if
(
pRight
->
value
.
nLen
>
TSDB_PATTERN_STRING_MAX_LEN
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg8
);
}
SSchema
*
pSchema
=
tscGetTableSchema
(
pTableMetaInfo
->
pTableMeta
);
if
((
!
isTablenameToken
(
&
pLeft
->
colInfo
))
&&
pSchema
[
index
.
columnIndex
].
type
!=
TSDB_DATA_TYPE_BINARY
&&
pSchema
[
index
.
columnIndex
].
type
!=
TSDB_DATA_TYPE_NCHAR
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
}
// in case of in operator, keep it in a seprate attribute
if
(
index
.
columnIndex
==
TSDB_TBNAME_COLUMN_INDEX
)
{
if
(
!
validTableNameOptr
(
*
pExpr
))
{
...
...
src/client/src/tscUtil.c
浏览文件 @
48c0805f
...
...
@@ -309,7 +309,7 @@ void tscSetResRawPtr(SSqlRes* pRes, SQueryInfo* pQueryInfo) {
int32_t
offset
=
0
;
for
(
int32_t
i
=
0
;
i
<
p
Res
->
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
p
QueryInfo
->
fieldsInfo
.
numOfOutput
;
++
i
)
{
SInternalField
*
pInfo
=
(
SInternalField
*
)
TARRAY_GET_ELEM
(
pQueryInfo
->
fieldsInfo
.
internalField
,
i
);
pRes
->
urow
[
i
]
=
pRes
->
data
+
offset
*
pRes
->
numOfRows
;
...
...
src/dnode/src/dnodeMain.c
浏览文件 @
48c0805f
...
...
@@ -238,9 +238,11 @@ static int32_t dnodeInitStorage() {
}
TDIR
*
tdir
=
tfsOpendir
(
"vnode_bak/.staging"
);
if
(
tfsReaddir
(
tdir
)
!=
NULL
)
{
dError
(
"vnode_bak/.staging dir not empty, fix it first."
);
bool
stagingNotEmpty
=
tfsReaddir
(
tdir
)
!=
NULL
;
tfsClosedir
(
tdir
);
if
(
stagingNotEmpty
)
{
dError
(
"vnode_bak/.staging dir not empty, fix it first."
);
return
-
1
;
}
...
...
src/dnode/src/dnodeVWrite.c
浏览文件 @
48c0805f
...
...
@@ -222,7 +222,7 @@ static void *dnodeProcessVWriteQueue(void *wparam) {
dnodeSendRpcVWriteRsp
(
pVnode
,
pWrite
,
pWrite
->
code
);
}
else
{
if
(
qtype
==
TAOS_QTYPE_FWD
)
{
vnodeConfirmForward
(
pVnode
,
pWrite
->
pHead
.
version
,
0
,
pWrite
->
pHead
.
msgType
!=
TSDB_MSG_TYPE_SUBMIT
);
vnodeConfirmForward
(
pVnode
,
pWrite
->
pHead
.
version
,
pWrite
->
code
,
pWrite
->
pHead
.
msgType
!=
TSDB_MSG_TYPE_SUBMIT
);
}
if
(
pWrite
->
rspRet
.
rsp
)
{
rpcFreeCont
(
pWrite
->
rspRet
.
rsp
);
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
48c0805f
...
...
@@ -263,7 +263,6 @@ typedef struct SSuperTable_S {
int
lenOfTagOfOneRow
;
char
*
sampleDataBuf
;
int
sampleDataBufSize
;
//int sampleRowCount;
//int sampleUsePos;
...
...
@@ -506,7 +505,7 @@ static int taosRandom()
#endif
static
int
createDatabases
();
static
int
createDatabases
AndStables
();
static
void
createChildTables
();
static
int
queryDbExec
(
TAOS
*
taos
,
char
*
command
,
QUERY_TYPE
type
,
bool
quiet
);
...
...
@@ -2279,7 +2278,7 @@ static int getSuperTableFromServer(TAOS * taos, char* dbName,
}
static
int
createSuperTable
(
TAOS
*
taos
,
char
*
dbName
,
SSuperTable
*
superTbl
s
,
bool
use_metric
)
{
SSuperTable
*
superTbl
)
{
char
command
[
BUFFER_SIZE
]
=
"
\0
"
;
char
cols
[
STRING_LEN
]
=
"
\0
"
;
...
...
@@ -2287,19 +2286,26 @@ static int createSuperTable(TAOS * taos, char* dbName,
int
len
=
0
;
int
lenOfOneRow
=
0
;
for
(
colIndex
=
0
;
colIndex
<
superTbls
->
columnCount
;
colIndex
++
)
{
char
*
dataType
=
superTbls
->
columns
[
colIndex
].
dataType
;
if
(
superTbl
->
columnCount
==
0
)
{
errorPrint
(
"%s() LN%d, super table column count is %d
\n
"
,
__func__
,
__LINE__
,
superTbl
->
columnCount
);
return
-
1
;
}
for
(
colIndex
=
0
;
colIndex
<
superTbl
->
columnCount
;
colIndex
++
)
{
char
*
dataType
=
superTbl
->
columns
[
colIndex
].
dataType
;
if
(
strcasecmp
(
dataType
,
"BINARY"
)
==
0
)
{
len
+=
snprintf
(
cols
+
len
,
STRING_LEN
-
len
,
", col%d %s(%d)"
,
colIndex
,
"BINARY"
,
superTbl
s
->
columns
[
colIndex
].
dataLen
);
lenOfOneRow
+=
superTbl
s
->
columns
[
colIndex
].
dataLen
+
3
;
superTbl
->
columns
[
colIndex
].
dataLen
);
lenOfOneRow
+=
superTbl
->
columns
[
colIndex
].
dataLen
+
3
;
}
else
if
(
strcasecmp
(
dataType
,
"NCHAR"
)
==
0
)
{
len
+=
snprintf
(
cols
+
len
,
STRING_LEN
-
len
,
", col%d %s(%d)"
,
colIndex
,
"NCHAR"
,
superTbl
s
->
columns
[
colIndex
].
dataLen
);
lenOfOneRow
+=
superTbl
s
->
columns
[
colIndex
].
dataLen
+
3
;
superTbl
->
columns
[
colIndex
].
dataLen
);
lenOfOneRow
+=
superTbl
->
columns
[
colIndex
].
dataLen
+
3
;
}
else
if
(
strcasecmp
(
dataType
,
"INT"
)
==
0
)
{
len
+=
snprintf
(
cols
+
len
,
STRING_LEN
-
len
,
", col%d %s"
,
colIndex
,
"INT"
);
lenOfOneRow
+=
11
;
...
...
@@ -2331,92 +2337,99 @@ static int createSuperTable(TAOS * taos, char* dbName,
}
}
superTbl
s
->
lenOfOneRow
=
lenOfOneRow
+
20
;
// timestamp
//printf("%s.%s column count:%d, column length:%d\n\n", g_Dbs.db[i].dbName, g_Dbs.db[i].superTbl
s[j].sTblName, g_Dbs.db[i].superTbls
[j].columnCount, lenOfOneRow);
superTbl
->
lenOfOneRow
=
lenOfOneRow
+
20
;
// timestamp
//printf("%s.%s column count:%d, column length:%d\n\n", g_Dbs.db[i].dbName, g_Dbs.db[i].superTbl
[j].sTblName, g_Dbs.db[i].superTbl
[j].columnCount, lenOfOneRow);
// save for creating child table
superTbls
->
colsOfCreateChildTable
=
(
char
*
)
calloc
(
len
+
20
,
1
);
if
(
NULL
==
superTbls
->
colsOfCreateChildTable
)
{
printf
(
"Failed when calloc, size:%d"
,
len
+
1
);
superTbl
->
colsOfCreateChildTable
=
(
char
*
)
calloc
(
len
+
20
,
1
);
if
(
NULL
==
superTbl
->
colsOfCreateChildTable
)
{
errorPrint
(
"%s() LN%d, Failed when calloc, size:%d"
,
__func__
,
__LINE__
,
len
+
1
);
taos_close
(
taos
);
exit
(
-
1
);
}
snprintf
(
superTbls
->
colsOfCreateChildTable
,
len
+
20
,
"(ts timestamp%s)"
,
cols
);
verbosePrint
(
"%s() LN%d: %s
\n
"
,
__func__
,
__LINE__
,
superTbls
->
colsOfCreateChildTable
);
if
(
use_metric
)
{
snprintf
(
superTbl
->
colsOfCreateChildTable
,
len
+
20
,
"(ts timestamp%s)"
,
cols
);
verbosePrint
(
"%s() LN%d: %s
\n
"
,
__func__
,
__LINE__
,
superTbl
->
colsOfCreateChildTable
);
if
(
superTbl
->
tagCount
==
0
)
{
errorPrint
(
"%s() LN%d, super table tag count is %d
\n
"
,
__func__
,
__LINE__
,
superTbl
->
tagCount
);
return
-
1
;
}
char
tags
[
STRING_LEN
]
=
"
\0
"
;
int
tagIndex
;
len
=
0
;
int
lenOfTagOfOneRow
=
0
;
len
+=
snprintf
(
tags
+
len
,
STRING_LEN
-
len
,
"("
);
for
(
tagIndex
=
0
;
tagIndex
<
superTbls
->
tagCount
;
tagIndex
++
)
{
char
*
dataType
=
superTbls
->
tags
[
tagIndex
].
dataType
;
for
(
tagIndex
=
0
;
tagIndex
<
superTbl
->
tagCount
;
tagIndex
++
)
{
char
*
dataType
=
superTbl
->
tags
[
tagIndex
].
dataType
;
if
(
strcasecmp
(
dataType
,
"BINARY"
)
==
0
)
{
len
+=
snprintf
(
tags
+
len
,
STRING_LEN
-
len
,
"t%d %s(%d), "
,
tagIndex
,
"BINARY"
,
superTbls
->
tags
[
tagIndex
].
dataLen
);
lenOfTagOfOneRow
+=
superTbls
->
tags
[
tagIndex
].
dataLen
+
3
;
"BINARY"
,
superTbl
->
tags
[
tagIndex
].
dataLen
);
lenOfTagOfOneRow
+=
superTbl
->
tags
[
tagIndex
].
dataLen
+
3
;
}
else
if
(
strcasecmp
(
dataType
,
"NCHAR"
)
==
0
)
{
len
+=
snprintf
(
tags
+
len
,
STRING_LEN
-
len
,
"t%d %s(%d), "
,
tagIndex
,
"NCHAR"
,
superTbls
->
tags
[
tagIndex
].
dataLen
);
lenOfTagOfOneRow
+=
superTbls
->
tags
[
tagIndex
].
dataLen
+
3
;
"NCHAR"
,
superTbl
->
tags
[
tagIndex
].
dataLen
);
lenOfTagOfOneRow
+=
superTbl
->
tags
[
tagIndex
].
dataLen
+
3
;
}
else
if
(
strcasecmp
(
dataType
,
"INT"
)
==
0
)
{
len
+=
snprintf
(
tags
+
len
,
STRING_LEN
-
len
,
"t%d %s, "
,
tagIndex
,
"INT"
);
lenOfTagOfOneRow
+=
superTbls
->
tags
[
tagIndex
].
dataLen
+
11
;
lenOfTagOfOneRow
+=
superTbl
->
tags
[
tagIndex
].
dataLen
+
11
;
}
else
if
(
strcasecmp
(
dataType
,
"BIGINT"
)
==
0
)
{
len
+=
snprintf
(
tags
+
len
,
STRING_LEN
-
len
,
"t%d %s, "
,
tagIndex
,
"BIGINT"
);
lenOfTagOfOneRow
+=
superTbls
->
tags
[
tagIndex
].
dataLen
+
21
;
lenOfTagOfOneRow
+=
superTbl
->
tags
[
tagIndex
].
dataLen
+
21
;
}
else
if
(
strcasecmp
(
dataType
,
"SMALLINT"
)
==
0
)
{
len
+=
snprintf
(
tags
+
len
,
STRING_LEN
-
len
,
"t%d %s, "
,
tagIndex
,
"SMALLINT"
);
lenOfTagOfOneRow
+=
superTbls
->
tags
[
tagIndex
].
dataLen
+
6
;
lenOfTagOfOneRow
+=
superTbl
->
tags
[
tagIndex
].
dataLen
+
6
;
}
else
if
(
strcasecmp
(
dataType
,
"TINYINT"
)
==
0
)
{
len
+=
snprintf
(
tags
+
len
,
STRING_LEN
-
len
,
"t%d %s, "
,
tagIndex
,
"TINYINT"
);
lenOfTagOfOneRow
+=
superTbls
->
tags
[
tagIndex
].
dataLen
+
4
;
lenOfTagOfOneRow
+=
superTbl
->
tags
[
tagIndex
].
dataLen
+
4
;
}
else
if
(
strcasecmp
(
dataType
,
"BOOL"
)
==
0
)
{
len
+=
snprintf
(
tags
+
len
,
STRING_LEN
-
len
,
"t%d %s, "
,
tagIndex
,
"BOOL"
);
lenOfTagOfOneRow
+=
superTbls
->
tags
[
tagIndex
].
dataLen
+
6
;
lenOfTagOfOneRow
+=
superTbl
->
tags
[
tagIndex
].
dataLen
+
6
;
}
else
if
(
strcasecmp
(
dataType
,
"FLOAT"
)
==
0
)
{
len
+=
snprintf
(
tags
+
len
,
STRING_LEN
-
len
,
"t%d %s, "
,
tagIndex
,
"FLOAT"
);
lenOfTagOfOneRow
+=
superTbls
->
tags
[
tagIndex
].
dataLen
+
22
;
lenOfTagOfOneRow
+=
superTbl
->
tags
[
tagIndex
].
dataLen
+
22
;
}
else
if
(
strcasecmp
(
dataType
,
"DOUBLE"
)
==
0
)
{
len
+=
snprintf
(
tags
+
len
,
STRING_LEN
-
len
,
"t%d %s, "
,
tagIndex
,
"DOUBLE"
);
lenOfTagOfOneRow
+=
superTbls
->
tags
[
tagIndex
].
dataLen
+
42
;
lenOfTagOfOneRow
+=
superTbl
->
tags
[
tagIndex
].
dataLen
+
42
;
}
else
{
taos_close
(
taos
);
printf
(
"config error tag type : %s
\n
"
,
dataType
);
exit
(
-
1
);
}
}
len
-=
2
;
len
+=
snprintf
(
tags
+
len
,
STRING_LEN
-
len
,
")"
);
superTbls
->
lenOfTagOfOneRow
=
lenOfTagOfOneRow
;
superTbl
->
lenOfTagOfOneRow
=
lenOfTagOfOneRow
;
snprintf
(
command
,
BUFFER_SIZE
,
"create table if not exists %s.%s (ts timestamp%s) tags %s"
,
dbName
,
superTbls
->
sTblName
,
cols
,
tags
);
dbName
,
superTbl
->
sTblName
,
cols
,
tags
);
verbosePrint
(
"%s() LN%d: %s
\n
"
,
__func__
,
__LINE__
,
command
);
if
(
0
!=
queryDbExec
(
taos
,
command
,
NO_INSERT_TYPE
,
false
))
{
errorPrint
(
"create supertable %s failed!
\n\n
"
,
superTbls
->
sTblName
);
superTbl
->
sTblName
);
return
-
1
;
}
debugPrint
(
"create supertable %s success!
\n\n
"
,
superTbls
->
sTblName
);
}
debugPrint
(
"create supertable %s success!
\n\n
"
,
superTbl
->
sTblName
);
return
0
;
}
static
int
createDatabases
()
{
static
int
createDatabases
AndStables
()
{
TAOS
*
taos
=
NULL
;
int
ret
=
0
;
taos
=
taos_connect
(
g_Dbs
.
host
,
g_Dbs
.
user
,
g_Dbs
.
password
,
NULL
,
g_Dbs
.
port
);
...
...
@@ -2434,7 +2447,6 @@ static int createDatabases() {
taos_close
(
taos
);
return
-
1
;
}
}
int
dataLen
=
0
;
dataLen
+=
snprintf
(
command
+
dataLen
,
...
...
@@ -2510,9 +2522,13 @@ static int createDatabases() {
return
-
1
;
}
printf
(
"
\n
create database %s success!
\n\n
"
,
g_Dbs
.
db
[
i
].
dbName
);
}
debugPrint
(
"%s() %d supertbl count:%d
\n
"
,
__func__
,
__LINE__
,
g_Dbs
.
db
[
i
].
superTblCount
);
int
validStbCount
=
0
;
for
(
int
j
=
0
;
j
<
g_Dbs
.
db
[
i
].
superTblCount
;
j
++
)
{
sprintf
(
command
,
"describe %s.%s;"
,
g_Dbs
.
db
[
i
].
dbName
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
sTblName
);
...
...
@@ -2522,12 +2538,11 @@ static int createDatabases() {
if
((
ret
!=
0
)
||
(
g_Dbs
.
db
[
i
].
drop
))
{
ret
=
createSuperTable
(
taos
,
g_Dbs
.
db
[
i
].
dbName
,
&
g_Dbs
.
db
[
i
].
superTbls
[
j
]
,
g_Dbs
.
use_metric
);
&
g_Dbs
.
db
[
i
].
superTbls
[
j
]);
if
(
0
!=
ret
)
{
errorPrint
(
"
\n
create super table %d failed!
\n\n
"
,
j
);
taos_close
(
taos
);
return
-
1
;
errorPrint
(
"create super table %d failed!
\n\n
"
,
j
);
continue
;
}
}
...
...
@@ -2536,10 +2551,13 @@ static int createDatabases() {
if
(
0
!=
ret
)
{
errorPrint
(
"
\n
get super table %s.%s info failed!
\n\n
"
,
g_Dbs
.
db
[
i
].
dbName
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
sTblName
);
taos_close
(
taos
);
return
-
1
;
continue
;
}
validStbCount
++
;
}
g_Dbs
.
db
[
i
].
superTblCount
=
validStbCount
;
}
taos_close
(
taos
);
...
...
@@ -2724,6 +2742,7 @@ static void createChildTables() {
int
len
;
for
(
int
i
=
0
;
i
<
g_Dbs
.
dbCount
;
i
++
)
{
if
(
g_Dbs
.
use_metric
)
{
if
(
g_Dbs
.
db
[
i
].
superTblCount
>
0
)
{
// with super table
for
(
int
j
=
0
;
j
<
g_Dbs
.
db
[
i
].
superTblCount
;
j
++
)
{
...
...
@@ -2746,6 +2765,7 @@ static void createChildTables() {
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblCount
,
g_Dbs
.
db
[
i
].
dbName
,
&
(
g_Dbs
.
db
[
i
].
superTbls
[
j
]));
}
}
}
else
{
// normal table
len
=
snprintf
(
tblColsBuf
,
MAX_SQL_SIZE
,
"(TS TIMESTAMP"
);
...
...
@@ -3552,19 +3572,6 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
goto
PARSE_OVER
;
}
cJSON
*
sampleDataBufSize
=
cJSON_GetObjectItem
(
stbInfo
,
"sample_buf_size"
);
if
(
sampleDataBufSize
&&
sampleDataBufSize
->
type
==
cJSON_Number
)
{
g_Dbs
.
db
[
i
].
superTbls
[
j
].
sampleDataBufSize
=
sampleDataBufSize
->
valueint
;
if
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
sampleDataBufSize
<
1024
*
1024
)
{
g_Dbs
.
db
[
i
].
superTbls
[
j
].
sampleDataBufSize
=
1024
*
1024
+
1024
;
}
}
else
if
(
!
sampleDataBufSize
)
{
g_Dbs
.
db
[
i
].
superTbls
[
j
].
sampleDataBufSize
=
1024
*
1024
+
1024
;
}
else
{
printf
(
"ERROR: failed to read json, sample_buf_size not found
\n
"
);
goto
PARSE_OVER
;
}
cJSON
*
sampleFormat
=
cJSON_GetObjectItem
(
stbInfo
,
"sample_format"
);
if
(
sampleFormat
&&
sampleFormat
->
type
==
cJSON_String
&&
sampleFormat
->
valuestring
!=
NULL
)
{
...
...
@@ -4682,6 +4689,12 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
for
(
int
i
=
0
;
i
<
batchPerTblTimes
;
i
++
)
{
getTableName
(
tableName
,
pThreadInfo
,
tableSeq
);
if
(
0
==
strlen
(
tableName
))
{
errorPrint
(
"[%d] %s() LN%d, getTableName return null
\n
"
,
pThreadInfo
->
threadID
,
__func__
,
__LINE__
);
return
NULL
;
exit
(
-
1
);
}
int
headLen
;
if
(
i
==
0
)
{
...
...
@@ -4728,7 +4741,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
remainderBufLen
-=
dataLen
;
recOfBatch
+=
batchPerTbl
;
startTime
+=
batchPerTbl
*
superTblInfo
->
timeStampStep
;
//
startTime += batchPerTbl * superTblInfo->timeStampStep;
pThreadInfo
->
totalInsertRows
+=
batchPerTbl
;
verbosePrint
(
"[%d] %s() LN%d batchPerTbl=%d recOfBatch=%d
\n
"
,
pThreadInfo
->
threadID
,
__func__
,
__LINE__
,
...
...
@@ -4738,9 +4751,12 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
if
(
insertMode
==
INTERLACE_INSERT_MODE
)
{
if
(
tableSeq
==
pThreadInfo
->
start_table_from
+
pThreadInfo
->
ntables
)
{
// turn to first table
startTime
+=
batchPerTbl
*
superTblInfo
->
timeStampStep
;
tableSeq
=
pThreadInfo
->
start_table_from
;
generatedRecPerTbl
+=
batchPerTbl
;
startTime
=
pThreadInfo
->
start_time
+
generatedRecPerTbl
*
superTblInfo
->
timeStampStep
;
flagSleep
=
true
;
if
(
generatedRecPerTbl
>=
insertRows
)
break
;
...
...
@@ -5137,16 +5153,14 @@ static void startMultiThreadInsertData(int threads, char* db_name,
if
(
superTblInfo
)
{
int
limit
,
offset
;
if
(
superTblInfo
->
childTblOffset
>=
superTblInfo
->
childTblCount
)
{
printf
(
"WARNING: specified offset >= child table count!
\n
"
);
if
(
!
g_args
.
answer_yes
)
{
printf
(
" Press enter key to continue or Ctrl-C to stop
\n\n
"
);
(
void
)
getchar
();
}
if
((
superTblInfo
->
childTblExists
==
TBL_NO_EXISTS
)
&&
((
superTblInfo
->
childTblOffset
!=
0
)
||
(
superTblInfo
->
childTblLimit
!=
0
)))
{
printf
(
"WARNING: offset and limit will not be used since the child tables are not exists!
\n
"
);
}
if
(
superTblInfo
->
childTblOffset
>=
0
)
{
if
(
superTblInfo
->
childTblLimit
<=
0
)
{
if
((
superTblInfo
->
childTblExists
==
TBL_ALREADY_EXISTS
)
&&
(
superTblInfo
->
childTblOffset
>=
0
))
{
if
(
superTblInfo
->
childTblLimit
<
0
)
{
superTblInfo
->
childTblLimit
=
superTblInfo
->
childTblCount
-
superTblInfo
->
childTblOffset
;
}
...
...
@@ -5161,6 +5175,25 @@ static void startMultiThreadInsertData(int threads, char* db_name,
ntables
=
limit
;
startFrom
=
offset
;
if
((
superTblInfo
->
childTblExists
!=
TBL_NO_EXISTS
)
&&
((
superTblInfo
->
childTblOffset
+
superTblInfo
->
childTblLimit
)
>
superTblInfo
->
childTblCount
))
{
printf
(
"WARNING: specified offset + limit > child table count!
\n
"
);
if
(
!
g_args
.
answer_yes
)
{
printf
(
" Press enter key to continue or Ctrl-C to stop
\n\n
"
);
(
void
)
getchar
();
}
}
if
((
superTblInfo
->
childTblExists
!=
TBL_NO_EXISTS
)
&&
(
0
==
superTblInfo
->
childTblLimit
))
{
printf
(
"WARNING: specified limit = 0, which cannot find table name to insert or query!
\n
"
);
if
(
!
g_args
.
answer_yes
)
{
printf
(
" Press enter key to continue or Ctrl-C to stop
\n\n
"
);
(
void
)
getchar
();
}
}
superTblInfo
->
childTblName
=
(
char
*
)
calloc
(
1
,
limit
*
TSDB_TABLE_NAME_LEN
);
if
(
superTblInfo
->
childTblName
==
NULL
)
{
...
...
@@ -5490,7 +5523,7 @@ static int insertTestProcess() {
init_rand_data
();
// create database and super tables
if
(
createDatabases
()
!=
0
)
{
if
(
createDatabases
AndStables
()
!=
0
)
{
fclose
(
g_fpOfInsertResult
);
return
-
1
;
}
...
...
@@ -5518,18 +5551,21 @@ static int insertTestProcess() {
// create sub threads for inserting data
//start = getCurrentTime();
for
(
int
i
=
0
;
i
<
g_Dbs
.
dbCount
;
i
++
)
{
if
(
g_Dbs
.
use_metric
)
{
if
(
g_Dbs
.
db
[
i
].
superTblCount
>
0
)
{
for
(
int
j
=
0
;
j
<
g_Dbs
.
db
[
i
].
superTblCount
;
j
++
)
{
SSuperTable
*
superTblInfo
=
&
g_Dbs
.
db
[
i
].
superTbls
[
j
];
if
(
0
==
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insertRows
)
{
continue
;
}
if
(
superTblInfo
&&
(
superTblInfo
->
insertRows
>
0
))
{
startMultiThreadInsertData
(
g_Dbs
.
threadCount
,
g_Dbs
.
db
[
i
].
dbName
,
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
superTblInfo
);
}
}
}
}
else
{
startMultiThreadInsertData
(
g_Dbs
.
threadCount
,
...
...
src/query/inc/qExecutor.h
浏览文件 @
48c0805f
...
...
@@ -86,7 +86,8 @@ typedef struct SResultRow {
bool
closed
;
// this result status: closed or opened
uint32_t
numOfRows
;
// number of rows of current time window
SResultRowCellInfo
*
pCellInfo
;
// For each result column, there is a resultInfo
union
{
STimeWindow
win
;
char
*
key
;};
// start key of current result row
STimeWindow
win
;
char
*
key
;
// start key of current result row
}
SResultRow
;
typedef
struct
SGroupResInfo
{
...
...
src/query/inc/sql.y
浏览文件 @
48c0805f
...
...
@@ -675,6 +675,7 @@ expr(A) ::= STRING(X). { A = tSqlExprCreateIdValue(&X, TK_STRING);}
expr(A) ::= NOW(X). { A = tSqlExprCreateIdValue(&X, TK_NOW); }
expr(A) ::= VARIABLE(X). { A = tSqlExprCreateIdValue(&X, TK_VARIABLE);}
expr(A) ::= BOOL(X). { A = tSqlExprCreateIdValue(&X, TK_BOOL);}
expr(A) ::= NULL(X). { A = tSqlExprCreateIdValue(&X, TK_NULL);}
// ordinary functions: min(x), max(x), top(k, 20)
expr(A) ::= ID(X) LP exprlist(Y) RP(E). { A = tSqlExprCreateFunction(Y, &X, &E, X.type); }
...
...
src/query/src/qExecutor.c
浏览文件 @
48c0805f
...
...
@@ -200,6 +200,7 @@ static bool isPointInterpoQuery(SQuery *pQuery);
static
void
setResultBufSize
(
SQuery
*
pQuery
,
SRspResultInfo
*
pResultInfo
);
static
void
setCtxTagForJoin
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SQLFunctionCtx
*
pCtx
,
SExprInfo
*
pExprInfo
,
void
*
pTable
);
static
void
setParamForStableStddev
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SQLFunctionCtx
*
pCtx
,
int32_t
numOfOutput
,
SExprInfo
*
pExpr
);
static
void
setParamForStableStddevByColData
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SQLFunctionCtx
*
pCtx
,
int32_t
numOfOutput
,
SExprInfo
*
pExpr
,
char
*
val
,
int16_t
bytes
);
static
void
doSetTableGroupOutputBuf
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SResultRowInfo
*
pResultRowInfo
,
SQLFunctionCtx
*
pCtx
,
int32_t
*
rowCellInfoOffset
,
int32_t
numOfOutput
,
int32_t
groupIndex
);
...
...
@@ -1330,6 +1331,7 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pSDataBlock
->
pDataBlock
,
pInfo
->
colIndex
);
int16_t
bytes
=
pColInfoData
->
info
.
bytes
;
int16_t
type
=
pColInfoData
->
info
.
type
;
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
if
(
type
==
TSDB_DATA_TYPE_FLOAT
||
type
==
TSDB_DATA_TYPE_DOUBLE
)
{
qError
(
"QInfo:%"
PRIu64
" group by not supported on double/float columns, abort"
,
GET_QID
(
pRuntimeEnv
));
...
...
@@ -1350,6 +1352,10 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn
memcpy
(
pInfo
->
prevData
,
val
,
bytes
);
if
(
pQuery
->
stableQuery
&&
pQuery
->
stabledev
&&
(
pRuntimeEnv
->
prevResult
!=
NULL
))
{
setParamForStableStddevByColData
(
pRuntimeEnv
,
pInfo
->
binfo
.
pCtx
,
pOperator
->
numOfOutput
,
pOperator
->
pExpr
,
val
,
bytes
);
}
int32_t
ret
=
setGroupResultOutputBuf
(
pRuntimeEnv
,
pInfo
,
pOperator
->
numOfOutput
,
val
,
type
,
bytes
,
item
->
groupIndex
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
// null data, too many state code
...
...
@@ -1870,14 +1876,15 @@ static void teardownQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv) {
taosHashCleanup
(
pRuntimeEnv
->
pResultRowHashTable
);
pRuntimeEnv
->
pResultRowHashTable
=
NULL
;
pRuntimeEnv
->
pool
=
destroyResultRowPool
(
pRuntimeEnv
->
pool
);
taosArrayDestroyEx
(
pRuntimeEnv
->
prevResult
,
freeInterResult
);
pRuntimeEnv
->
prevResult
=
NULL
;
taosHashCleanup
(
pRuntimeEnv
->
pTableRetrieveTsMap
);
pRuntimeEnv
->
pTableRetrieveTsMap
=
NULL
;
destroyOperatorInfo
(
pRuntimeEnv
->
proot
);
pRuntimeEnv
->
pool
=
destroyResultRowPool
(
pRuntimeEnv
->
pool
);
taosArrayDestroyEx
(
pRuntimeEnv
->
prevResult
,
freeInterResult
);
pRuntimeEnv
->
prevResult
=
NULL
;
}
static
bool
needBuildResAfterQueryComplete
(
SQInfo
*
pQInfo
)
{
...
...
@@ -3396,6 +3403,42 @@ void setParamForStableStddev(SQueryRuntimeEnv* pRuntimeEnv, SQLFunctionCtx* pCtx
}
void
setParamForStableStddevByColData
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SQLFunctionCtx
*
pCtx
,
int32_t
numOfOutput
,
SExprInfo
*
pExpr
,
char
*
val
,
int16_t
bytes
)
{
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
int32_t
numOfExprs
=
pQuery
->
numOfOutput
;
for
(
int32_t
i
=
0
;
i
<
numOfExprs
;
++
i
)
{
SExprInfo
*
pExprInfo
=
&
(
pExpr
[
i
]);
if
(
pExprInfo
->
base
.
functionId
!=
TSDB_FUNC_STDDEV_DST
)
{
continue
;
}
SSqlFuncMsg
*
pFuncMsg
=
&
pExprInfo
->
base
;
pCtx
[
i
].
param
[
0
].
arr
=
NULL
;
pCtx
[
i
].
param
[
0
].
nType
=
TSDB_DATA_TYPE_INT
;
// avoid freeing the memory by setting the type to be int
// TODO use hash to speedup this loop
int32_t
numOfGroup
=
(
int32_t
)
taosArrayGetSize
(
pRuntimeEnv
->
prevResult
);
for
(
int32_t
j
=
0
;
j
<
numOfGroup
;
++
j
)
{
SInterResult
*
p
=
taosArrayGet
(
pRuntimeEnv
->
prevResult
,
j
);
if
(
bytes
==
0
||
memcmp
(
p
->
tags
,
val
,
bytes
)
==
0
)
{
int32_t
numOfCols
=
(
int32_t
)
taosArrayGetSize
(
p
->
pResult
);
for
(
int32_t
k
=
0
;
k
<
numOfCols
;
++
k
)
{
SStddevInterResult
*
pres
=
taosArrayGet
(
p
->
pResult
,
k
);
if
(
pres
->
colId
==
pFuncMsg
->
colInfo
.
colId
)
{
pCtx
[
i
].
param
[
0
].
arr
=
pres
->
pResult
;
break
;
}
}
}
}
}
}
/*
* There are two cases to handle:
*
...
...
@@ -6421,6 +6464,9 @@ void freeQInfo(SQInfo *pQInfo) {
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
releaseQueryBuf
(
pRuntimeEnv
->
tableqinfoGroupInfo
.
numOfTables
);
doDestroyTableQueryInfo
(
&
pRuntimeEnv
->
tableqinfoGroupInfo
);
teardownQueryRuntimeEnv
(
&
pQInfo
->
runtimeEnv
);
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
...
...
@@ -6456,7 +6502,6 @@ void freeQInfo(SQInfo *pQInfo) {
}
}
doDestroyTableQueryInfo
(
&
pRuntimeEnv
->
tableqinfoGroupInfo
);
tfree
(
pQInfo
->
pBuf
);
tfree
(
pQInfo
->
sql
);
...
...
src/query/src/qSqlParser.c
浏览文件 @
48c0805f
...
...
@@ -127,7 +127,12 @@ tSqlExpr *tSqlExprCreateIdValue(SStrToken *pToken, int32_t optrType) {
pSqlExpr
->
token
=
*
pToken
;
}
if
(
optrType
==
TK_INTEGER
||
optrType
==
TK_STRING
||
optrType
==
TK_FLOAT
||
optrType
==
TK_BOOL
)
{
if
(
optrType
==
TK_NULL
)
{
pToken
->
type
=
TSDB_DATA_TYPE_NULL
;
tVariantCreate
(
&
pSqlExpr
->
value
,
pToken
);
pSqlExpr
->
tokenId
=
optrType
;
pSqlExpr
->
type
=
SQL_NODE_VALUE
;
}
else
if
(
optrType
==
TK_INTEGER
||
optrType
==
TK_STRING
||
optrType
==
TK_FLOAT
||
optrType
==
TK_BOOL
)
{
toTSDBType
(
pToken
->
type
);
tVariantCreate
(
&
pSqlExpr
->
value
,
pToken
);
...
...
@@ -356,7 +361,11 @@ void tSqlExprCompact(tSqlExpr** pExpr) {
bool
tSqlExprIsLeaf
(
tSqlExpr
*
pExpr
)
{
return
(
pExpr
->
pRight
==
NULL
&&
pExpr
->
pLeft
==
NULL
)
&&
(
pExpr
->
tokenId
==
0
||
pExpr
->
tokenId
==
TK_ID
||
(
pExpr
->
tokenId
>=
TK_BOOL
&&
pExpr
->
tokenId
<=
TK_NCHAR
)
||
pExpr
->
tokenId
==
TK_SET
);
(
pExpr
->
tokenId
==
0
||
(
pExpr
->
tokenId
==
TK_ID
)
||
(
pExpr
->
tokenId
>=
TK_BOOL
&&
pExpr
->
tokenId
<=
TK_NCHAR
)
||
(
pExpr
->
tokenId
==
TK_NULL
)
||
(
pExpr
->
tokenId
==
TK_SET
));
}
bool
tSqlExprIsParentOfLeaf
(
tSqlExpr
*
pExpr
)
{
...
...
src/query/src/qUtil.c
浏览文件 @
48c0805f
...
...
@@ -66,8 +66,8 @@ void cleanupResultRowInfo(SResultRowInfo *pResultRowInfo) {
return
;
}
if
(
pResultRowInfo
->
type
==
TSDB_DATA_TYPE_BINARY
||
pResultRowInfo
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
for
(
int32_t
i
=
0
;
i
<
pResultRowInfo
->
size
;
++
i
)
{
if
(
pResultRowInfo
->
pResult
[
i
])
{
tfree
(
pResultRowInfo
->
pResult
[
i
]
->
key
);
}
}
...
...
@@ -153,11 +153,8 @@ void clearResultRow(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pResultRow, int16
pResultRow
->
offset
=
-
1
;
pResultRow
->
closed
=
false
;
if
(
type
==
TSDB_DATA_TYPE_BINARY
||
type
==
TSDB_DATA_TYPE_NCHAR
)
{
tfree
(
pResultRow
->
key
);
}
else
{
pResultRow
->
win
=
TSWINDOW_INITIALIZER
;
}
}
// TODO refactor: use macro
...
...
src/query/src/queryMain.c
浏览文件 @
48c0805f
...
...
@@ -372,6 +372,7 @@ int32_t qKillQuery(qinfo_t qinfo) {
return
TSDB_CODE_QRY_INVALID_QHANDLE
;
}
qDebug
(
"QInfo:%"
PRIu64
" query killed"
,
pQInfo
->
qId
);
setQueryKilled
(
pQInfo
);
// Wait for the query executing thread being stopped/
...
...
src/query/src/sql.c
浏览文件 @
48c0805f
此差异已折叠。
点击以展开。
src/sync/inc/syncInt.h
浏览文件 @
48c0805f
...
...
@@ -35,7 +35,7 @@ extern "C" {
#define SYNC_MAX_SIZE (TSDB_MAX_WAL_SIZE + sizeof(SWalHead) + sizeof(SSyncHead) + 16)
#define SYNC_RECV_BUFFER_SIZE (5*1024*1024)
#define SYNC_MAX_FWDS
512
#define SYNC_MAX_FWDS
1024
#define SYNC_FWD_TIMER 300
#define SYNC_ROLE_TIMER 15000 // ms
#define SYNC_CHECK_INTERVAL 1000 // ms
...
...
src/sync/src/syncMain.c
浏览文件 @
48c0805f
...
...
@@ -1459,7 +1459,12 @@ static int32_t syncForwardToPeerImpl(SSyncNode *pNode, void *data, void *mhandle
if
((
pNode
->
quorum
>
1
||
force
)
&&
code
==
0
)
{
code
=
syncSaveFwdInfo
(
pNode
,
pWalHead
->
version
,
mhandle
);
if
(
code
>=
0
)
code
=
1
;
if
(
code
>=
0
)
{
code
=
1
;
}
else
{
pthread_mutex_unlock
(
&
pNode
->
mutex
);
return
code
;
}
}
int32_t
retLen
=
taosWriteMsg
(
pPeer
->
peerFd
,
pSyncHead
,
fwdLen
);
...
...
src/vnode/src/vnodeRead.c
浏览文件 @
48c0805f
...
...
@@ -364,7 +364,7 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
// register the qhandle to connect to quit query immediate if connection is broken
if
(
vnodeNotifyCurrentQhandle
(
pRead
->
rpcHandle
,
pRetrieve
->
qId
,
*
handle
,
pVnode
->
vgId
)
!=
TSDB_CODE_SUCCESS
)
{
vError
(
"vgId:%d, QInfo:%"
PRIu64
"-%p, retrieve discarded since link is broken, %p"
,
pVnode
->
vgId
,
pRetrieve
->
qhandle
,
*
handle
,
pRead
->
rpcHandle
);
vError
(
"vgId:%d, QInfo:%"
PRIu64
"-%p, retrieve discarded since link is broken,
conn:
%p"
,
pVnode
->
vgId
,
pRetrieve
->
qhandle
,
*
handle
,
pRead
->
rpcHandle
);
code
=
TSDB_CODE_RPC_NETWORK_UNAVAIL
;
qKillQuery
(
*
handle
);
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
handle
,
true
);
...
...
@@ -409,7 +409,7 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
// client is broken, the query needs to be killed immediately.
int32_t
vnodeNotifyCurrentQhandle
(
void
*
handle
,
uint64_t
qId
,
void
*
qhandle
,
int32_t
vgId
)
{
SRetrieveTableMsg
*
pMsg
=
rpcMallocCont
(
sizeof
(
SRetrieveTableMsg
));
pMsg
->
q
handle
=
htobe64
((
uint64_t
)
qhandle
);
pMsg
->
q
Id
=
htobe64
(
qId
);
pMsg
->
header
.
vgId
=
htonl
(
vgId
);
pMsg
->
header
.
contLen
=
htonl
(
sizeof
(
SRetrieveTableMsg
));
...
...
src/vnode/src/vnodeWrite.c
浏览文件 @
48c0805f
...
...
@@ -91,13 +91,17 @@ int32_t vnodeProcessWrite(void *vparam, void *wparam, int32_t qtype, void *rpara
int32_t
syncCode
=
0
;
bool
force
=
(
pWrite
==
NULL
?
false
:
pWrite
->
pHead
.
msgType
!=
TSDB_MSG_TYPE_SUBMIT
);
syncCode
=
syncForwardToPeer
(
pVnode
->
sync
,
pHead
,
pWrite
,
qtype
,
force
);
if
(
syncCode
<
0
)
return
syncCode
;
if
(
syncCode
<
0
)
{
pHead
->
version
=
0
;
return
syncCode
;
}
// write into WAL
code
=
walWrite
(
pVnode
->
wal
,
pHead
);
if
(
code
<
0
)
{
if
(
syncCode
>
0
)
atomic_sub_fetch_32
(
&
pWrite
->
processedCount
,
1
);
vError
(
"vgId:%d, hver:%"
PRIu64
" vver:%"
PRIu64
" code:0x%x"
,
pVnode
->
vgId
,
pHead
->
version
,
pVnode
->
version
,
code
);
pHead
->
version
=
0
;
return
code
;
}
...
...
tests/examples/go/taosdemo.go
浏览文件 @
48c0805f
...
...
@@ -16,24 +16,26 @@ package main
import
(
"database/sql"
"flag"
"fmt"
_
"github.com/taosdata/driver-go/taosSql
"
"math/rand
"
"os"
"sync"
"runtime"
"strconv"
"sync"
"time"
"flag"
"math/rand"
_
"github.com/taosdata/driver-go/taosSql"
//"golang.org/x/sys/unix"
)
const
(
maxLocationSize
=
32
maxSqlBufSize
=
65480
//maxSqlBufSize =
65480
)
var
locations
=
[
maxLocationSize
]
string
{
var
locations
=
[
maxLocationSize
]
string
{
"Beijing"
,
"Shanghai"
,
"Guangzhou"
,
"Shenzhen"
,
"HangZhou"
,
"Tianjin"
,
"Wuhan"
,
"Changsha"
,
"Nanjing"
,
"Xian"
}
...
...
@@ -62,7 +64,7 @@ var taosDriverName = "taosSql"
var
url
string
func
init
()
{
flag
.
StringVar
(
&
configPara
.
hostName
,
"h"
,
"127.0.0.1"
,
"The host to connect to TDengine server."
)
flag
.
StringVar
(
&
configPara
.
hostName
,
"h"
,
"127.0.0.1"
,
"The host to connect to TDengine server."
)
flag
.
IntVar
(
&
configPara
.
serverPort
,
"p"
,
6030
,
"The TCP/IP port number to use for the connection to TDengine server."
)
flag
.
StringVar
(
&
configPara
.
user
,
"u"
,
"root"
,
"The TDengine user name to use when connecting to the server."
)
flag
.
StringVar
(
&
configPara
.
password
,
"P"
,
"taosdata"
,
"The password to use when connecting to the server."
)
...
...
@@ -80,7 +82,7 @@ func init() {
configPara
.
supTblName
=
"meters"
startTs
,
err
:=
time
.
ParseInLocation
(
"2006-01-02 15:04:05"
,
configPara
.
startTimestamp
,
time
.
Local
)
if
err
==
nil
{
if
err
==
nil
{
configPara
.
startTs
=
startTs
.
UnixNano
()
/
1e6
}
}
...
...
@@ -104,7 +106,7 @@ func printAllArgs() {
func
main
()
{
printAllArgs
()
fmt
.
Printf
(
"Please press enter key to continue....
\n
"
)
fmt
.
Scanln
()
_
,
_
=
fmt
.
Scanln
()
url
=
"root:taosdata@/tcp("
+
configPara
.
hostName
+
":"
+
strconv
.
Itoa
(
configPara
.
serverPort
)
+
")/"
//url = fmt.Sprintf("%s:%s@/tcp(%s:%d)/%s?interpolateParams=true", configPara.user, configPara.password, configPara.hostName, configPara.serverPort, configPara.dbName)
...
...
@@ -138,7 +140,7 @@ func main() {
func
createDatabase
(
dbName
string
,
supTblName
string
)
{
db
,
err
:=
sql
.
Open
(
taosDriverName
,
url
)
if
err
!=
nil
{
fmt
.
Print
ln
(
"Open database error: %s
\n
"
,
err
)
fmt
.
Print
f
(
"Open database error: %s
\n
"
,
err
)
os
.
Exit
(
1
)
}
defer
db
.
Close
()
...
...
@@ -165,27 +167,27 @@ func createDatabase(dbName string, supTblName string) {
checkErr
(
err
,
sqlStr
)
}
func
multiThreadCreateTable
(
threads
int
,
n
t
ables
int
,
dbName
string
,
tablePrefix
string
)
{
func
multiThreadCreateTable
(
threads
int
,
n
T
ables
int
,
dbName
string
,
tablePrefix
string
)
{
st
:=
time
.
Now
()
.
UnixNano
()
if
(
threads
<
1
)
{
threads
=
1
;
if
threads
<
1
{
threads
=
1
}
a
:=
n
tables
/
threads
;
if
(
a
<
1
)
{
threads
=
n
tables
;
a
=
1
;
a
:=
n
Tables
/
threads
if
a
<
1
{
threads
=
n
Tables
a
=
1
}
b
:=
n
tables
%
threads
;
b
:=
n
Tables
%
threads
last
:=
0
;
last
:=
0
endTblId
:=
0
wg
:=
sync
.
WaitGroup
{}
for
i
:=
0
;
i
<
threads
;
i
++
{
startTblId
:=
last
if
(
i
<
b
)
{
if
i
<
b
{
endTblId
=
last
+
a
}
else
{
endTblId
=
last
+
a
-
1
...
...
@@ -206,7 +208,7 @@ func createTable(dbName string, childTblPrefix string, startTblId int, endTblId
db
,
err
:=
sql
.
Open
(
taosDriverName
,
url
)
if
err
!=
nil
{
fmt
.
Print
ln
(
"Open database error: %s
\n
"
,
err
)
fmt
.
Print
f
(
"Open database error: %s
\n
"
,
err
)
os
.
Exit
(
1
)
}
defer
db
.
Close
()
...
...
@@ -228,20 +230,21 @@ func generateRowData(ts int64) string {
values
:=
"( "
+
strconv
.
FormatInt
(
ts
,
10
)
+
", "
+
strconv
.
FormatFloat
(
float64
(
current
),
'f'
,
6
,
64
)
+
", "
+
strconv
.
Itoa
(
voltage
)
+
", "
+
strconv
.
FormatFloat
(
float64
(
phase
),
'f'
,
6
,
64
)
+
" ) "
return
values
}
func
insertData
(
dbName
string
,
childTblPrefix
string
,
startTblId
int
,
endTblId
int
,
wg
*
sync
.
WaitGroup
)
{
//fmt.Printf("subThread[%d]: insert data to table from %d to %d \n", unix.Gettid(), startTblId, endTblId)
// windows.GetCurrentThreadId()
db
,
err
:=
sql
.
Open
(
taosDriverName
,
url
)
if
err
!=
nil
{
fmt
.
Print
ln
(
"Open database error: %s
\n
"
,
err
)
fmt
.
Print
f
(
"Open database error: %s
\n
"
,
err
)
os
.
Exit
(
1
)
}
defer
db
.
Close
()
tmpTs
:=
configPara
.
startTs
;
tmpTs
:=
configPara
.
startTs
//rand.New(rand.NewSource(time.Now().UnixNano()))
for
tID
:=
startTblId
;
tID
<=
endTblId
;
tID
++
{
for
tID
:=
startTblId
;
tID
<=
endTblId
;
tID
++
{
totalNum
:=
0
for
{
sqlStr
:=
"insert into "
+
dbName
+
"."
+
childTblPrefix
+
strconv
.
Itoa
(
tID
)
+
" values "
...
...
@@ -254,7 +257,7 @@ func insertData(dbName string, childTblPrefix string, startTblId int, endTblId i
sqlStr
=
fmt
.
Sprintf
(
"%s %s"
,
sqlStr
,
valuesOfRow
)
if
(
currRowNum
>=
configPara
.
numOfRecordsPerReq
||
totalNum
>=
configPara
.
numOfRecordsPerTable
)
{
if
currRowNum
>=
configPara
.
numOfRecordsPerReq
||
totalNum
>=
configPara
.
numOfRecordsPerTable
{
break
}
}
...
...
@@ -265,12 +268,12 @@ func insertData(dbName string, childTblPrefix string, startTblId int, endTblId i
count
,
err
:=
res
.
RowsAffected
()
checkErr
(
err
,
"rows affected"
)
if
(
count
!=
int64
(
currRowNum
)
)
{
if
count
!=
int64
(
currRowNum
)
{
fmt
.
Printf
(
"insert data, expect affected:%d, actual:%d
\n
"
,
currRowNum
,
count
)
os
.
Exit
(
1
)
}
if
(
totalNum
>=
configPara
.
numOfRecordsPerTable
)
{
if
totalNum
>=
configPara
.
numOfRecordsPerTable
{
break
}
}
...
...
@@ -279,44 +282,46 @@ func insertData(dbName string, childTblPrefix string, startTblId int, endTblId i
wg
.
Done
()
runtime
.
Goexit
()
}
func
multiThreadInsertData
(
threads
int
,
ntables
int
,
dbName
string
,
tablePrefix
string
)
{
func
multiThreadInsertData
(
threads
int
,
nTables
int
,
dbName
string
,
tablePrefix
string
)
{
st
:=
time
.
Now
()
.
UnixNano
()
if
(
threads
<
1
)
{
threads
=
1
;
if
threads
<
1
{
threads
=
1
}
a
:=
n
tables
/
threads
;
if
(
a
<
1
)
{
threads
=
n
tables
;
a
=
1
;
a
:=
n
Tables
/
threads
if
a
<
1
{
threads
=
n
Tables
a
=
1
}
b
:=
n
tables
%
threads
;
b
:=
n
Tables
%
threads
last
:=
0
;
last
:=
0
endTblId
:=
0
wg
:=
sync
.
WaitGroup
{}
for
i
:=
0
;
i
<
threads
;
i
++
{
startTblId
:=
last
if
(
i
<
b
)
{
if
i
<
b
{
endTblId
=
last
+
a
}
else
{
endTblId
=
last
+
a
-
1
}
last
=
endTblId
+
1
wg
.
Add
(
1
)
go
insertData
(
dbName
,
tablePrefix
,
startTblId
,
endTblId
,
&
wg
)
go
insertData
(
dbName
,
tablePrefix
,
startTblId
,
endTblId
,
&
wg
)
}
wg
.
Wait
()
et
:=
time
.
Now
()
.
UnixNano
()
fmt
.
Printf
(
"insert data spent duration: %6.6fs
\n
"
,
(
float32
(
et
-
st
))
/
1e9
)
}
func
selectTest
(
dbName
string
,
tbPrefix
string
,
supTblName
string
){
func
selectTest
(
dbName
string
,
tbPrefix
string
,
supTblName
string
)
{
db
,
err
:=
sql
.
Open
(
taosDriverName
,
url
)
if
err
!=
nil
{
fmt
.
Print
ln
(
"Open database error: %s
\n
"
,
err
)
fmt
.
Print
f
(
"Open database error: %s
\n
"
,
err
)
os
.
Exit
(
1
)
}
defer
db
.
Close
()
...
...
@@ -352,7 +357,7 @@ func selectTest(dbName string, tbPrefix string, supTblName string){
}
// select sql 2
sqlStr
=
"select avg(voltage), min(voltage), max(voltage) from "
+
dbName
+
"."
+
tbPrefix
+
strconv
.
Itoa
(
rand
.
Int
()
%
configPara
.
numOftables
)
sqlStr
=
"select avg(voltage), min(voltage), max(voltage) from "
+
dbName
+
"."
+
tbPrefix
+
strconv
.
Itoa
(
rand
.
Int
()
%
configPara
.
numOftables
)
rows
,
err
=
db
.
Query
(
sqlStr
)
checkErr
(
err
,
sqlStr
)
...
...
tests/pytest/tools/insert-tblimit-tboffset-createdb.json
0 → 100644
浏览文件 @
48c0805f
{
"filetype"
:
"insert"
,
"cfgdir"
:
"/etc/taos"
,
"host"
:
"127.0.0.1"
,
"port"
:
6030
,
"user"
:
"root"
,
"password"
:
"taosdata"
,
"thread_count"
:
4
,
"thread_count_create_tbl"
:
4
,
"result_file"
:
"./insert_res.txt"
,
"confirm_parameter_prompt"
:
"no"
,
"insert_interval"
:
0
,
"num_of_records_per_req"
:
100
,
"max_sql_len"
:
1024000
,
"databases"
:
[{
"dbinfo"
:
{
"name"
:
"db"
,
"drop"
:
"yes"
,
"replica"
:
1
,
"days"
:
10
,
"cache"
:
16
,
"blocks"
:
8
,
"precision"
:
"ms"
,
"keep"
:
365
,
"minRows"
:
100
,
"maxRows"
:
4096
,
"comp"
:
2
,
"walLevel"
:
1
,
"cachelast"
:
0
,
"quorum"
:
1
,
"fsync"
:
3000
,
"update"
:
0
},
"super_tables"
:
[{
"name"
:
"stb"
,
"child_table_exists"
:
"no"
,
"childtable_count"
:
100
,
"childtable_prefix"
:
"stb_"
,
"auto_create_table"
:
"no"
,
"data_source"
:
"rand"
,
"insert_mode"
:
"taosc"
,
"insert_rows"
:
0
,
"multi_thread_write_one_tbl"
:
"no"
,
"number_of_tbl_in_one_sql"
:
0
,
"max_sql_len"
:
1024000
,
"disorder_ratio"
:
0
,
"disorder_range"
:
1000
,
"timestamp_step"
:
1
,
"start_timestamp"
:
"2020-10-01 00:00:00.000"
,
"sample_format"
:
"csv"
,
"sample_file"
:
"./sample.csv"
,
"tags_file"
:
""
,
"columns"
:
[{
"type"
:
"INT"
},
{
"type"
:
"DOUBLE"
,
"count"
:
10
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
3
},
{
"type"
:
"BINARY"
,
"len"
:
32
,
"count"
:
6
}],
"tags"
:
[{
"type"
:
"TINYINT"
,
"count"
:
2
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
5
}]
}]
}]
}
tests/pytest/tools/insert-tblimit-tboffset-insertrec.json
0 → 100644
浏览文件 @
48c0805f
{
"filetype"
:
"insert"
,
"cfgdir"
:
"/etc/taos"
,
"host"
:
"127.0.0.1"
,
"port"
:
6030
,
"user"
:
"root"
,
"password"
:
"taosdata"
,
"thread_count"
:
4
,
"thread_count_create_tbl"
:
4
,
"result_file"
:
"./insert_res.txt"
,
"confirm_parameter_prompt"
:
"no"
,
"insert_interval"
:
0
,
"num_of_records_per_req"
:
100
,
"max_sql_len"
:
1024000
,
"databases"
:
[{
"dbinfo"
:
{
"name"
:
"db"
,
"drop"
:
"no"
,
"replica"
:
1
,
"days"
:
10
,
"cache"
:
16
,
"blocks"
:
8
,
"precision"
:
"ms"
,
"keep"
:
365
,
"minRows"
:
100
,
"maxRows"
:
4096
,
"comp"
:
2
,
"walLevel"
:
1
,
"cachelast"
:
0
,
"quorum"
:
1
,
"fsync"
:
3000
,
"update"
:
0
},
"super_tables"
:
[{
"name"
:
"stb"
,
"child_table_exists"
:
"yes"
,
"childtable_count"
:
100
,
"childtable_prefix"
:
"stb_"
,
"auto_create_table"
:
"no"
,
"data_source"
:
"rand"
,
"insert_mode"
:
"taosc"
,
"insert_rows"
:
1000
,
"childtable_limit"
:
33
,
"childtable_offset"
:
33
,
"multi_thread_write_one_tbl"
:
"no"
,
"number_of_tbl_in_one_sql"
:
0
,
"max_sql_len"
:
1024000
,
"disorder_ratio"
:
0
,
"disorder_range"
:
1000
,
"timestamp_step"
:
1
,
"start_timestamp"
:
"2020-10-01 00:00:00.000"
,
"sample_format"
:
"csv"
,
"sample_file"
:
"./sample.csv"
,
"tags_file"
:
""
,
"columns"
:
[{
"type"
:
"INT"
},
{
"type"
:
"DOUBLE"
,
"count"
:
10
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
3
},
{
"type"
:
"BINARY"
,
"len"
:
32
,
"count"
:
6
}],
"tags"
:
[{
"type"
:
"TINYINT"
,
"count"
:
2
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
5
}]
}]
}]
}
tests/pytest/tools/insert-tblimit-tboffset0.json
浏览文件 @
48c0805f
...
...
@@ -15,7 +15,7 @@
"databases"
:
[{
"dbinfo"
:
{
"name"
:
"db"
,
"drop"
:
"
yes
"
,
"drop"
:
"
no
"
,
"replica"
:
1
,
"days"
:
10
,
"cache"
:
16
,
...
...
@@ -33,7 +33,7 @@
},
"super_tables"
:
[{
"name"
:
"stb"
,
"child_table_exists"
:
"
no
"
,
"child_table_exists"
:
"
yes
"
,
"childtable_count"
:
100
,
"childtable_prefix"
:
"stb_"
,
"auto_create_table"
:
"no"
,
...
...
tests/pytest/tools/insert-tblimit1-tboffset.json
浏览文件 @
48c0805f
...
...
@@ -15,7 +15,7 @@
"databases"
:
[{
"dbinfo"
:
{
"name"
:
"db"
,
"drop"
:
"
yes
"
,
"drop"
:
"
no
"
,
"replica"
:
1
,
"days"
:
10
,
"cache"
:
16
,
...
...
@@ -33,7 +33,7 @@
},
"super_tables"
:
[{
"name"
:
"stb"
,
"child_table_exists"
:
"
no
"
,
"child_table_exists"
:
"
yes
"
,
"childtable_count"
:
100
,
"childtable_prefix"
:
"stb_"
,
"auto_create_table"
:
"no"
,
...
...
tests/pytest/tools/taosdemo-sampledata.json
浏览文件 @
48c0805f
...
...
@@ -16,8 +16,6 @@
"name"
:
"stb"
,
"child_table_exists"
:
"no"
,
"childtable_count"
:
20
,
"childtable_limit"
:
10
,
"childtable_offset"
:
0
,
"childtable_prefix"
:
"t_"
,
"auto_create_table"
:
"no"
,
"data_source"
:
"sample"
,
...
...
tests/pytest/tools/taosdemoTestLimitOffset.py
浏览文件 @
48c0805f
...
...
@@ -51,7 +51,8 @@ class TDTestCase:
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
os
.
system
(
"%staosdemo -f tools/insert-tblimit-tboffset.json"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/insert-tblimit-tboffset-createdb.json"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/insert-tblimit-tboffset-insertrec.json"
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count(tbname) from db.stb"
)
...
...
@@ -59,6 +60,7 @@ class TDTestCase:
tdSql
.
query
(
"select count(*) from db.stb"
)
tdSql
.
checkData
(
0
,
0
,
33000
)
os
.
system
(
"%staosdemo -f tools/insert-tblimit-tboffset-createdb.json"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/insert-tblimit-tboffset0.json"
%
binPath
)
tdSql
.
execute
(
"reset query cache"
)
...
...
@@ -68,6 +70,7 @@ class TDTestCase:
tdSql
.
query
(
"select count(*) from db.stb"
)
tdSql
.
checkData
(
0
,
0
,
20000
)
os
.
system
(
"%staosdemo -f tools/insert-tblimit-tboffset-createdb.json"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/insert-tblimit1-tboffset.json"
%
binPath
)
tdSql
.
execute
(
"reset query cache"
)
...
...
tests/pytest/tools/taosdemoTestSampleData.py
浏览文件 @
48c0805f
...
...
@@ -57,7 +57,7 @@ class TDTestCase:
tdSql
.
query
(
"select count(tbname) from db.stb"
)
tdSql
.
checkData
(
0
,
0
,
20
)
tdSql
.
query
(
"select count(*) from db.stb"
)
tdSql
.
checkData
(
0
,
0
,
2
00
)
tdSql
.
checkData
(
0
,
0
,
4
00
)
def
stop
(
self
):
tdSql
.
close
()
...
...
tests/script/general/parser/topbot.sim
浏览文件 @
48c0805f
...
...
@@ -325,4 +325,56 @@ if $row != 0 then
return -1
endi
print ===============================>td-3621
sql create table ttm2(ts timestamp, k bool);
sql insert into ttm2 values('2021-1-1 1:1:1', true)
sql insert into ttm2 values('2021-1-1 1:1:2', NULL)
sql insert into ttm2 values('2021-1-1 1:1:3', false)
sql select * from ttm2 where k is not null
if $row != 2 then
return -1
endi
if $data00 != @21-01-01 01:01:01.000@ then
print expect 21-01-01 01:01:01.000, actual $data00
return -1
endi
sql select * from ttm2 where k is null
if $row != 1 then
return -1
endi
if $data00 != @21-01-01 01:01:02.000@ then
return -1
endi
sql select * from ttm2 where k=true
if $row != 1 then
return -1
endi
if $data00 != @21-01-01 01:01:01.000@ then
return -1
endi
sql select * from ttm2 where k=false
if $row != 1 then
return -1
endi
if $data00 != @21-01-01 01:01:03.000@ then
return -1
endi
sql select * from ttm2 where k<>false
if $row != 1 then
return -1
endi
sql_error select * from ttm2 where k=null
sql_error select * from ttm2 where k<>null
sql_error select * from ttm2 where k like null
sql_error select * from ttm2 where k<null
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录