Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
6ba66d58
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看板
提交
6ba66d58
编写于
3月 13, 2021
作者:
sangshuduo
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into hotfix/sangshuduo/TD-3215-bus-error-arm32
上级
63dde6ec
3b2827d8
变更
77
展开全部
显示空白变更内容
内联
并排
Showing
77 changed file
with
6788 addition
and
6860 deletion
+6788
-6860
Jenkinsfile
Jenkinsfile
+1
-2
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+1
-0
src/client/src/tscLocalMerge.c
src/client/src/tscLocalMerge.c
+8
-4
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+245
-318
src/client/src/tscServer.c
src/client/src/tscServer.c
+40
-24
src/client/src/tscSub.c
src/client/src/tscSub.c
+13
-3
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+20
-29
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+25
-4
src/common/inc/tname.h
src/common/inc/tname.h
+1
-1
src/connector/python/linux/python2/setup.py
src/connector/python/linux/python2/setup.py
+1
-1
src/connector/python/linux/python2/taos/cinterface.py
src/connector/python/linux/python2/taos/cinterface.py
+8
-8
src/connector/python/linux/python3/setup.py
src/connector/python/linux/python3/setup.py
+1
-1
src/connector/python/linux/python3/taos/cinterface.py
src/connector/python/linux/python3/taos/cinterface.py
+8
-8
src/connector/python/linux/python3/taos/cursor.py
src/connector/python/linux/python3/taos/cursor.py
+0
-14
src/connector/python/osx/python3/setup.py
src/connector/python/osx/python3/setup.py
+1
-1
src/connector/python/osx/python3/taos/cinterface.py
src/connector/python/osx/python3/taos/cinterface.py
+8
-8
src/connector/python/osx/python3/taos/cursor.py
src/connector/python/osx/python3/taos/cursor.py
+0
-14
src/connector/python/windows/python2/setup.py
src/connector/python/windows/python2/setup.py
+1
-1
src/connector/python/windows/python2/taos/cinterface.py
src/connector/python/windows/python2/taos/cinterface.py
+8
-8
src/connector/python/windows/python2/taos/cursor.py
src/connector/python/windows/python2/taos/cursor.py
+0
-2
src/connector/python/windows/python3/setup.py
src/connector/python/windows/python3/setup.py
+1
-1
src/connector/python/windows/python3/taos/cinterface.py
src/connector/python/windows/python3/taos/cinterface.py
+8
-8
src/connector/python/windows/python3/taos/cursor.py
src/connector/python/windows/python3/taos/cursor.py
+0
-2
src/inc/taoserror.h
src/inc/taoserror.h
+1
-1
src/inc/taosmsg.h
src/inc/taosmsg.h
+4
-1
src/inc/tsdb.h
src/inc/tsdb.h
+29
-13
src/inc/ttokendef.h
src/inc/ttokendef.h
+12
-46
src/inc/ttype.h
src/inc/ttype.h
+4
-4
src/kit/taosdemo/insert.json
src/kit/taosdemo/insert.json
+4
-1
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+856
-717
src/plugins/http/inc/httpJson.h
src/plugins/http/inc/httpJson.h
+2
-0
src/plugins/http/src/httpJson.c
src/plugins/http/src/httpJson.c
+12
-0
src/plugins/http/src/httpRestJson.c
src/plugins/http/src/httpRestJson.c
+12
-0
src/query/inc/qAggMain.h
src/query/inc/qAggMain.h
+21
-13
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+193
-88
src/query/inc/qFill.h
src/query/inc/qFill.h
+4
-2
src/query/inc/qResultbuf.h
src/query/inc/qResultbuf.h
+2
-11
src/query/inc/qSqlparser.h
src/query/inc/qSqlparser.h
+21
-18
src/query/inc/qTsbuf.h
src/query/inc/qTsbuf.h
+2
-4
src/query/inc/qUtil.h
src/query/inc/qUtil.h
+10
-14
src/query/inc/sql.y
src/query/inc/sql.y
+1
-2
src/query/src/qAggMain.c
src/query/src/qAggMain.c
+327
-92
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+2777
-3622
src/query/src/qFill.c
src/query/src/qFill.c
+49
-22
src/query/src/qParserImpl.c
src/query/src/qParserImpl.c
+57
-45
src/query/src/qPercentile.c
src/query/src/qPercentile.c
+1
-1
src/query/src/qResultbuf.c
src/query/src/qResultbuf.c
+1
-5
src/query/src/qTokenizer.c
src/query/src/qTokenizer.c
+43
-69
src/query/src/qUtil.c
src/query/src/qUtil.c
+104
-26
src/query/src/queryMain.c
src/query/src/queryMain.c
+28
-35
src/query/src/sql.c
src/query/src/sql.c
+888
-1255
src/query/tests/resultBufferTest.cpp
src/query/tests/resultBufferTest.cpp
+3
-3
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+476
-221
src/util/inc/tarray.h
src/util/inc/tarray.h
+2
-1
src/util/inc/tbuffer.h
src/util/inc/tbuffer.h
+2
-2
tests/pytest/crash_gen/crash_gen_main.py
tests/pytest/crash_gen/crash_gen_main.py
+1
-1
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+1
-0
tests/pytest/functions/function_stddev.py
tests/pytest/functions/function_stddev.py
+29
-0
tests/pytest/query/queryBetweenAnd.py
tests/pytest/query/queryBetweenAnd.py
+206
-0
tests/pytest/tools/taosdemoTestWithoutMetric.py
tests/pytest/tools/taosdemoTestWithoutMetric.py
+72
-0
tests/script/general/cache/new_metrics.sim
tests/script/general/cache/new_metrics.sim
+3
-2
tests/script/general/cache/restart_metrics.sim
tests/script/general/cache/restart_metrics.sim
+1
-1
tests/script/general/cache/restart_table.sim
tests/script/general/cache/restart_table.sim
+2
-3
tests/script/general/db/topic1.sim
tests/script/general/db/topic1.sim
+4
-15
tests/script/general/parser/col_arithmetic_operation.sim
tests/script/general/parser/col_arithmetic_operation.sim
+1
-0
tests/script/general/parser/col_arithmetic_query.sim
tests/script/general/parser/col_arithmetic_query.sim
+31
-31
tests/script/general/parser/fill.sim
tests/script/general/parser/fill.sim
+1
-4
tests/script/general/parser/function.sim
tests/script/general/parser/function.sim
+17
-1
tests/script/general/parser/groupby.sim
tests/script/general/parser/groupby.sim
+5
-0
tests/script/general/parser/interp_test.sim
tests/script/general/parser/interp_test.sim
+1
-1
tests/script/general/parser/join.sim
tests/script/general/parser/join.sim
+1
-0
tests/script/general/parser/lastrow_query.sim
tests/script/general/parser/lastrow_query.sim
+4
-1
tests/script/general/parser/limit1_stb.sim
tests/script/general/parser/limit1_stb.sim
+1
-0
tests/script/general/parser/testSuite.sim
tests/script/general/parser/testSuite.sim
+3
-0
tests/script/general/parser/topbot.sim
tests/script/general/parser/topbot.sim
+54
-0
tests/script/general/stream/restart_stream.sim
tests/script/general/stream/restart_stream.sim
+3
-2
tests/script/jenkins/basic_1.txt
tests/script/jenkins/basic_1.txt
+0
-2
未找到文件。
Jenkinsfile
浏览文件 @
6ba66d58
...
...
@@ -46,6 +46,7 @@ def pre_test(){
git fetch origin +refs/pull/${CHANGE_ID}/merge
git checkout -qf FETCH_HEAD
git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD develop)|grep -v -E '.*md|//src//connector|Jenkinsfile' || exit 0
find ${WKC}/tests/pytest -name \'*\'.sql -exec rm -rf {} \\;
cd ${WK}
git reset --hard HEAD~10
git checkout develop
...
...
@@ -115,7 +116,6 @@ pipeline {
sh
'''
date
cd ${WKC}/tests
find pytest -name '*'sql|xargs rm -rf
./test-all.sh p1
date'''
}
...
...
@@ -131,7 +131,6 @@ pipeline {
sh
'''
date
cd ${WKC}/tests
find pytest -name '*'sql|xargs rm -rf
./test-all.sh p2
date'''
}
...
...
src/client/inc/tscUtil.h
浏览文件 @
6ba66d58
...
...
@@ -133,6 +133,7 @@ bool tscIsProjectionQuery(SQueryInfo* pQueryInfo);
bool
tscIsTwoStageSTableQuery
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
);
bool
tscQueryTags
(
SQueryInfo
*
pQueryInfo
);
bool
tscMultiRoundQuery
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
);
bool
tscQueryBlockInfo
(
SQueryInfo
*
pQueryInfo
);
SSqlExpr
*
tscAddFuncInSelectClause
(
SQueryInfo
*
pQueryInfo
,
int32_t
outputColIndex
,
int16_t
functionId
,
SColumnIndex
*
pIndex
,
SSchema
*
pColSchema
,
int16_t
colType
);
...
...
src/client/src/tscLocalMerge.c
浏览文件 @
6ba66d58
...
...
@@ -100,6 +100,10 @@ static void tscInitSqlContext(SSqlCmd *pCmd, SLocalMerger *pReducer, tOrderDescr
}
else
if
(
functionId
==
TSDB_FUNC_APERCT
)
{
pCtx
->
param
[
0
].
i64
=
pExpr
->
param
[
0
].
i64
;
pCtx
->
param
[
0
].
nType
=
pExpr
->
param
[
0
].
nType
;
}
else
if
(
functionId
==
TSDB_FUNC_BLKINFO
)
{
pCtx
->
param
[
0
].
i64
=
pExpr
->
param
[
0
].
i64
;
pCtx
->
param
[
0
].
nType
=
pExpr
->
param
[
0
].
nType
;
pCtx
->
numOfParams
=
1
;
}
pCtx
->
interBufBytes
=
pExpr
->
interBytes
;
...
...
@@ -951,10 +955,10 @@ static void doFillResult(SSqlObj *pSql, SLocalMerger *pLocalMerge, bool doneOutp
// todo extract function
int64_t
actualETime
=
(
pQueryInfo
->
order
.
order
==
TSDB_ORDER_ASC
)
?
pQueryInfo
->
window
.
ekey
:
pQueryInfo
->
window
.
skey
;
tFilePage
**
pResPages
=
malloc
(
POINTER_BYTES
*
pQueryInfo
->
fieldsInfo
.
numOfOutput
);
void
**
pResPages
=
malloc
(
POINTER_BYTES
*
pQueryInfo
->
fieldsInfo
.
numOfOutput
);
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
fieldsInfo
.
numOfOutput
;
++
i
)
{
TAOS_FIELD
*
pField
=
tscFieldInfoGetField
(
&
pQueryInfo
->
fieldsInfo
,
i
);
pResPages
[
i
]
=
calloc
(
1
,
sizeof
(
tFilePage
)
+
pField
->
bytes
*
pLocalMerge
->
resColModel
->
capacity
);
pResPages
[
i
]
=
calloc
(
1
,
pField
->
bytes
*
pLocalMerge
->
resColModel
->
capacity
);
}
while
(
1
)
{
...
...
@@ -966,7 +970,7 @@ static void doFillResult(SSqlObj *pSql, SLocalMerger *pLocalMerge, bool doneOutp
if
(
pQueryInfo
->
limit
.
offset
>
0
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
fieldsInfo
.
numOfOutput
;
++
i
)
{
TAOS_FIELD
*
pField
=
tscFieldInfoGetField
(
&
pQueryInfo
->
fieldsInfo
,
i
);
memmove
(
pResPages
[
i
]
->
data
,
pResPages
[
i
]
->
data
+
pField
->
bytes
*
pQueryInfo
->
limit
.
offset
,
memmove
(
pResPages
[
i
]
,
((
char
*
)
pResPages
[
i
])
+
pField
->
bytes
*
pQueryInfo
->
limit
.
offset
,
(
size_t
)(
newRows
*
pField
->
bytes
));
}
}
...
...
@@ -1010,7 +1014,7 @@ static void doFillResult(SSqlObj *pSql, SLocalMerger *pLocalMerge, bool doneOutp
int32_t
offset
=
0
;
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
fieldsInfo
.
numOfOutput
;
++
i
)
{
TAOS_FIELD
*
pField
=
tscFieldInfoGetField
(
&
pQueryInfo
->
fieldsInfo
,
i
);
memcpy
(
pRes
->
data
+
offset
*
pRes
->
numOfRows
,
pResPages
[
i
]
->
data
,
(
size_t
)(
pField
->
bytes
*
pRes
->
numOfRows
));
memcpy
(
pRes
->
data
+
offset
*
pRes
->
numOfRows
,
pResPages
[
i
],
(
size_t
)(
pField
->
bytes
*
pRes
->
numOfRows
));
offset
+=
pField
->
bytes
;
}
...
...
src/client/src/tscSQLParser.c
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
src/client/src/tscServer.c
浏览文件 @
6ba66d58
...
...
@@ -497,8 +497,6 @@ int tscProcessSql(SSqlObj *pSql) {
return
pSql
->
res
.
code
;
}
}
else
if
(
pCmd
->
command
>=
TSDB_SQL_LOCAL
)
{
//pSql->epSet = tscMgmtEpSet;
// } else { // local handler
return
(
*
tscProcessMsgRsp
[
pCmd
->
command
])(
pSql
);
}
...
...
@@ -705,7 +703,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
size_t
numOfSrcCols
=
taosArrayGetSize
(
pQueryInfo
->
colList
);
if
(
numOfSrcCols
<=
0
&&
!
tscQueryTags
(
pQueryInfo
))
{
if
(
numOfSrcCols
<=
0
&&
!
tscQueryTags
(
pQueryInfo
)
&&
!
tscQueryBlockInfo
(
pQueryInfo
)
)
{
tscError
(
"%p illegal value of numOfCols in query msg: %"
PRIu64
", table cols:%d"
,
pSql
,
(
uint64_t
)
numOfSrcCols
,
tscGetNumOfColumns
(
pTableMeta
));
...
...
@@ -835,13 +833,31 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pSqlFuncExpr
->
colInfo
.
colIndex
=
htons
(
pExpr
->
colInfo
.
colIndex
);
pSqlFuncExpr
->
colInfo
.
flag
=
htons
(
pExpr
->
colInfo
.
flag
);
if
(
TSDB_COL_IS_UD_COL
(
pExpr
->
colInfo
.
flag
))
{
pSqlFuncExpr
->
colType
=
htons
(
pExpr
->
resType
);
pSqlFuncExpr
->
colBytes
=
htons
(
pExpr
->
resBytes
);
}
else
if
(
pExpr
->
colInfo
.
colId
==
TSDB_TBNAME_COLUMN_INDEX
)
{
SSchema
*
s
=
tGetTbnameColumnSchema
();
pSqlFuncExpr
->
colType
=
htons
(
s
->
type
);
pSqlFuncExpr
->
colBytes
=
htons
(
s
->
bytes
);
}
else
if
(
pExpr
->
colInfo
.
colId
==
TSDB_BLOCK_DIST_COLUMN_INDEX
)
{
SSchema
s
=
tGetBlockDistColumnSchema
();
pSqlFuncExpr
->
colType
=
htons
(
s
.
type
);
pSqlFuncExpr
->
colBytes
=
htons
(
s
.
bytes
);
}
else
{
SSchema
*
s
=
tscGetColumnSchemaById
(
pTableMeta
,
pExpr
->
colInfo
.
colId
);
pSqlFuncExpr
->
colType
=
htons
(
s
->
type
);
pSqlFuncExpr
->
colBytes
=
htons
(
s
->
bytes
);
}
pSqlFuncExpr
->
functionId
=
htons
(
pExpr
->
functionId
);
pSqlFuncExpr
->
numOfParams
=
htons
(
pExpr
->
numOfParams
);
pSqlFuncExpr
->
resColId
=
htons
(
pExpr
->
resColId
);
pMsg
+=
sizeof
(
SSqlFuncMsg
);
for
(
int32_t
j
=
0
;
j
<
pExpr
->
numOfParams
;
++
j
)
{
// todo add log
for
(
int32_t
j
=
0
;
j
<
pExpr
->
numOfParams
;
++
j
)
{
// todo add log
pSqlFuncExpr
->
arg
[
j
].
argType
=
htons
((
uint16_t
)
pExpr
->
param
[
j
].
nType
);
pSqlFuncExpr
->
arg
[
j
].
argBytes
=
htons
(
pExpr
->
param
[
j
].
nLen
);
...
...
@@ -866,6 +882,8 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
for
(
int32_t
i
=
0
;
i
<
output
;
++
i
)
{
SInternalField
*
pField
=
tscFieldInfoGetInternalField
(
&
pQueryInfo
->
fieldsInfo
,
i
);
SSqlExpr
*
pExpr
=
pField
->
pSqlExpr
;
// this should be switched to projection query
if
(
pExpr
!=
NULL
)
{
// the queried table has been removed and a new table with the same name has already been created already
// return error msg
...
...
@@ -879,27 +897,25 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
return
TSDB_CODE_TSC_INVALID_SQL
;
}
pSqlFuncExpr1
->
colInfo
.
colId
=
htons
(
pExpr
->
colInfo
.
colId
);
pSqlFuncExpr1
->
colInfo
.
colIndex
=
htons
(
pExpr
->
colInfo
.
colIndex
);
pSqlFuncExpr1
->
colInfo
.
flag
=
htons
(
pExpr
->
colInfo
.
flag
);
pSqlFuncExpr1
->
functionId
=
htons
(
pExpr
->
functionId
);
pSqlFuncExpr1
->
numOfParams
=
htons
(
pExpr
->
numOfParams
);
pMsg
+=
sizeof
(
SSqlFuncMsg
);
pSqlFuncExpr1
->
numOfParams
=
0
;
// no params for projection query
pSqlFuncExpr1
->
functionId
=
htons
(
TSDB_FUNC_PRJ
);
pSqlFuncExpr1
->
colInfo
.
colId
=
htons
(
pExpr
->
resColId
);
pSqlFuncExpr1
->
colInfo
.
flag
=
htons
(
TSDB_COL_NORMAL
);
for
(
int32_t
j
=
0
;
j
<
pExpr
->
numOfParams
;
++
j
)
{
// todo add log
pSqlFuncExpr1
->
arg
[
j
].
argType
=
htons
((
uint16_t
)
pExpr
->
param
[
j
].
nType
);
pSqlFuncExpr1
->
arg
[
j
].
argBytes
=
htons
(
pExpr
->
param
[
j
].
nLen
);
if
(
pExpr
->
param
[
j
].
nType
==
TSDB_DATA_TYPE_BINARY
)
{
memcpy
(
pMsg
,
pExpr
->
param
[
j
].
pz
,
pExpr
->
param
[
j
].
nLen
);
pMsg
+=
pExpr
->
param
[
j
].
nLen
;
}
else
{
pSqlFuncExpr1
->
arg
[
j
].
argValue
.
i64
=
htobe64
(
pExpr
->
param
[
j
].
i64
);
bool
assign
=
false
;
for
(
int32_t
f
=
0
;
f
<
tscSqlExprNumOfExprs
(
pQueryInfo
);
++
f
)
{
SSqlExpr
*
pe
=
tscSqlExprGet
(
pQueryInfo
,
f
);
if
(
pe
==
pExpr
)
{
pSqlFuncExpr1
->
colInfo
.
colIndex
=
htons
(
f
);
pSqlFuncExpr1
->
colType
=
htons
(
pe
->
resType
);
pSqlFuncExpr1
->
colBytes
=
htons
(
pe
->
resBytes
);
assign
=
true
;
break
;
}
}
assert
(
assign
);
pMsg
+=
sizeof
(
SSqlFuncMsg
);
pSqlFuncExpr1
=
(
SSqlFuncMsg
*
)
pMsg
;
}
else
{
assert
(
pField
->
pArithExprInfo
!=
NULL
);
...
...
src/client/src/tscSub.c
浏览文件 @
6ba66d58
...
...
@@ -503,9 +503,19 @@ TAOS_RES *taos_consume(TAOS_SUB *tsub) {
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
if
(
taosArrayGetSize
(
pSub
->
progress
)
>
0
)
{
// fix crash in single tabel subscription
pQueryInfo
->
window
.
skey
=
((
SSubscriptionProgress
*
)
taosArrayGet
(
pSub
->
progress
,
0
))
->
key
;
tscDebug
(
"subscribe:%s set subscribe skey:%"
PRId64
,
pSub
->
topic
,
pQueryInfo
->
window
.
skey
);
if
(
taosArrayGetSize
(
pSub
->
progress
)
>
0
)
{
// fix crash in single table subscription
size_t
size
=
taosArrayGetSize
(
pSub
->
progress
);
TSKEY
s
=
INT64_MAX
;
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
TSKEY
k
=
((
SSubscriptionProgress
*
)
taosArrayGet
(
pSub
->
progress
,
i
))
->
key
;
if
(
s
>
k
)
{
s
=
k
;
}
}
pQueryInfo
->
window
.
skey
=
s
;
tscDebug
(
"subscribe:%s set next round subscribe skey:%"
PRId64
,
pSub
->
topic
,
pQueryInfo
->
window
.
skey
);
}
if
(
pSub
->
pTimer
==
NULL
)
{
...
...
src/client/src/tscSubquery.c
浏览文件 @
6ba66d58
...
...
@@ -74,14 +74,14 @@ static bool allSubqueryDone(SSqlObj *pParentSql) {
SSubqueryState
*
subState
=
&
pParentSql
->
subState
;
//lock in caller
tscDebug
(
"%p total subqueries: %d"
,
pParentSql
,
subState
->
numOfSub
);
for
(
int
i
=
0
;
i
<
subState
->
numOfSub
;
i
++
)
{
if
(
0
==
subState
->
states
[
i
])
{
tscDebug
(
"%p subquery:%p,
%d is NOT finished, total:%d"
,
pParentSql
,
pParentSql
->
pSubs
[
i
],
i
,
subState
->
numOfSub
);
tscDebug
(
"%p subquery:%p,
index: %d NOT finished, abort query completion check"
,
pParentSql
,
pParentSql
->
pSubs
[
i
],
i
);
done
=
false
;
break
;
}
else
{
tscDebug
(
"%p subquery:%p,
%d is finished, total:%d"
,
pParentSql
,
pParentSql
->
pSubs
[
i
],
i
,
subState
->
numOfSub
);
tscDebug
(
"%p subquery:%p,
index: %d finished"
,
pParentSql
,
pParentSql
->
pSubs
[
i
],
i
);
}
}
...
...
@@ -453,7 +453,7 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) {
pSubQueryInfo
->
tsBuf
=
NULL
;
// free result for async object will also free sqlObj
assert
(
tscSqlExprNumOfExprs
(
pSubQueryInfo
)
==
1
);
// ts_comp query only requires one resu
tl
columns
assert
(
tscSqlExprNumOfExprs
(
pSubQueryInfo
)
==
1
);
// ts_comp query only requires one resu
lt
columns
taos_free_result
(
pPrevSub
);
SSqlObj
*
pNew
=
createSubqueryObj
(
pSql
,
(
int16_t
)
i
,
tscJoinQueryCallback
,
pSupporter
,
TSDB_SQL_SELECT
,
NULL
);
...
...
@@ -507,6 +507,7 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) {
SSqlExpr
*
pExpr
=
tscSqlExprGet
(
pQueryInfo
,
0
);
int16_t
funcId
=
pExpr
->
functionId
;
// add the invisible timestamp column
if
((
pExpr
->
colInfo
.
colId
!=
PRIMARYKEY_TIMESTAMP_COL_INDEX
)
||
(
funcId
!=
TSDB_FUNC_TS
&&
funcId
!=
TSDB_FUNC_TS_DUMMY
&&
funcId
!=
TSDB_FUNC_PRJ
))
{
...
...
@@ -847,6 +848,8 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
SSqlRes
*
pRes
=
&
pSql
->
res
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
// todo, the type may not include TSDB_QUERY_TYPE_TAG_FILTER_QUERY
assert
(
TSDB_QUERY_HAS_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_TAG_FILTER_QUERY
));
if
(
pParentSql
->
res
.
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -1880,6 +1883,13 @@ void doAppendData(SInterResult* pInterResult, TAOS_ROW row, int32_t numOfCols, S
}
}
if
(
p
&&
taosArrayGetSize
(
p
)
>
0
)
{
SResPair
*
l
=
taosArrayGetLast
(
p
);
if
(
l
->
key
==
key
&&
key
==
INT64_MIN
)
{
continue
;
}
}
//append a new column
if
(
p
==
NULL
)
{
SStddevInterResult
t
=
{.
colId
=
id
,
.
pResult
=
taosArrayInit
(
10
,
sizeof
(
SResPair
)),};
...
...
@@ -2643,6 +2653,11 @@ static SSqlObj *tscCreateSTableSubquery(SSqlObj *pSql, SRetrieveSupport *trsuppo
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pNew
->
cmd
,
0
);
pQueryInfo
->
type
|=
TSDB_QUERY_TYPE_STABLE_SUBQUERY
;
// clear the limit/offset info, since it should not be sent to vnode to be executed.
pQueryInfo
->
limit
.
limit
=
-
1
;
pQueryInfo
->
limit
.
offset
=
0
;
assert
(
pQueryInfo
->
numOfTables
==
1
&&
pNew
->
cmd
.
numOfClause
==
1
&&
trsupport
->
subqueryIndex
<
pSql
->
subState
.
numOfSub
);
// launch subquery for each vnode, so the subquery index equals to the vgroupIndex.
...
...
@@ -3102,30 +3117,6 @@ void tscBuildResFromSubqueries(SSqlObj *pSql) {
}
}
static
UNUSED_FUNC
void
transferNcharData
(
SSqlObj
*
pSql
,
int32_t
columnIndex
,
TAOS_FIELD
*
pField
)
{
SSqlRes
*
pRes
=
&
pSql
->
res
;
if
(
pRes
->
tsrow
[
columnIndex
]
!=
NULL
&&
pField
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
// convert unicode to native code in a temporary buffer extra one byte for terminated symbol
if
(
pRes
->
buffer
[
columnIndex
]
==
NULL
)
{
pRes
->
buffer
[
columnIndex
]
=
malloc
(
pField
->
bytes
+
TSDB_NCHAR_SIZE
);
}
/* string terminated char for binary data*/
memset
(
pRes
->
buffer
[
columnIndex
],
0
,
pField
->
bytes
+
TSDB_NCHAR_SIZE
);
int32_t
length
=
taosUcs4ToMbs
(
pRes
->
tsrow
[
columnIndex
],
pRes
->
length
[
columnIndex
],
pRes
->
buffer
[
columnIndex
]);
if
(
length
>=
0
)
{
pRes
->
tsrow
[
columnIndex
]
=
(
unsigned
char
*
)
pRes
->
buffer
[
columnIndex
];
pRes
->
length
[
columnIndex
]
=
length
;
}
else
{
tscError
(
"%p charset:%s to %s. val:%s convert failed."
,
pSql
,
DEFAULT_UNICODE_ENCODEC
,
tsCharset
,
(
char
*
)
pRes
->
tsrow
[
columnIndex
]);
pRes
->
tsrow
[
columnIndex
]
=
NULL
;
pRes
->
length
[
columnIndex
]
=
0
;
}
}
}
char
*
getArithmeticInputSrc
(
void
*
param
,
const
char
*
name
,
int32_t
colId
)
{
SArithmeticSupport
*
pSupport
=
(
SArithmeticSupport
*
)
param
;
...
...
src/client/src/tscUtil.c
浏览文件 @
6ba66d58
...
...
@@ -97,6 +97,22 @@ bool tscQueryTags(SQueryInfo* pQueryInfo) {
return
true
;
}
bool
tscQueryBlockInfo
(
SQueryInfo
*
pQueryInfo
)
{
int32_t
numOfCols
=
(
int32_t
)
tscSqlExprNumOfExprs
(
pQueryInfo
);
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SSqlExpr
*
pExpr
=
tscSqlExprGet
(
pQueryInfo
,
i
);
int32_t
functId
=
pExpr
->
functionId
;
// "select count(tbname)" query
if
(
functId
==
TSDB_FUNC_BLKINFO
)
{
return
true
;
}
}
return
false
;
}
bool
tscIsTwoStageSTableQuery
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
)
{
if
(
pQueryInfo
==
NULL
)
{
return
false
;
...
...
@@ -1725,7 +1741,12 @@ void tscInitQueryInfo(SQueryInfo* pQueryInfo) {
pQueryInfo
->
exprList
=
taosArrayInit
(
4
,
POINTER_BYTES
);
pQueryInfo
->
colList
=
taosArrayInit
(
4
,
POINTER_BYTES
);
pQueryInfo
->
udColumnId
=
TSDB_UD_COLUMN_INDEX
;
pQueryInfo
->
resColumnId
=
-
1000
;
pQueryInfo
->
resColumnId
=
-
1000
;
pQueryInfo
->
limit
.
limit
=
-
1
;
pQueryInfo
->
limit
.
offset
=
0
;
pQueryInfo
->
slimit
.
limit
=
-
1
;
pQueryInfo
->
slimit
.
offset
=
0
;
}
int32_t
tscAddSubqueryInfo
(
SSqlCmd
*
pCmd
)
{
...
...
src/common/inc/tname.h
浏览文件 @
6ba66d58
...
...
@@ -33,7 +33,7 @@ typedef struct SDataStatis {
typedef
struct
SColumnInfoData
{
SColumnInfo
info
;
void
*
pData
;
// the corresponding block data in memory
char
*
pData
;
// the corresponding block data in memory
}
SColumnInfoData
;
typedef
struct
SResPair
{
...
...
src/connector/python/linux/python2/setup.py
浏览文件 @
6ba66d58
...
...
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
setuptools
.
setup
(
name
=
"taos"
,
version
=
"2.0.
6
"
,
version
=
"2.0.
7
"
,
author
=
"Taosdata Inc."
,
author_email
=
"support@taosdata.com"
,
description
=
"TDengine python client package"
,
...
...
src/connector/python/linux/python2/taos/cinterface.py
浏览文件 @
6ba66d58
...
...
@@ -22,10 +22,10 @@ def _crow_timestamp_to_python(data, num_of_rows, nbytes=None, micro=False):
if
num_of_rows
>
0
:
return
list
(
map
(
_timestamp_converter
,
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]))
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]))
else
:
return
list
(
map
(
_timestamp_converter
,
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]))
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]))
def
_crow_bool_to_python
(
data
,
num_of_rows
,
nbytes
=
None
,
micro
=
False
):
...
...
@@ -145,10 +145,10 @@ def _crow_bigint_to_python(data, num_of_rows, nbytes=None, micro=False):
"""
if
num_of_rows
>
0
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]]
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]]
else
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]]
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]]
def
_crow_bigint_unsigned_to_python
(
...
...
@@ -162,13 +162,13 @@ def _crow_bigint_unsigned_to_python(
return
[
None
if
ele
==
FieldType
.
C_BIGINT_UNSIGNED_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_u
long
))[
ctypes
.
c_u
int64
))[
:
abs
(
num_of_rows
)]]
else
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_UNSIGNED_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_u
long
))[
ctypes
.
c_u
int64
))[
:
abs
(
num_of_rows
)]]
...
...
@@ -600,7 +600,7 @@ class CTaosInterface(object):
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_INT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_int))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_BIGINT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
long
))[0]
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
int64
))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_FLOAT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_float))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_DOUBLE):
...
...
@@ -608,7 +608,7 @@ class CTaosInterface(object):
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_BINARY):
# return (ctypes.cast(data, ctypes.POINTER(ctypes.c_char))[0:byte]).rstrip('\x00')
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_TIMESTAMP):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
long
))[0]
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
int64
))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_NCHAR):
# return (ctypes.cast(data, ctypes.c_char_p).value).rstrip('\x00')
...
...
src/connector/python/linux/python3/setup.py
浏览文件 @
6ba66d58
...
...
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
setuptools
.
setup
(
name
=
"taos"
,
version
=
"2.0.
5
"
,
version
=
"2.0.
7
"
,
author
=
"Taosdata Inc."
,
author_email
=
"support@taosdata.com"
,
description
=
"TDengine python client package"
,
...
...
src/connector/python/linux/python3/taos/cinterface.py
浏览文件 @
6ba66d58
...
...
@@ -22,10 +22,10 @@ def _crow_timestamp_to_python(data, num_of_rows, nbytes=None, micro=False):
if
num_of_rows
>
0
:
return
list
(
map
(
_timestamp_converter
,
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]))
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]))
else
:
return
list
(
map
(
_timestamp_converter
,
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]))
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]))
def
_crow_bool_to_python
(
data
,
num_of_rows
,
nbytes
=
None
,
micro
=
False
):
...
...
@@ -145,10 +145,10 @@ def _crow_bigint_to_python(data, num_of_rows, nbytes=None, micro=False):
"""
if
num_of_rows
>
0
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]]
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]]
else
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]]
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]]
def
_crow_bigint_unsigned_to_python
(
...
...
@@ -162,13 +162,13 @@ def _crow_bigint_unsigned_to_python(
return
[
None
if
ele
==
FieldType
.
C_BIGINT_UNSIGNED_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_u
long
))[
ctypes
.
c_u
int64
))[
:
abs
(
num_of_rows
)]]
else
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_UNSIGNED_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_u
long
))[
ctypes
.
c_u
int64
))[
:
abs
(
num_of_rows
)]]
...
...
@@ -600,7 +600,7 @@ class CTaosInterface(object):
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_INT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_int))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_BIGINT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
long
))[0]
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
int64
))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_FLOAT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_float))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_DOUBLE):
...
...
@@ -608,7 +608,7 @@ class CTaosInterface(object):
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_BINARY):
# return (ctypes.cast(data, ctypes.POINTER(ctypes.c_char))[0:byte]).rstrip('\x00')
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_TIMESTAMP):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
long
))[0]
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
int64
))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_NCHAR):
# return (ctypes.cast(data, ctypes.c_char_p).value).rstrip('\x00')
...
...
src/connector/python/linux/python3/taos/cursor.py
浏览文件 @
6ba66d58
from
.cinterface
import
CTaosInterface
from
.error
import
*
from
.constants
import
FieldType
import
threading
# querySeqNum = 0
...
...
@@ -38,7 +37,6 @@ class TDengineCursor(object):
self
.
_block_iter
=
0
self
.
_affected_rows
=
0
self
.
_logfile
=
""
self
.
_threadId
=
threading
.
get_ident
()
if
connection
is
not
None
:
self
.
_connection
=
connection
...
...
@@ -105,12 +103,6 @@ class TDengineCursor(object):
def
execute
(
self
,
operation
,
params
=
None
):
"""Prepare and execute a database operation (query or command).
"""
# if threading.get_ident() != self._threadId:
# info ="Cursor execute:Thread ID not match,creater:"+str(self._threadId)+" caller:"+str(threading.get_ident())
# raise OperationalError(info)
# print(info)
# return None
if
not
operation
:
return
None
...
...
@@ -280,12 +272,6 @@ class TDengineCursor(object):
def
_handle_result
(
self
):
"""Handle the return result from query.
"""
# if threading.get_ident() != self._threadId:
# info = "Cursor handleresult:Thread ID not match,creater:"+str(self._threadId)+" caller:"+str(threading.get_ident())
# raise OperationalError(info)
# print(info)
# return None
self
.
_description
=
[]
for
ele
in
self
.
_fields
:
self
.
_description
.
append
(
...
...
src/connector/python/osx/python3/setup.py
浏览文件 @
6ba66d58
...
...
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
setuptools
.
setup
(
name
=
"taos"
,
version
=
"2.0.
5
"
,
version
=
"2.0.
7
"
,
author
=
"Taosdata Inc."
,
author_email
=
"support@taosdata.com"
,
description
=
"TDengine python client package"
,
...
...
src/connector/python/osx/python3/taos/cinterface.py
浏览文件 @
6ba66d58
...
...
@@ -22,10 +22,10 @@ def _crow_timestamp_to_python(data, num_of_rows, nbytes=None, micro=False):
if
num_of_rows
>
0
:
return
list
(
map
(
_timestamp_converter
,
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]))
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]))
else
:
return
list
(
map
(
_timestamp_converter
,
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]))
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]))
def
_crow_bool_to_python
(
data
,
num_of_rows
,
nbytes
=
None
,
micro
=
False
):
...
...
@@ -145,10 +145,10 @@ def _crow_bigint_to_python(data, num_of_rows, nbytes=None, micro=False):
"""
if
num_of_rows
>
0
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]]
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]]
else
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]]
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]]
def
_crow_bigint_unsigned_to_python
(
...
...
@@ -162,13 +162,13 @@ def _crow_bigint_unsigned_to_python(
return
[
None
if
ele
==
FieldType
.
C_BIGINT_UNSIGNED_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_u
long
))[
ctypes
.
c_u
int64
))[
:
abs
(
num_of_rows
)]]
else
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_UNSIGNED_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_u
long
))[
ctypes
.
c_u
int64
))[
:
abs
(
num_of_rows
)]]
...
...
@@ -600,7 +600,7 @@ class CTaosInterface(object):
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_INT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_int))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_BIGINT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
long
))[0]
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
int64
))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_FLOAT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_float))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_DOUBLE):
...
...
@@ -608,7 +608,7 @@ class CTaosInterface(object):
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_BINARY):
# return (ctypes.cast(data, ctypes.POINTER(ctypes.c_char))[0:byte]).rstrip('\x00')
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_TIMESTAMP):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
long
))[0]
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
int64
))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_NCHAR):
# return (ctypes.cast(data, ctypes.c_char_p).value).rstrip('\x00')
...
...
src/connector/python/osx/python3/taos/cursor.py
浏览文件 @
6ba66d58
from
.cinterface
import
CTaosInterface
from
.error
import
*
from
.constants
import
FieldType
import
threading
# querySeqNum = 0
...
...
@@ -38,7 +37,6 @@ class TDengineCursor(object):
self
.
_block_iter
=
0
self
.
_affected_rows
=
0
self
.
_logfile
=
""
self
.
_threadId
=
threading
.
get_ident
()
if
connection
is
not
None
:
self
.
_connection
=
connection
...
...
@@ -105,12 +103,6 @@ class TDengineCursor(object):
def
execute
(
self
,
operation
,
params
=
None
):
"""Prepare and execute a database operation (query or command).
"""
# if threading.get_ident() != self._threadId:
# info ="Cursor execute:Thread ID not match,creater:"+str(self._threadId)+" caller:"+str(threading.get_ident())
# raise OperationalError(info)
# print(info)
# return None
if
not
operation
:
return
None
...
...
@@ -280,12 +272,6 @@ class TDengineCursor(object):
def
_handle_result
(
self
):
"""Handle the return result from query.
"""
# if threading.get_ident() != self._threadId:
# info = "Cursor handleresult:Thread ID not match,creater:"+str(self._threadId)+" caller:"+str(threading.get_ident())
# raise OperationalError(info)
# print(info)
# return None
self
.
_description
=
[]
for
ele
in
self
.
_fields
:
self
.
_description
.
append
(
...
...
src/connector/python/windows/python2/setup.py
浏览文件 @
6ba66d58
...
...
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
setuptools
.
setup
(
name
=
"taos"
,
version
=
"2.0.
4
"
,
version
=
"2.0.
7
"
,
author
=
"Taosdata Inc."
,
author_email
=
"support@taosdata.com"
,
description
=
"TDengine python client package"
,
...
...
src/connector/python/windows/python2/taos/cinterface.py
浏览文件 @
6ba66d58
...
...
@@ -22,10 +22,10 @@ def _crow_timestamp_to_python(data, num_of_rows, nbytes=None, micro=False):
if
num_of_rows
>
0
:
return
list
(
map
(
_timestamp_converter
,
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]))
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]))
else
:
return
list
(
map
(
_timestamp_converter
,
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]))
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]))
def
_crow_bool_to_python
(
data
,
num_of_rows
,
nbytes
=
None
,
micro
=
False
):
...
...
@@ -145,10 +145,10 @@ def _crow_bigint_to_python(data, num_of_rows, nbytes=None, micro=False):
"""
if
num_of_rows
>
0
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]]
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]]
else
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]]
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]]
def
_crow_bigint_unsigned_to_python
(
...
...
@@ -162,13 +162,13 @@ def _crow_bigint_unsigned_to_python(
return
[
None
if
ele
==
FieldType
.
C_BIGINT_UNSIGNED_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_u
long
))[
ctypes
.
c_u
int64
))[
:
abs
(
num_of_rows
)]]
else
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_UNSIGNED_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_u
long
))[
ctypes
.
c_u
int64
))[
:
abs
(
num_of_rows
)]]
...
...
@@ -600,7 +600,7 @@ class CTaosInterface(object):
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_INT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_int))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_BIGINT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
long
))[0]
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
int64
))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_FLOAT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_float))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_DOUBLE):
...
...
@@ -608,7 +608,7 @@ class CTaosInterface(object):
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_BINARY):
# return (ctypes.cast(data, ctypes.POINTER(ctypes.c_char))[0:byte]).rstrip('\x00')
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_TIMESTAMP):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
long
))[0]
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
int64
))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_NCHAR):
# return (ctypes.cast(data, ctypes.c_char_p).value).rstrip('\x00')
...
...
src/connector/python/windows/python2/taos/cursor.py
浏览文件 @
6ba66d58
from
.cinterface
import
CTaosInterface
from
.error
import
*
from
.constants
import
FieldType
import
threading
# querySeqNum = 0
...
...
@@ -38,7 +37,6 @@ class TDengineCursor(object):
self
.
_block_iter
=
0
self
.
_affected_rows
=
0
self
.
_logfile
=
""
self
.
_threadId
=
threading
.
get_ident
()
if
connection
is
not
None
:
self
.
_connection
=
connection
...
...
src/connector/python/windows/python3/setup.py
浏览文件 @
6ba66d58
...
...
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
setuptools
.
setup
(
name
=
"taos"
,
version
=
"2.0.
4
"
,
version
=
"2.0.
7
"
,
author
=
"Taosdata Inc."
,
author_email
=
"support@taosdata.com"
,
description
=
"TDengine python client package"
,
...
...
src/connector/python/windows/python3/taos/cinterface.py
浏览文件 @
6ba66d58
...
...
@@ -22,10 +22,10 @@ def _crow_timestamp_to_python(data, num_of_rows, nbytes=None, micro=False):
if
num_of_rows
>
0
:
return
list
(
map
(
_timestamp_converter
,
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]))
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]))
else
:
return
list
(
map
(
_timestamp_converter
,
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]))
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]))
def
_crow_bool_to_python
(
data
,
num_of_rows
,
nbytes
=
None
,
micro
=
False
):
...
...
@@ -145,10 +145,10 @@ def _crow_bigint_to_python(data, num_of_rows, nbytes=None, micro=False):
"""
if
num_of_rows
>
0
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]]
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]]
else
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_
long
))[:
abs
(
num_of_rows
)]]
data
,
ctypes
.
POINTER
(
ctypes
.
c_
int64
))[:
abs
(
num_of_rows
)]]
def
_crow_bigint_unsigned_to_python
(
...
...
@@ -162,13 +162,13 @@ def _crow_bigint_unsigned_to_python(
return
[
None
if
ele
==
FieldType
.
C_BIGINT_UNSIGNED_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_u
long
))[
ctypes
.
c_u
int64
))[
:
abs
(
num_of_rows
)]]
else
:
return
[
None
if
ele
==
FieldType
.
C_BIGINT_UNSIGNED_NULL
else
ele
for
ele
in
ctypes
.
cast
(
data
,
ctypes
.
POINTER
(
ctypes
.
c_u
long
))[
ctypes
.
c_u
int64
))[
:
abs
(
num_of_rows
)]]
...
...
@@ -600,7 +600,7 @@ class CTaosInterface(object):
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_INT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_int))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_BIGINT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
long
))[0]
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
int64
))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_FLOAT):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_float))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_DOUBLE):
...
...
@@ -608,7 +608,7 @@ class CTaosInterface(object):
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_BINARY):
# return (ctypes.cast(data, ctypes.POINTER(ctypes.c_char))[0:byte]).rstrip('\x00')
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_TIMESTAMP):
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
long
))[0]
# return ctypes.cast(data, ctypes.POINTER(ctypes.c_
int64
))[0]
# elif (dtype == CTaosInterface.TSDB_DATA_TYPE_NCHAR):
# return (ctypes.cast(data, ctypes.c_char_p).value).rstrip('\x00')
...
...
src/connector/python/windows/python3/taos/cursor.py
浏览文件 @
6ba66d58
from
.cinterface
import
CTaosInterface
from
.error
import
*
from
.constants
import
FieldType
import
threading
# querySeqNum = 0
...
...
@@ -38,7 +37,6 @@ class TDengineCursor(object):
self
.
_block_iter
=
0
self
.
_affected_rows
=
0
self
.
_logfile
=
""
self
.
_threadId
=
threading
.
get_ident
()
if
connection
is
not
None
:
self
.
_connection
=
connection
...
...
src/inc/taoserror.h
浏览文件 @
6ba66d58
...
...
@@ -252,7 +252,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_QRY_IN_EXEC TAOS_DEF_ERROR_CODE(0, 0x0709) //"Multiple retrieval of this query")
#define TSDB_CODE_QRY_TOO_MANY_TIMEWINDOW TAOS_DEF_ERROR_CODE(0, 0x070A) //"Too many time window in query")
#define TSDB_CODE_QRY_NOT_ENOUGH_BUFFER TAOS_DEF_ERROR_CODE(0, 0x070B) //"Query buffer limit has reached")
#define TSDB_CODE_QRY_INCONSISTAN TAOS_DEF_ERROR_CODE(0, 0x070C) //"File inconsist
ance
in replica")
#define TSDB_CODE_QRY_INCONSISTAN TAOS_DEF_ERROR_CODE(0, 0x070C) //"File inconsist
ency
in replica")
// grant
...
...
src/inc/taosmsg.h
浏览文件 @
6ba66d58
...
...
@@ -394,7 +394,7 @@ typedef struct SColIndex {
int16_t
colId
;
// column id
int16_t
colIndex
;
// column index in colList if it is a normal column or index in tagColList if a tag
uint16_t
flag
;
// denote if it is a tag or a normal column
char
name
[
TSDB_COL_NAME_LEN
];
char
name
[
TSDB_COL_NAME_LEN
];
// TODO remove it
}
SColIndex
;
/* sql function msg, to describe the message to vnode about sql function
...
...
@@ -402,7 +402,10 @@ typedef struct SColIndex {
typedef
struct
SSqlFuncMsg
{
int16_t
functionId
;
int16_t
numOfParams
;
int16_t
resColId
;
// result column id, id of the current output column
int16_t
colType
;
int16_t
colBytes
;
SColIndex
colInfo
;
struct
ArgElem
{
...
...
src/inc/tsdb.h
浏览文件 @
6ba66d58
...
...
@@ -158,13 +158,18 @@ int32_t tsdbInsertData(STsdbRepo *repo, SSubmitMsg *pMsg, SShellSubmitRspMsg *pR
typedef
void
*
TsdbQueryHandleT
;
// Use void to hide implementation details
// query condition to build vnode iterator
#define BLOCK_LOAD_OFFSET_SEQ_ORDER 1
#define BLOCK_LOAD_TABLE_SEQ_ORDER 2
#define BLOCK_LOAD_TABLE_RR_ORDER 3
// query condition to build multi-table data block iterator
typedef
struct
STsdbQueryCond
{
STimeWindow
twindow
;
int32_t
order
;
// desc|asc order to iterate the data block
int32_t
numOfCols
;
SColumnInfo
*
colList
;
bool
loadExternalRows
;
// load external rows or not
int32_t
type
;
// data block load type:
}
STsdbQueryCond
;
typedef
struct
SMemRef
{
...
...
@@ -181,17 +186,31 @@ typedef struct SDataBlockInfo {
int32_t
tid
;
}
SDataBlockInfo
;
typedef
struct
SFileBlockInfo
{
int32_t
numOfRows
;
}
SFileBlockInfo
;
typedef
struct
{
void
*
pTable
;
TSKEY
lastKey
;
}
STableKeyInfo
;
typedef
struct
{
size_t
numOfTables
;
uint32_t
numOfTables
;
SArray
*
pGroupList
;
SHashObj
*
map
;
// speedup acquire the tableQueryInfo by table uid
}
STableGroupInfo
;
typedef
struct
{
uint16_t
rowSize
;
uint16_t
numOfFiles
;
uint32_t
numOfTables
;
uint64_t
totalSize
;
int32_t
firstSeekTimeUs
;
uint32_t
numOfRowsInMemTable
;
SArray
*
dataBlockInfos
;
}
STableBlockDist
;
/**
* Get the data block iterator, starting from position according to the query condition
*
...
...
@@ -252,16 +271,7 @@ int64_t tsdbGetNumOfRowsInMemTable(TsdbQueryHandleT* pHandle);
* @param pQueryHandle
* @return
*/
bool
tsdbNextDataBlock
(
TsdbQueryHandleT
*
pQueryHandle
);
/**
* move to next block if exists but not merge data in memtable
*
* @param pQueryHandle
* @return
*/
bool
tsdbNextDataBlockWithoutMerge
(
TsdbQueryHandleT
*
pQueryHandle
);
SArray
*
tsdbGetExternalRow
(
TsdbQueryHandleT
*
pHandle
,
SMemRef
*
pMemRef
,
int16_t
type
);
bool
tsdbNextDataBlock
(
TsdbQueryHandleT
pQueryHandle
);
/**
* Get current data block information
...
...
@@ -306,7 +316,7 @@ int32_t tsdbQuerySTableByTagCond(STsdbRepo *tsdb, uint64_t uid, TSKEY key, const
SColIndex
*
pColIndex
,
int32_t
numOfCols
);
/**
* dest
or
y the created table group list, which is generated by tag query
* dest
ro
y the created table group list, which is generated by tag query
* @param pGroupList
*/
void
tsdbDestroyTableGroup
(
STableGroupInfo
*
pGroupList
);
...
...
@@ -336,6 +346,12 @@ int32_t tsdbGetTableGroupFromIdList(STsdbRepo *tsdb, SArray *pTableIdList, STabl
*/
void
tsdbCleanupQueryHandle
(
TsdbQueryHandleT
queryHandle
);
void
tsdbResetQueryHandle
(
TsdbQueryHandleT
queryHandle
,
STsdbQueryCond
*
pCond
);
void
tsdbResetQueryHandleForNewTable
(
TsdbQueryHandleT
queryHandle
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
);
int32_t
tsdbGetFileBlocksDistInfo
(
TsdbQueryHandleT
*
queryHandle
,
STableBlockDist
*
pTableBlockInfo
);
/**
* get the statistics of repo usage
* @param repo. point to the tsdbrepo
...
...
src/inc/ttokendef.h
浏览文件 @
6ba66d58
...
...
@@ -191,52 +191,18 @@
#define TK_STATEMENT 172
#define TK_TRIGGER 173
#define TK_VIEW 174
#define TK_COUNT 175
#define TK_SUM 176
#define TK_AVG 177
#define TK_MIN 178
#define TK_MAX 179
#define TK_FIRST 180
#define TK_LAST 181
#define TK_TOP 182
#define TK_BOTTOM 183
#define TK_STDDEV 184
#define TK_PERCENTILE 185
#define TK_APERCENTILE 186
#define TK_LEASTSQUARES 187
#define TK_HISTOGRAM 188
#define TK_DIFF 189
#define TK_SPREAD 190
#define TK_TWA 191
#define TK_INTERP 192
#define TK_LAST_ROW 193
#define TK_RATE 194
#define TK_IRATE 195
#define TK_SUM_RATE 196
#define TK_SUM_IRATE 197
#define TK_AVG_RATE 198
#define TK_AVG_IRATE 199
#define TK_TBID 200
#define TK_SEMI 201
#define TK_NONE 202
#define TK_PREV 203
#define TK_LINEAR 204
#define TK_IMPORT 205
#define TK_METRIC 206
#define TK_TBNAME 207
#define TK_JOIN 208
#define TK_METRICS 209
#define TK_INSERT 210
#define TK_INTO 211
#define TK_VALUES 212
#define TK_SEMI 175
#define TK_NONE 176
#define TK_PREV 177
#define TK_LINEAR 178
#define TK_IMPORT 179
#define TK_METRIC 180
#define TK_TBNAME 181
#define TK_JOIN 182
#define TK_METRICS 183
#define TK_INSERT 184
#define TK_INTO 185
#define TK_VALUES 186
#define TK_SPACE 300
...
...
src/inc/ttype.h
浏览文件 @
6ba66d58
...
...
@@ -174,7 +174,7 @@ bool isValidDataType(int32_t type);
void
setVardataNull
(
char
*
val
,
int32_t
type
);
void
setNull
(
char
*
val
,
int32_t
type
,
int32_t
bytes
);
void
setNullN
(
char
*
val
,
int32_t
type
,
int32_t
bytes
,
int32_t
numOfElems
);
void
*
getNullValue
(
int32_t
type
);
void
*
getNullValue
(
int32_t
type
);
void
assignVal
(
char
*
val
,
const
char
*
src
,
int32_t
len
,
int32_t
type
);
void
tsDataSwap
(
void
*
pLeft
,
void
*
pRight
,
int32_t
type
,
int32_t
size
,
void
*
buf
);
...
...
src/kit/taosdemo/insert.json
浏览文件 @
6ba66d58
...
...
@@ -11,6 +11,7 @@
"confirm_parameter_prompt"
:
"no"
,
"insert_interval"
:
0
,
"num_of_records_per_req"
:
100
,
"max_sql_len"
:
1024000
,
"databases"
:
[{
"dbinfo"
:
{
"name"
:
"db"
,
...
...
@@ -38,7 +39,9 @@
"auto_create_table"
:
"no"
,
"data_source"
:
"rand"
,
"insert_mode"
:
"taosc"
,
"insert_rows"
:
100000
,
"childtable_limit"
:
33
,
"childtable_offset"
:
33
,
"insert_rows"
:
1000
,
"multi_thread_write_one_tbl"
:
"no"
,
"number_of_tbl_in_one_sql"
:
0
,
"rows_per_tbl"
:
100
,
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
src/plugins/http/inc/httpJson.h
浏览文件 @
6ba66d58
...
...
@@ -63,9 +63,11 @@ void httpJsonString(JsonBuf* buf, char* sVal, int32_t len);
void
httpJsonOriginString
(
JsonBuf
*
buf
,
char
*
sVal
,
int32_t
len
);
void
httpJsonStringForTransMean
(
JsonBuf
*
buf
,
char
*
SVal
,
int32_t
maxLen
);
void
httpJsonInt64
(
JsonBuf
*
buf
,
int64_t
num
);
void
httpJsonUInt64
(
JsonBuf
*
buf
,
uint64_t
num
);
void
httpJsonTimestamp
(
JsonBuf
*
buf
,
int64_t
t
,
bool
us
);
void
httpJsonUtcTimestamp
(
JsonBuf
*
buf
,
int64_t
t
,
bool
us
);
void
httpJsonInt
(
JsonBuf
*
buf
,
int32_t
num
);
void
httpJsonUInt
(
JsonBuf
*
buf
,
uint32_t
num
);
void
httpJsonFloat
(
JsonBuf
*
buf
,
float
num
);
void
httpJsonDouble
(
JsonBuf
*
buf
,
double
num
);
void
httpJsonNull
(
JsonBuf
*
buf
);
...
...
src/plugins/http/src/httpJson.c
浏览文件 @
6ba66d58
...
...
@@ -256,6 +256,12 @@ void httpJsonInt64(JsonBuf* buf, int64_t num) {
buf
->
lst
+=
snprintf
(
buf
->
lst
,
MAX_NUM_STR_SZ
,
"%"
PRId64
,
num
);
}
void
httpJsonUInt64
(
JsonBuf
*
buf
,
uint64_t
num
)
{
httpJsonItemToken
(
buf
);
httpJsonTestBuf
(
buf
,
MAX_NUM_STR_SZ
);
buf
->
lst
+=
snprintf
(
buf
->
lst
,
MAX_NUM_STR_SZ
,
"%"
PRIu64
,
num
);
}
void
httpJsonTimestamp
(
JsonBuf
*
buf
,
int64_t
t
,
bool
us
)
{
char
ts
[
35
]
=
{
0
};
struct
tm
*
ptm
;
...
...
@@ -303,6 +309,12 @@ void httpJsonInt(JsonBuf* buf, int32_t num) {
buf
->
lst
+=
snprintf
(
buf
->
lst
,
MAX_NUM_STR_SZ
,
"%d"
,
num
);
}
void
httpJsonUInt
(
JsonBuf
*
buf
,
uint32_t
num
)
{
httpJsonItemToken
(
buf
);
httpJsonTestBuf
(
buf
,
MAX_NUM_STR_SZ
);
buf
->
lst
+=
snprintf
(
buf
->
lst
,
MAX_NUM_STR_SZ
,
"%u"
,
num
);
}
void
httpJsonFloat
(
JsonBuf
*
buf
,
float
num
)
{
httpJsonItemToken
(
buf
);
httpJsonTestBuf
(
buf
,
MAX_NUM_STR_SZ
);
...
...
src/plugins/http/src/httpRestJson.c
浏览文件 @
6ba66d58
...
...
@@ -162,6 +162,18 @@ bool restBuildSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result,
case
TSDB_DATA_TYPE_BIGINT
:
httpJsonInt64
(
jsonBuf
,
*
((
int64_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_UTINYINT
:
httpJsonUInt
(
jsonBuf
,
*
((
uint8_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_USMALLINT
:
httpJsonUInt
(
jsonBuf
,
*
((
uint16_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_UINT
:
httpJsonUInt
(
jsonBuf
,
*
((
uint32_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_UBIGINT
:
httpJsonUInt64
(
jsonBuf
,
*
((
uint64_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_FLOAT
:
httpJsonFloat
(
jsonBuf
,
GET_FLOAT_VAL
(
row
[
i
]));
break
;
...
...
src/query/inc/qAggMain.h
浏览文件 @
6ba66d58
...
...
@@ -26,6 +26,7 @@ extern "C" {
#include "taosdef.h"
#include "trpc.h"
#include "tvariant.h"
#include "tsdb.h"
#define TSDB_FUNC_INVALID_ID -1
#define TSDB_FUNC_COUNT 0
...
...
@@ -70,15 +71,17 @@ extern "C" {
#define TSDB_FUNC_AVG_IRATE 34
#define TSDB_FUNC_TID_TAG 35
#define TSDB_FUNC_HISTOGRAM 36
#define TSDB_FUNC_HLL 37
#define TSDB_FUNC_MODE 38
#define TSDB_FUNC_SAMPLE 39
#define TSDB_FUNC_CEIL 40
#define TSDB_FUNC_FLOOR 41
#define TSDB_FUNC_ROUND 42
#define TSDB_FUNC_MAVG 43
#define TSDB_FUNC_CSUM 44
#define TSDB_FUNC_BLKINFO 36
#define TSDB_FUNC_HISTOGRAM 37
#define TSDB_FUNC_HLL 38
#define TSDB_FUNC_MODE 39
#define TSDB_FUNC_SAMPLE 40
#define TSDB_FUNC_CEIL 41
#define TSDB_FUNC_FLOOR 42
#define TSDB_FUNC_ROUND 43
#define TSDB_FUNC_MAVG 44
#define TSDB_FUNC_CSUM 45
#define TSDB_FUNCSTATE_SO 0x1u // single output
...
...
@@ -214,13 +217,14 @@ typedef struct SAggFunctionInfo {
void
(
*
xFinalize
)(
SQLFunctionCtx
*
pCtx
);
void
(
*
mergeFunc
)(
SQLFunctionCtx
*
pCtx
);
int32_t
(
*
dataReqFunc
)(
SQLFunctionCtx
*
pCtx
,
TSKEY
start
,
TSKEY
end
,
int32_t
colId
);
int32_t
(
*
dataReqFunc
)(
SQLFunctionCtx
*
pCtx
,
STimeWindow
*
w
,
int32_t
colId
);
}
SAggFunctionInfo
;
#define GET_RES_INFO(ctx) ((ctx)->resultInfo)
int32_t
getResultDataInfo
(
int32_t
dataType
,
int32_t
dataBytes
,
int32_t
functionId
,
int32_t
param
,
int16_t
*
type
,
int16_t
*
len
,
int32_t
*
interBytes
,
int16_t
extLength
,
bool
isSuperTable
);
int32_t
isValidFunction
(
const
char
*
name
,
int32_t
len
);
#define IS_STREAM_QUERY_VALID(x) (((x)&TSDB_FUNCSTATE_STREAM) != 0)
#define IS_MULTIOUTPUT(x) (((x)&TSDB_FUNCSTATE_MO) != 0)
...
...
@@ -242,12 +246,16 @@ typedef struct STwaInfo {
STimeWindow
win
;
}
STwaInfo
;
struct
SBufferWriter
;
void
blockDistInfoToBinary
(
STableBlockDist
*
pDist
,
struct
SBufferWriter
*
bw
);
void
blockDistInfoFromBinary
(
const
char
*
data
,
int32_t
len
,
STableBlockDist
*
pDist
);
/* global sql function array */
extern
struct
SAggFunctionInfo
aAggs
[];
extern
int32_t
functionCompatList
[];
// compatible check array list
bool
topbot_datablock_filter
(
SQLFunctionCtx
*
pCtx
,
int32_t
functionId
,
const
char
*
minval
,
const
char
*
maxval
);
bool
topbot_datablock_filter
(
SQLFunctionCtx
*
pCtx
,
const
char
*
minval
,
const
char
*
maxval
);
/**
* the numOfRes should be kept, since it may be used later
...
...
@@ -258,14 +266,14 @@ bool topbot_datablock_filter(SQLFunctionCtx *pCtx, int32_t functionId, const cha
(_r)->initialized = false; \
} while (0)
static
FORCE_INLINE
void
initResultInfo
(
SResultRowCellInfo
*
pResInfo
,
u
int32_t
bufLen
)
{
static
FORCE_INLINE
void
initResultInfo
(
SResultRowCellInfo
*
pResInfo
,
int32_t
bufLen
)
{
pResInfo
->
initialized
=
true
;
// the this struct has been initialized flag
pResInfo
->
complete
=
false
;
pResInfo
->
hasResult
=
false
;
pResInfo
->
numOfRes
=
0
;
memset
(
GET_ROWCELL_INTERBUF
(
pResInfo
),
0
,
(
size_t
)
bufLen
);
memset
(
GET_ROWCELL_INTERBUF
(
pResInfo
),
0
,
bufLen
);
}
#ifdef __cplusplus
...
...
src/query/inc/qExecutor.h
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
src/query/inc/qFill.h
浏览文件 @
6ba66d58
...
...
@@ -24,6 +24,8 @@ extern "C" {
#include "qExtbuffer.h"
#include "taosdef.h"
struct
SSDataBlock
;
typedef
struct
{
STColumn
col
;
// column info
int16_t
functionId
;
// sql function id
...
...
@@ -78,7 +80,7 @@ void* taosDestroyFillInfo(SFillInfo *pFillInfo);
void
taosFillSetStartInfo
(
SFillInfo
*
pFillInfo
,
int32_t
numOfRows
,
TSKEY
endKey
);
void
taosFillSet
DataBlockFromFilePage
(
SFillInfo
*
pFillInfo
,
const
tFilePage
*
*
pInput
);
void
taosFillSet
InputDataBlock
(
SFillInfo
*
pFillInfo
,
const
struct
SSDataBlock
*
pInput
);
void
taosFillCopyInputDataFromOneFilePage
(
SFillInfo
*
pFillInfo
,
const
tFilePage
*
pInput
);
...
...
@@ -88,7 +90,7 @@ int64_t getNumOfResultsAfterFillGap(SFillInfo* pFillInfo, int64_t ekey, int32_t
int32_t
taosGetLinearInterpolationVal
(
SPoint
*
point
,
int32_t
outputType
,
SPoint
*
point1
,
SPoint
*
point2
,
int32_t
inputType
);
int64_t
taosFillResultDataBlock
(
SFillInfo
*
pFillInfo
,
tFilePage
**
output
,
int32_t
capacity
);
int64_t
taosFillResultDataBlock
(
SFillInfo
*
pFillInfo
,
void
**
output
,
int32_t
capacity
);
#ifdef __cplusplus
}
...
...
src/query/inc/qResultbuf.h
浏览文件 @
6ba66d58
...
...
@@ -55,7 +55,6 @@ typedef struct SResultBufStatis {
}
SResultBufStatis
;
typedef
struct
SDiskbasedResultBuf
{
int32_t
numOfRowsPerPage
;
int32_t
numOfPages
;
int64_t
totalBufSize
;
int64_t
fileSize
;
// disk file size
...
...
@@ -77,7 +76,7 @@ typedef struct SDiskbasedResultBuf {
SResultBufStatis
statis
;
}
SDiskbasedResultBuf
;
#define DEFAULT_INTERN_BUF_PAGE_SIZE (
256
L) // in bytes
#define DEFAULT_INTERN_BUF_PAGE_SIZE (
1024
L) // in bytes
#define PAGE_INFO_INITIALIZER (SPageDiskInfo){-1, -1}
/**
...
...
@@ -89,8 +88,7 @@ typedef struct SDiskbasedResultBuf {
* @param handle
* @return
*/
int32_t
createDiskbasedResultBuffer
(
SDiskbasedResultBuf
**
pResultBuf
,
int32_t
rowSize
,
int32_t
pagesize
,
int32_t
inMemBufSize
,
const
void
*
handle
);
int32_t
createDiskbasedResultBuffer
(
SDiskbasedResultBuf
**
pResultBuf
,
int32_t
pagesize
,
int32_t
inMemBufSize
,
const
void
*
handle
);
/**
*
...
...
@@ -101,13 +99,6 @@ int32_t createDiskbasedResultBuffer(SDiskbasedResultBuf** pResultBuf, int32_t ro
*/
tFilePage
*
getNewDataBuf
(
SDiskbasedResultBuf
*
pResultBuf
,
int32_t
groupId
,
int32_t
*
pageId
);
/**
*
* @param pResultBuf
* @return
*/
size_t
getNumOfRowsPerPage
(
const
SDiskbasedResultBuf
*
pResultBuf
);
/**
*
* @param pResultBuf
...
...
src/query/inc/qSqlparser.h
浏览文件 @
6ba66d58
...
...
@@ -185,19 +185,32 @@ typedef struct SSqlInfo {
};
}
SSqlInfo
;
#define NON_ARITHMEIC_EXPR 0
#define NORMAL_ARITHMETIC 1
#define AGG_ARIGHTMEIC 2
enum
SQL_NODE_TYPE
{
SQL_NODE_TABLE_COLUMN
=
1
,
SQL_NODE_SQLFUNCTION
=
2
,
SQL_NODE_VALUE
=
3
,
SQL_NODE_EXPR
=
4
,
};
typedef
struct
tSQLExpr
{
uint32_t
nSQLOptr
;
// TK_FUNCTION: sql function, TK_LE: less than(binary expr)
uint16_t
type
;
// sql node type
uint32_t
tokenId
;
// TK_FUNCTION: sql function, TK_LE: less than(binary expr)
// the full sql string of function(col, param), which is actually the raw
// field name, since the function name is kept in nSQLOptr already
// the whole string of the function(col, param), while the function name is kept in token
SStrToken
operand
;
SStrToken
colInfo
;
// field id
tVariant
val
;
// value only for string, float, int
uint32_t
functionId
;
// function id
SStrToken
colInfo
;
// table column info
tVariant
value
;
// the use input value
SStrToken
token
;
// original sql expr string
struct
tSQLExpr
*
pLeft
;
// left child
struct
tSQLExpr
*
pRight
;
// right child
struct
tSQLExprList
*
pParam
;
// function parameters
struct
tSQLExprList
*
pParam
;
// function parameters
list
}
tSQLExpr
;
// used in select clause. select <tSQLExprList> from xxx
...
...
@@ -294,16 +307,6 @@ void tSqlSetColumnType(TAOS_FIELD *pField, SStrToken *type);
void
*
ParseAlloc
(
void
*
(
*
mallocProc
)(
size_t
));
enum
{
TSQL_NODE_TYPE_EXPR
=
0x1
,
TSQL_NODE_TYPE_ID
=
0x2
,
TSQL_NODE_TYPE_VALUE
=
0x4
,
};
#define NON_ARITHMEIC_EXPR 0
#define NORMAL_ARITHMETIC 1
#define AGG_ARIGHTMEIC 2
SSqlInfo
qSQLParse
(
const
char
*
str
);
#ifdef __cplusplus
...
...
src/query/inc/qTsbuf.h
浏览文件 @
6ba66d58
...
...
@@ -113,12 +113,10 @@ STSBuf* tsBufClone(STSBuf* pTSBuf);
STSGroupBlockInfo
*
tsBufGetGroupBlockInfo
(
STSBuf
*
pTSBuf
,
int32_t
id
);
void
tsBufFlush
(
STSBuf
*
pTSBuf
);
void
tsBufResetPos
(
STSBuf
*
pTSBuf
);
STSElem
tsBufGetElem
(
STSBuf
*
pTSBuf
);
bool
tsBufNextPos
(
STSBuf
*
pTSBuf
);
STSElem
tsBufGetElem
(
STSBuf
*
pTSBuf
);
STSElem
tsBufGetElemStartPos
(
STSBuf
*
pTSBuf
,
int32_t
id
,
tVariant
*
tag
);
STSCursor
tsBufGetCursor
(
STSBuf
*
pTSBuf
);
...
...
src/query/inc/qUtil.h
浏览文件 @
6ba66d58
...
...
@@ -27,7 +27,7 @@
#define GET_RES_WINDOW_KEY_LEN(_l) ((_l) + sizeof(uint64_t))
#define curTimeWindowIndex(_winres) ((_winres)->curIndex)
#define GET_ROW_PARAM_FOR_MULTIOUTPUT(_q, tbq, sq) (((tbq) && (!
sq
))? (_q)->pExpr1[1].base.arg->argValue.i64:1)
#define GET_ROW_PARAM_FOR_MULTIOUTPUT(_q, tbq, sq) (((tbq) && (!
(sq)
))? (_q)->pExpr1[1].base.arg->argValue.i64:1)
int32_t
getOutputInterResultBufSize
(
SQuery
*
pQuery
);
...
...
@@ -44,22 +44,18 @@ void closeResultRow(SResultRowInfo* pResultRowInfo, int32_t slot);
bool
isResultRowClosed
(
SResultRowInfo
*
pResultRowInfo
,
int32_t
slot
);
void
clearResultRow
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SResultRow
*
pResultRow
,
int16_t
type
);
SResultRowCellInfo
*
getResultCell
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
const
SResultRow
*
pRow
,
int32_t
index
);
SResultRowCellInfo
*
getResultCell
(
const
SResultRow
*
pRow
,
int32_t
index
,
int32_t
*
offset
);
static
FORCE_INLINE
SResultRow
*
getResultRow
(
SResultRowInfo
*
pResultRowInfo
,
int32_t
slot
)
{
assert
(
pResultRowInfo
!=
NULL
&&
slot
>=
0
&&
slot
<
pResultRowInfo
->
size
);
return
pResultRowInfo
->
pResult
[
slot
];
}
static
FORCE_INLINE
char
*
getPosInResultPage
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
columnIndex
,
SResultRow
*
pResult
,
tFilePage
*
page
)
{
assert
(
pResult
!=
NULL
&&
pRuntimeEnv
!=
NULL
);
static
FORCE_INLINE
char
*
getPosInResultPage
(
SQuery
*
pQuery
,
tFilePage
*
page
,
int32_t
rowOffset
,
int16_t
offset
)
{
assert
(
rowOffset
>=
0
&&
pQuery
!=
NULL
);
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
int32_t
realRowId
=
(
int32_t
)(
pResult
->
rowId
*
GET_ROW_PARAM_FOR_MULTIOUTPUT
(
pQuery
,
pRuntimeEnv
->
topBotQuery
,
pRuntimeEnv
->
stableQuery
));
return
((
char
*
)
page
->
data
)
+
pRuntimeEnv
->
offset
[
columnIndex
]
*
pRuntimeEnv
->
numOfRowsPerPage
+
pQuery
->
pExpr1
[
columnIndex
].
bytes
*
realRowId
;
int32_t
numOfRows
=
(
int32_t
)
GET_ROW_PARAM_FOR_MULTIOUTPUT
(
pQuery
,
pQuery
->
topBotQuery
,
pQuery
->
stableQuery
);
return
((
char
*
)
page
->
data
)
+
rowOffset
+
offset
*
numOfRows
;
}
bool
isNullOperator
(
SColumnFilterElem
*
pFilter
,
const
char
*
minval
,
const
char
*
maxval
,
int16_t
type
);
...
...
@@ -74,8 +70,6 @@ void* destroyResultRowPool(SResultRowPool* p);
int32_t
getNumOfAllocatedResultRows
(
SResultRowPool
*
p
);
int32_t
getNumOfUsedResultRows
(
SResultRowPool
*
p
);
bool
isPointInterpoQuery
(
SQuery
*
pQuery
);
typedef
struct
{
SArray
*
pResult
;
// SArray<SResPair>
int32_t
colId
;
...
...
@@ -85,12 +79,14 @@ void interResToBinary(SBufferWriter* bw, SArray* pRes, int32_t tagLen);
SArray
*
interResFromBinary
(
const
char
*
data
,
int32_t
len
);
void
freeInterResult
(
void
*
param
);
void
initGroupResInfo
(
SGroupResInfo
*
pGroupResInfo
,
SResultRowInfo
*
pResultInfo
,
int32_t
offset
);
void
initGroupResInfo
(
SGroupResInfo
*
pGroupResInfo
,
SResultRowInfo
*
pResultInfo
);
void
cleanupGroupResInfo
(
SGroupResInfo
*
pGroupResInfo
);
bool
hasRemainDataInCurrentGroup
(
SGroupResInfo
*
pGroupResInfo
);
bool
hasRemainData
(
SGroupResInfo
*
pGroupResInfo
);
bool
incNextGroup
(
SGroupResInfo
*
pGroupResInfo
);
int32_t
getNumOfTotalRes
(
SGroupResInfo
*
pGroupResInfo
);
int32_t
mergeIntoGroupResult
(
SGroupResInfo
*
pGroupResInfo
,
SQ
Info
*
pQInfo
);
int32_t
mergeIntoGroupResult
(
SGroupResInfo
*
pGroupResInfo
,
SQ
ueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
*
offset
);
#endif // TDENGINE_QUERYUTIL_H
src/query/inc/sql.y
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
src/query/src/qAggMain.c
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
src/query/src/qExecutor.c
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
src/query/src/qFill.c
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
src/query/src/qParserImpl.c
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
src/query/src/qPercentile.c
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
src/query/src/qResultbuf.c
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
src/query/src/qTokenizer.c
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
src/query/src/qUtil.c
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
src/query/src/queryMain.c
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
src/query/src/sql.c
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
src/query/tests/resultBufferTest.cpp
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
src/tsdb/src/tsdbRead.c
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
src/util/inc/tarray.h
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
src/util/inc/tbuffer.h
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
tests/pytest/crash_gen/crash_gen_main.py
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
tests/pytest/fulltest.sh
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
tests/pytest/functions/function_stddev.py
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
tests/pytest/query/queryBetweenAnd.py
0 → 100644
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
tests/pytest/tools/taosdemoTestWithoutMetric.py
0 → 100644
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
tests/script/general/cache/new_metrics.sim
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
tests/script/general/cache/restart_metrics.sim
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
tests/script/general/cache/restart_table.sim
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
tests/script/general/db/topic1.sim
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
tests/script/general/parser/col_arithmetic_operation.sim
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
tests/script/general/parser/col_arithmetic_query.sim
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
tests/script/general/parser/fill.sim
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
tests/script/general/parser/function.sim
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
tests/script/general/parser/groupby.sim
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
tests/script/general/parser/interp_test.sim
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
tests/script/general/parser/join.sim
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
tests/script/general/parser/lastrow_query.sim
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
tests/script/general/parser/limit1_stb.sim
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
tests/script/general/parser/testSuite.sim
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
tests/script/general/parser/topbot.sim
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
tests/script/general/stream/restart_stream.sim
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
tests/script/jenkins/basic_1.txt
浏览文件 @
6ba66d58
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录