Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Rattenking
TDengine
提交
5a32496f
T
TDengine
项目概览
Rattenking
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
5a32496f
编写于
8月 12, 2021
作者:
wmmhello
提交者:
GitHub
8月 12, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into feature/TD-5918
上级
70f76974
5a3e52ff
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
259 addition
and
23 deletion
+259
-23
packaging/docker/dockerManifest.sh
packaging/docker/dockerManifest.sh
+3
-1
snap/snapcraft.yaml
snap/snapcraft.yaml
+2
-2
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+20
-2
src/query/inc/qUtil.h
src/query/inc/qUtil.h
+2
-2
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+5
-5
src/query/src/qUtil.c
src/query/src/qUtil.c
+12
-0
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+1
-0
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+3
-2
tests/pytest/query/queryTbnameUpperLower.py
tests/pytest/query/queryTbnameUpperLower.py
+78
-0
tests/pytest/query/tbname.py
tests/pytest/query/tbname.py
+3
-0
tests/pytest/tools/taosdemoPerformance.py
tests/pytest/tools/taosdemoPerformance.py
+53
-9
tests/pytest/util/common.py
tests/pytest/util/common.py
+53
-0
tests/script/general/parser/tbnameIn_query.sim
tests/script/general/parser/tbnameIn_query.sim
+24
-0
未找到文件。
packaging/docker/dockerManifest.sh
浏览文件 @
5a32496f
...
...
@@ -44,7 +44,8 @@ echo "version=${version}"
#docker manifest rm tdengine/tdengine
#docker manifest rm tdengine/tdengine:${version}
if
[
"
$verType
"
==
"beta"
]
;
then
docker manifest
rm
tdengine/tdengine:latest
docker manifest inspect tdengine/tdengine-beta:latest
docker manifest
rm
tdengine/tdengine-beta:latest
docker manifest create
-a
tdengine/tdengine-beta:
${
version
}
tdengine/tdengine-amd64-beta:
${
version
}
tdengine/tdengine-aarch64-beta:
${
version
}
tdengine/tdengine-aarch32-beta:
${
version
}
docker manifest create
-a
tdengine/tdengine-beta:latest tdengine/tdengine-amd64-beta:latest tdengine/tdengine-aarch64-beta:latest tdengine/tdengine-aarch32-beta:latest
docker login
-u
tdengine
-p
${
passWord
}
#replace the docker registry username and password
...
...
@@ -52,6 +53,7 @@ if [ "$verType" == "beta" ]; then
docker manifest push tdengine/tdengine-beta:
${
version
}
elif
[
"
$verType
"
==
"stable"
]
;
then
docker manifest inspect tdengine/tdengine:latest
docker manifest
rm
tdengine/tdengine:latest
docker manifest create
-a
tdengine/tdengine:
${
version
}
tdengine/tdengine-amd64:
${
version
}
tdengine/tdengine-aarch64:
${
version
}
tdengine/tdengine-aarch32:
${
version
}
docker manifest create
-a
tdengine/tdengine:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest
...
...
snap/snapcraft.yaml
浏览文件 @
5a32496f
name
:
tdengine
base
:
core18
version
:
'
2.1.
5
.0'
version
:
'
2.1.
6
.0'
icon
:
snap/gui/t-dengine.svg
summary
:
an open-source big data platform designed and optimized for IoT.
description
:
|
...
...
@@ -72,7 +72,7 @@ parts:
-
usr/bin/taosd
-
usr/bin/taos
-
usr/bin/taosdemo
-
usr/lib/libtaos.so.2.1.
5
.0
-
usr/lib/libtaos.so.2.1.
6
.0
-
usr/lib/libtaos.so.1
-
usr/lib/libtaos.so
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
5a32496f
...
...
@@ -246,7 +246,6 @@ typedef struct SArguments_S {
uint32_t
disorderRatio
;
// 0: no disorder, >0: x%
int
disorderRange
;
// ms, us or ns. accordig to database precision
uint32_t
method_of_delete
;
char
**
arg_list
;
uint64_t
totalInsertRows
;
uint64_t
totalAffectedRows
;
bool
demo_mode
;
// use default column name and semi-random data
...
...
@@ -638,7 +637,6 @@ SArguments g_args = {
0
,
// disorderRatio
1000
,
// disorderRange
1
,
// method_of_delete
NULL
,
// arg_list
0
,
// totalInsertRows;
0
,
// totalAffectedRows;
true
,
// demo_mode;
...
...
@@ -6402,6 +6400,9 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
bool
flagSleep
=
true
;
uint64_t
sleepTimeTotal
=
0
;
int
percentComplete
=
0
;
int64_t
totalRows
=
insertRows
*
pThreadInfo
->
ntables
;
while
(
pThreadInfo
->
totalInsertRows
<
pThreadInfo
->
ntables
*
insertRows
)
{
if
((
flagSleep
)
&&
(
insert_interval
))
{
st
=
taosGetTimestampMs
();
...
...
@@ -6578,6 +6579,11 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
pThreadInfo
->
totalAffectedRows
+=
affectedRows
;
int
currentPercent
=
pThreadInfo
->
totalAffectedRows
*
100
/
totalRows
;
if
(
currentPercent
>
percentComplete
)
{
printf
(
"[%d]:%d%%
\n
"
,
pThreadInfo
->
threadID
,
currentPercent
);
percentComplete
=
currentPercent
;
}
int64_t
currentPrintTime
=
taosGetTimestampMs
();
if
(
currentPrintTime
-
lastPrintTime
>
30
*
1000
)
{
printf
(
"thread[%d] has currently inserted rows: %"
PRIu64
", affected rows: %"
PRIu64
"
\n
"
,
...
...
@@ -6599,6 +6605,8 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
}
}
}
if
(
percentComplete
<
100
)
printf
(
"[%d]:%d%%
\n
"
,
pThreadInfo
->
threadID
,
percentComplete
);
free_of_interlace:
tmfree
(
pThreadInfo
->
buffer
);
...
...
@@ -6636,6 +6644,9 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
pThreadInfo
->
samplePos
=
0
;
int
percentComplete
=
0
;
int64_t
totalRows
=
insertRows
*
pThreadInfo
->
ntables
;
for
(
uint64_t
tableSeq
=
pThreadInfo
->
start_table_from
;
tableSeq
<=
pThreadInfo
->
end_table_to
;
tableSeq
++
)
{
...
...
@@ -6741,6 +6752,11 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
pThreadInfo
->
totalAffectedRows
+=
affectedRows
;
int
currentPercent
=
pThreadInfo
->
totalAffectedRows
*
100
/
totalRows
;
if
(
currentPercent
>
percentComplete
)
{
printf
(
"[%d]:%d%%
\n
"
,
pThreadInfo
->
threadID
,
currentPercent
);
percentComplete
=
currentPercent
;
}
int64_t
currentPrintTime
=
taosGetTimestampMs
();
if
(
currentPrintTime
-
lastPrintTime
>
30
*
1000
)
{
printf
(
"thread[%d] has currently inserted rows: %"
PRId64
", affected rows: %"
PRId64
"
\n
"
,
...
...
@@ -6763,6 +6779,8 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
__func__
,
__LINE__
,
pThreadInfo
->
samplePos
);
}
}
// tableSeq
if
(
percentComplete
<
100
)
printf
(
"[%d]:%d%%
\n
"
,
pThreadInfo
->
threadID
,
percentComplete
);
free_of_progressive:
tmfree
(
pThreadInfo
->
buffer
);
...
...
src/query/inc/qUtil.h
浏览文件 @
5a32496f
...
...
@@ -39,7 +39,6 @@
#define GET_QID(_r) (((SQInfo*)((_r)->qinfo))->qId)
#define curTimeWindowIndex(_winres) ((_winres)->curIndex)
#define GET_ROW_PARAM_FOR_MULTIOUTPUT(_q, tbq, sq) (((tbq) && (!(sq)))? (_q)->pExpr1[1].base.param[0].i64:1)
int32_t
getOutputInterResultBufSize
(
SQueryAttr
*
pQueryAttr
);
...
...
@@ -60,6 +59,7 @@ SResultRowCellInfo* getResultCell(const SResultRow* pRow, int32_t index, int32_t
void
*
destroyQueryFuncExpr
(
SExprInfo
*
pExprInfo
,
int32_t
numOfExpr
);
void
*
freeColumnInfo
(
SColumnInfo
*
pColumnInfo
,
int32_t
numOfCols
);
int32_t
getRowNumForMultioutput
(
SQueryAttr
*
pQueryAttr
,
bool
topBottomQuery
,
bool
stable
);
static
FORCE_INLINE
SResultRow
*
getResultRow
(
SResultRowInfo
*
pResultRowInfo
,
int32_t
slot
)
{
assert
(
pResultRowInfo
!=
NULL
&&
slot
>=
0
&&
slot
<
pResultRowInfo
->
size
);
...
...
@@ -70,7 +70,7 @@ static FORCE_INLINE char* getPosInResultPage(SQueryAttr* pQueryAttr, tFilePage*
int32_t
offset
)
{
assert
(
rowOffset
>=
0
&&
pQueryAttr
!=
NULL
);
int32_t
numOfRows
=
(
int32_t
)
GET_ROW_PARAM_FOR_MULTIOUTPUT
(
pQueryAttr
,
pQueryAttr
->
topBotQuery
,
pQueryAttr
->
stableQuery
);
int32_t
numOfRows
=
(
int32_t
)
getRowNumForMultioutput
(
pQueryAttr
,
pQueryAttr
->
topBotQuery
,
pQueryAttr
->
stableQuery
);
return
((
char
*
)
page
->
data
)
+
rowOffset
+
offset
*
numOfRows
;
}
...
...
src/query/src/qExecutor.c
浏览文件 @
5a32496f
...
...
@@ -2706,7 +2706,7 @@ static void getIntermediateBufInfo(SQueryRuntimeEnv* pRuntimeEnv, int32_t* ps, i
SQueryAttr
*
pQueryAttr
=
pRuntimeEnv
->
pQueryAttr
;
int32_t
MIN_ROWS_PER_PAGE
=
4
;
*
rowsize
=
(
int32_t
)(
pQueryAttr
->
resultRowSize
*
GET_ROW_PARAM_FOR_MULTIOUTPUT
(
pQueryAttr
,
pQueryAttr
->
topBotQuery
,
pQueryAttr
->
stableQuery
));
*
rowsize
=
(
int32_t
)(
pQueryAttr
->
resultRowSize
*
getRowNumForMultioutput
(
pQueryAttr
,
pQueryAttr
->
topBotQuery
,
pQueryAttr
->
stableQuery
));
int32_t
overhead
=
sizeof
(
tFilePage
);
// one page contains at least two rows
...
...
@@ -3630,7 +3630,7 @@ void updateOutputBuf(SOptrBasicInfo* pBInfo, int32_t *bufCapacity, int32_t numOf
// re-estabilish output buffer pointer.
int32_t
functionId
=
pBInfo
->
pCtx
[
i
].
functionId
;
if
(
functionId
==
TSDB_FUNC_TOP
||
functionId
==
TSDB_FUNC_BOTTOM
||
functionId
==
TSDB_FUNC_DIFF
||
functionId
==
TSDB_FUNC_DERIVATIVE
)
{
pBInfo
->
pCtx
[
i
].
ptsOutputBuf
=
pBInfo
->
pCtx
[
0
].
pOutput
;
pBInfo
->
pCtx
[
i
].
ptsOutputBuf
=
pBInfo
->
pCtx
[
i
-
1
].
pOutput
;
}
}
}
...
...
@@ -5298,7 +5298,7 @@ SOperatorInfo* createGlobalAggregateOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv,
SMultiwayMergeInfo
*
pInfo
=
calloc
(
1
,
sizeof
(
SMultiwayMergeInfo
));
pInfo
->
resultRowFactor
=
(
int32_t
)(
GET_ROW_PARAM_FOR_MULTIOUTPUT
(
pRuntimeEnv
->
pQueryAttr
,
pRuntimeEnv
->
pQueryAttr
->
topBotQuery
,
false
));
(
int32_t
)(
getRowNumForMultioutput
(
pRuntimeEnv
->
pQueryAttr
,
pRuntimeEnv
->
pQueryAttr
->
topBotQuery
,
false
));
pRuntimeEnv
->
scanFlag
=
MERGE_STAGE
;
// TODO init when creating pCtx
...
...
@@ -6327,7 +6327,7 @@ SOperatorInfo* createAggregateOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOpera
SAggOperatorInfo
*
pInfo
=
calloc
(
1
,
sizeof
(
SAggOperatorInfo
));
SQueryAttr
*
pQueryAttr
=
pRuntimeEnv
->
pQueryAttr
;
int32_t
numOfRows
=
(
int32_t
)(
GET_ROW_PARAM_FOR_MULTIOUTPUT
(
pQueryAttr
,
pQueryAttr
->
topBotQuery
,
pQueryAttr
->
stableQuery
));
int32_t
numOfRows
=
(
int32_t
)(
getRowNumForMultioutput
(
pQueryAttr
,
pQueryAttr
->
topBotQuery
,
pQueryAttr
->
stableQuery
));
pInfo
->
binfo
.
pRes
=
createOutputBuf
(
pExpr
,
numOfOutput
,
numOfRows
);
pInfo
->
binfo
.
pCtx
=
createSQLFunctionCtx
(
pRuntimeEnv
,
pExpr
,
numOfOutput
,
&
pInfo
->
binfo
.
rowCellInfoOffset
);
...
...
@@ -6701,7 +6701,7 @@ SOperatorInfo* createGroupbyOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperato
SQueryAttr
*
pQueryAttr
=
pRuntimeEnv
->
pQueryAttr
;
pQueryAttr
->
resultRowSize
=
(
pQueryAttr
->
resultRowSize
*
(
int32_t
)(
GET_ROW_PARAM_FOR_MULTIOUTPUT
(
pQueryAttr
,
pQueryAttr
->
topBotQuery
,
pQueryAttr
->
stableQuery
)));
(
int32_t
)(
getRowNumForMultioutput
(
pQueryAttr
,
pQueryAttr
->
topBotQuery
,
pQueryAttr
->
stableQuery
)));
pInfo
->
binfo
.
pRes
=
createOutputBuf
(
pExpr
,
numOfOutput
,
pRuntimeEnv
->
resultInfo
.
capacity
);
initResultRowInfo
(
&
pInfo
->
binfo
.
resultRowInfo
,
8
,
TSDB_DATA_TYPE_INT
);
...
...
src/query/src/qUtil.c
浏览文件 @
5a32496f
...
...
@@ -30,6 +30,18 @@ typedef struct SCompSupporter {
int32_t
order
;
}
SCompSupporter
;
int32_t
getRowNumForMultioutput
(
SQueryAttr
*
pQueryAttr
,
bool
topBottomQuery
,
bool
stable
)
{
if
(
pQueryAttr
&&
(
!
stable
))
{
for
(
int16_t
i
=
0
;
i
<
pQueryAttr
->
numOfOutput
;
++
i
)
{
if
(
pQueryAttr
->
pExpr1
[
i
].
base
.
functionId
==
TSDB_FUNC_TOP
||
pQueryAttr
->
pExpr1
[
i
].
base
.
functionId
==
TSDB_FUNC_BOTTOM
)
{
return
(
int32_t
)
pQueryAttr
->
pExpr1
[
i
].
base
.
param
[
0
].
i64
;
}
}
}
return
1
;
}
int32_t
getOutputInterResultBufSize
(
SQueryAttr
*
pQueryAttr
)
{
int32_t
size
=
0
;
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
5a32496f
...
...
@@ -3468,6 +3468,7 @@ void filterPrepare(void* expr, void* param) {
SArray
*
arr
=
(
SArray
*
)(
pCond
->
arr
);
for
(
size_t
i
=
0
;
i
<
taosArrayGetSize
(
arr
);
i
++
)
{
char
*
p
=
taosArrayGetP
(
arr
,
i
);
strtolower
(
varDataVal
(
p
),
varDataVal
(
p
));
taosHashPut
(
pObj
,
varDataVal
(
p
),
varDataLen
(
p
),
&
dummy
,
sizeof
(
dummy
));
}
}
else
{
...
...
tests/pytest/fulltest.sh
浏览文件 @
5a32496f
...
...
@@ -381,8 +381,9 @@ python3 ./test.py -f query/querySession.py
python3 test.py
-f
alter/alter_create_exception.py
python3 ./test.py
-f
insert/flushwhiledrop.py
python3 ./test.py
-f
insert/schemalessInsert.py
python3 ./test.py
-f
alter/alterColMultiTimes.py
python3 ./test.py
-f
query/queryWildcardLength.py
python3 ./test.py
-f
alter/alterColMultiTimes.py
python3 ./test.py
-f
query/queryWildcardLength.py
python3 ./test.py
-f
query/queryTbnameUpperLower.py
#======================p4-end===============
...
...
tests/pytest/query/queryTbnameUpperLower.py
0 → 100644
浏览文件 @
5a32496f
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
from
util.log
import
tdLog
from
util.cases
import
tdCases
from
util.sql
import
tdSql
from
util.common
import
tdCom
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
checkStbWhereIn
(
self
):
'''
where in ---> upper lower mixed
'''
tdCom
.
cleanTb
()
table_name
=
tdCom
.
getLongName
(
8
,
"letters_mixed"
)
table_name_sub
=
f
'
{
table_name
}
_sub'
tb_name_lower
=
table_name_sub
.
lower
()
tb_name_upper
=
table_name_sub
.
upper
()
## create stb and tb
tdSql
.
execute
(
f
'CREATE TABLE
{
table_name
}
(ts timestamp, id int, bi1 binary(20)) tags (si1 binary(20))'
)
tdSql
.
execute
(
f
'create table
{
table_name_sub
}
1 using
{
table_name
}
tags ("
{
table_name_sub
}
1")'
)
tdSql
.
execute
(
f
'create table
{
tb_name_lower
}
2 using
{
table_name
}
tags ("
{
tb_name_lower
}
2")'
)
tdSql
.
execute
(
f
'create table
{
tb_name_upper
}
3 using
{
table_name
}
tags ("
{
tb_name_upper
}
3")'
)
## insert values
tdSql
.
execute
(
f
'insert into
{
table_name_sub
}
1 values (now-1s, 1, "
{
table_name_sub
}
1")'
)
tdSql
.
execute
(
f
'insert into
{
tb_name_lower
}
2 values (now-2s, 2, "
{
tb_name_lower
}
21")'
)
tdSql
.
execute
(
f
'insert into
{
tb_name_lower
}
2 values (now-3s, 3, "
{
tb_name_lower
}
22")'
)
tdSql
.
execute
(
f
'insert into
{
tb_name_upper
}
3 values (now-4s, 4, "
{
tb_name_upper
}
31")'
)
tdSql
.
execute
(
f
'insert into
{
tb_name_upper
}
3 values (now-5s, 5, "
{
tb_name_upper
}
32")'
)
tdSql
.
execute
(
f
'insert into
{
tb_name_upper
}
3 values (now-6s, 6, "
{
tb_name_upper
}
33")'
)
## query where tbname in single
tdSql
.
query
(
f
'select * from
{
table_name
}
where tbname in ("
{
table_name_sub
}
1")'
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
f
'select * from
{
table_name
}
where tbname in ("
{
table_name_sub
.
upper
()
}
1")'
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
f
'select * from
{
table_name
}
where tbname in ("
{
table_name_sub
.
lower
()
}
1")'
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
f
'select * from
{
table_name
}
where tbname in ("
{
tb_name_lower
}
2")'
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
f
'select * from
{
table_name
}
where tbname in ("
{
tb_name_lower
.
upper
()
}
2")'
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
f
'select * from
{
table_name
}
where tbname in ("
{
tb_name_upper
}
3")'
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
f
'select * from
{
table_name
}
where tbname in ("
{
tb_name_upper
.
lower
()
}
3")'
)
tdSql
.
checkRows
(
3
)
## query where tbname in multi
tdSql
.
query
(
f
'select * from
{
table_name
}
where id=5 and tbname in ("
{
table_name_sub
}
1", "
{
tb_name_lower
.
upper
()
}
2", "
{
tb_name_upper
.
lower
()
}
3")'
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
f
'select * from
{
table_name
}
where tbname in ("
{
table_name_sub
}
1", "
{
tb_name_lower
.
upper
()
}
2", "
{
tb_name_upper
.
lower
()
}
3")'
)
tdSql
.
checkRows
(
6
)
def
run
(
self
):
tdSql
.
prepare
()
self
.
checkStbWhereIn
()
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
\ No newline at end of file
tests/pytest/query/tbname.py
浏览文件 @
5a32496f
...
...
@@ -53,6 +53,9 @@ class TDTestCase:
"select * from cars where id=0 and tbname in ('carzero', 'cartwo')"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select * from cars where tbname in ('carZero', 'CARONE')"
)
tdSql
.
checkRows
(
2
)
"""
tdSql.query("select * from cars where tbname like 'car%'")
tdSql.checkRows(2)
...
...
tests/pytest/tools/taosdemoPerformance.py
浏览文件 @
5a32496f
...
...
@@ -19,11 +19,16 @@ import json
import
sys
class
taosdemoPerformace
:
def
__init__
(
self
,
commitID
,
dbName
,
branch
,
type
):
def
__init__
(
self
,
commitID
,
dbName
,
branch
,
type
,
numOfTables
,
numOfRows
,
numOfInt
,
numOfDouble
,
numOfBinary
):
self
.
commitID
=
commitID
self
.
dbName
=
dbName
self
.
branch
=
branch
self
.
type
=
type
self
.
numOfTables
=
numOfTables
self
.
numOfRows
=
numOfRows
self
.
numOfInt
=
numOfInt
self
.
numOfDouble
=
numOfDouble
self
.
numOfBinary
=
numOfBinary
self
.
host
=
"127.0.0.1"
self
.
user
=
"root"
self
.
password
=
"taosdata"
...
...
@@ -51,13 +56,13 @@ class taosdemoPerformace:
stb
=
{
"name"
:
"meters"
,
"child_table_exists"
:
"no"
,
"childtable_count"
:
10000
,
"childtable_count"
:
self
.
numOfTables
,
"childtable_prefix"
:
"stb_"
,
"auto_create_table"
:
"no"
,
"data_source"
:
"rand"
,
"batch_create_tbl_num"
:
10
,
"insert_mode"
:
"taosc"
,
"insert_rows"
:
100000
,
"insert_rows"
:
self
.
numOfRows
,
"interlace_rows"
:
100
,
"max_sql_len"
:
1024000
,
"disorder_ratio"
:
0
,
...
...
@@ -68,7 +73,9 @@ class taosdemoPerformace:
"sample_file"
:
"./sample.csv"
,
"tags_file"
:
""
,
"columns"
:
[
{
"type"
:
"INT"
,
"count"
:
4
}
{
"type"
:
"INT"
,
"count"
:
self
.
numOfInt
},
{
"type"
:
"DOUBLE"
,
"count"
:
self
.
numOfDouble
},
{
"type"
:
"BINARY"
,
"len"
:
128
,
"count"
:
self
.
numOfBinary
}
],
"tags"
:
[
{
"type"
:
"INT"
,
"count"
:
1
},
...
...
@@ -76,6 +83,7 @@ class taosdemoPerformace:
]
}
stables
=
[]
stables
.
append
(
stb
)
...
...
@@ -163,7 +171,7 @@ class taosdemoPerformace:
cursor
.
execute
(
"create database if not exists %s"
%
self
.
dbName
)
cursor
.
execute
(
"use %s"
%
self
.
dbName
)
cursor
.
execute
(
"create table if not exists taosdemo_perf (ts timestamp, create_table_time float, insert_records_time float, records_per_second float, commit_id binary(50), avg_delay float, max_delay float, min_delay float, branch binary(50), type binary(20))"
)
cursor
.
execute
(
"create table if not exists taosdemo_perf (ts timestamp, create_table_time float, insert_records_time float, records_per_second float, commit_id binary(50), avg_delay float, max_delay float, min_delay float, branch binary(50), type binary(20)
, numoftables int, numofrows int, numofint int, numofdouble int, numofbinary int
)"
)
print
(
"==================== taosdemo performance ===================="
)
print
(
"create tables time: %f"
%
float
(
self
.
createTableTime
))
print
(
"insert records time: %f"
%
float
(
self
.
insertRecordsTime
))
...
...
@@ -171,13 +179,14 @@ class taosdemoPerformace:
print
(
"avg delay: %f"
%
float
(
self
.
avgDelay
))
print
(
"max delay: %f"
%
float
(
self
.
maxDelay
))
print
(
"min delay: %f"
%
float
(
self
.
minDelay
))
cursor
.
execute
(
"insert into taosdemo_perf values(now, %f, %f, %f, '%s', %f, %f, %f, '%s', '%s')"
%
cursor
.
execute
(
"insert into taosdemo_perf values(now, %f, %f, %f, '%s', %f, %f, %f, '%s', '%s'
, %d, %d, %d, %d, %d
)"
%
(
float
(
self
.
createTableTime
),
float
(
self
.
insertRecordsTime
),
float
(
self
.
recordsPerSecond
),
self
.
commitID
,
float
(
self
.
avgDelay
),
float
(
self
.
maxDelay
),
float
(
self
.
minDelay
),
self
.
branch
,
self
.
type
))
self
.
commitID
,
float
(
self
.
avgDelay
),
float
(
self
.
maxDelay
),
float
(
self
.
minDelay
),
self
.
branch
,
self
.
type
,
self
.
numOfTables
,
self
.
numOfRows
,
self
.
numOfInt
,
self
.
numOfDouble
,
self
.
numOfBinary
))
cursor
.
close
()
cursor1
=
self
.
conn
.
cursor
()
cursor1
.
execute
(
"drop database if exists %s"
%
self
.
insertDB
)
#
cursor1.execute("drop database if exists %s" % self.insertDB)
cursor1
.
close
()
if
__name__
==
'__main__'
:
...
...
@@ -209,8 +218,43 @@ if __name__ == '__main__':
default
=
'glibc'
,
type
=
str
,
help
=
'build type (default: glibc)'
)
parser
.
add_argument
(
'-i'
,
'--num-of-int'
,
action
=
'store'
,
default
=
4
,
type
=
int
,
help
=
'num of int columns (default: 4)'
)
parser
.
add_argument
(
'-D'
,
'--num-of-double'
,
action
=
'store'
,
default
=
0
,
type
=
int
,
help
=
'num of double columns (default: 4)'
)
parser
.
add_argument
(
'-B'
,
'--num-of-binary'
,
action
=
'store'
,
default
=
0
,
type
=
int
,
help
=
'num of binary columns (default: 4)'
)
parser
.
add_argument
(
'-t'
,
'--num-of-tables'
,
action
=
'store'
,
default
=
10000
,
type
=
int
,
help
=
'num of tables (default: 10000)'
)
parser
.
add_argument
(
'-r'
,
'--num-of-rows'
,
action
=
'store'
,
default
=
100000
,
type
=
int
,
help
=
'num of rows (default: 100000)'
)
args
=
parser
.
parse_args
()
perftest
=
taosdemoPerformace
(
args
.
commit_id
,
args
.
database_name
,
args
.
git_branch
,
args
.
build_type
)
perftest
=
taosdemoPerformace
(
args
.
commit_id
,
args
.
database_name
,
args
.
git_branch
,
args
.
build_type
,
args
.
num_of_tables
,
args
.
num_of_rows
,
args
.
num_of_int
,
args
.
num_of_double
,
args
.
num_of_binary
)
perftest
.
insertData
()
perftest
.
createTablesAndStoreData
()
tests/pytest/util/common.py
0 → 100644
浏览文件 @
5a32496f
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
random
import
string
from
util.sql
import
tdSql
class
TDCom
:
def
init
(
self
,
conn
,
logSql
):
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
cleanTb
(
self
):
query_sql
=
"show stables"
res_row_list
=
tdSql
.
query
(
query_sql
,
True
)
stb_list
=
map
(
lambda
x
:
x
[
0
],
res_row_list
)
for
stb
in
stb_list
:
tdSql
.
execute
(
f
'drop table if exists
{
stb
}
'
)
query_sql
=
"show tables"
res_row_list
=
tdSql
.
query
(
query_sql
,
True
)
tb_list
=
map
(
lambda
x
:
x
[
0
],
res_row_list
)
for
tb
in
tb_list
:
tdSql
.
execute
(
f
'drop table if exists
{
tb
}
'
)
def
getLongName
(
self
,
len
,
mode
=
"mixed"
):
"""
generate long name
mode could be numbers/letters/letters_mixed/mixed
"""
if
mode
==
"numbers"
:
chars
=
''
.
join
(
random
.
choice
(
string
.
digits
)
for
i
in
range
(
len
))
elif
mode
==
"letters"
:
chars
=
''
.
join
(
random
.
choice
(
string
.
ascii_letters
.
lower
())
for
i
in
range
(
len
))
elif
mode
==
"letters_mixed"
:
chars
=
''
.
join
(
random
.
choice
(
string
.
ascii_letters
.
upper
()
+
string
.
ascii_letters
.
lower
())
for
i
in
range
(
len
))
else
:
chars
=
''
.
join
(
random
.
choice
(
string
.
ascii_letters
.
lower
()
+
string
.
digits
)
for
i
in
range
(
len
))
return
chars
def
close
(
self
):
self
.
cursor
.
close
()
tdCom
=
TDCom
()
\ No newline at end of file
tests/script/general/parser/tbnameIn_query.sim
浏览文件 @
5a32496f
...
...
@@ -101,6 +101,30 @@ if $data11 != 2 then
return -1
endi
## tbname in can accpet Upper case table name
sql select count(*) from $stb where tbname in ('ti_tb0', 'TI_tb1', 'TI_TB2') group by t1 order by t1
if $rows != 3 then
return -1
endi
if $data00 != 10 then
return -1
endi
if $data01 != 0 then
return -1
endi
if $data10 != 10 then
return -1
endi
if $data11 != 1 then
return -1
endi
if $data20 != 10 then
return -1
endi
if $data21 != 2 then
return -1
endi
# multiple tbname in is not allowed NOW
sql_error select count(*) from $stb where tbname in ('ti_tb1', 'ti_tb300') and tbname in ('ti_tb5', 'ti_tb1000') group by t1 order by t1 asc
#if $rows != 4 then
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录