Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f9bcea8d
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f9bcea8d
编写于
5月 14, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of
https://github.com/taosdata/TDengine
into feature/data_format
上级
4daeab93
6e7e2b26
变更
14
显示空白变更内容
内联
并排
Showing
14 changed file
with
190 addition
and
138 deletion
+190
-138
source/client/inc/clientStmt.h
source/client/inc/clientStmt.h
+0
-2
source/client/src/clientStmt.c
source/client/src/clientStmt.c
+36
-28
source/common/src/tglobal.c
source/common/src/tglobal.c
+2
-0
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+9
-8
source/libs/function/src/tudf.c
source/libs/function/src/tudf.c
+65
-65
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+8
-4
source/libs/parser/src/parser.c
source/libs/parser/src/parser.c
+1
-0
source/libs/qcom/src/querymsg.c
source/libs/qcom/src/querymsg.c
+4
-0
source/libs/scalar/inc/sclInt.h
source/libs/scalar/inc/sclInt.h
+2
-1
tests/script/api/batchprepare.c
tests/script/api/batchprepare.c
+43
-23
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+1
-1
tests/script/tsim/query/udf.sim
tests/script/tsim/query/udf.sim
+14
-1
tests/system-test/99-TDcase/TD-15554.py
tests/system-test/99-TDcase/TD-15554.py
+4
-4
tests/system-test/fulltest.sh
tests/system-test/fulltest.sh
+1
-1
未找到文件。
source/client/inc/clientStmt.h
浏览文件 @
f9bcea8d
...
@@ -71,7 +71,6 @@ typedef struct SStmtBindInfo {
...
@@ -71,7 +71,6 @@ typedef struct SStmtBindInfo {
typedef
struct
SStmtExecInfo
{
typedef
struct
SStmtExecInfo
{
int32_t
affectedRows
;
int32_t
affectedRows
;
bool
emptyRes
;
SRequestObj
*
pRequest
;
SRequestObj
*
pRequest
;
SHashObj
*
pVgHash
;
SHashObj
*
pVgHash
;
SHashObj
*
pBlockHash
;
SHashObj
*
pBlockHash
;
...
@@ -87,7 +86,6 @@ typedef struct SStmtSQLInfo {
...
@@ -87,7 +86,6 @@ typedef struct SStmtSQLInfo {
char
*
sqlStr
;
char
*
sqlStr
;
int32_t
sqlLen
;
int32_t
sqlLen
;
SArray
*
nodeList
;
SArray
*
nodeList
;
SQueryPlan
*
pQueryPlan
;
SStmtQueryResInfo
queryRes
;
SStmtQueryResInfo
queryRes
;
bool
autoCreateTbl
;
bool
autoCreateTbl
;
}
SStmtSQLInfo
;
}
SStmtSQLInfo
;
...
...
source/client/src/clientStmt.c
浏览文件 @
f9bcea8d
...
@@ -279,7 +279,6 @@ int32_t stmtCleanExecInfo(STscStmt* pStmt, bool keepTable, bool freeRequest) {
...
@@ -279,7 +279,6 @@ int32_t stmtCleanExecInfo(STscStmt* pStmt, bool keepTable, bool freeRequest) {
}
}
pStmt
->
exec
.
autoCreateTbl
=
false
;
pStmt
->
exec
.
autoCreateTbl
=
false
;
pStmt
->
exec
.
emptyRes
=
false
;
if
(
keepTable
)
{
if
(
keepTable
)
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -298,7 +297,6 @@ int32_t stmtCleanSQLInfo(STscStmt* pStmt) {
...
@@ -298,7 +297,6 @@ int32_t stmtCleanSQLInfo(STscStmt* pStmt) {
taosMemoryFree
(
pStmt
->
sql
.
queryRes
.
userFields
);
taosMemoryFree
(
pStmt
->
sql
.
queryRes
.
userFields
);
taosMemoryFree
(
pStmt
->
sql
.
sqlStr
);
taosMemoryFree
(
pStmt
->
sql
.
sqlStr
);
qDestroyQuery
(
pStmt
->
sql
.
pQuery
);
qDestroyQuery
(
pStmt
->
sql
.
pQuery
);
qDestroyQueryPlan
(
pStmt
->
sql
.
pQueryPlan
);
taosArrayDestroy
(
pStmt
->
sql
.
nodeList
);
taosArrayDestroy
(
pStmt
->
sql
.
nodeList
);
void
*
pIter
=
taosHashIterate
(
pStmt
->
sql
.
pTableCache
,
NULL
);
void
*
pIter
=
taosHashIterate
(
pStmt
->
sql
.
pTableCache
,
NULL
);
...
@@ -599,6 +597,8 @@ int32_t stmtFetchColFields(STscStmt* pStmt, int32_t* fieldNum, TAOS_FIELD** fiel
...
@@ -599,6 +597,8 @@ int32_t stmtFetchColFields(STscStmt* pStmt, int32_t* fieldNum, TAOS_FIELD** fiel
int
stmtBindBatch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
,
int32_t
colIdx
)
{
int
stmtBindBatch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
,
int32_t
colIdx
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
STMT_ERR_RET
(
stmtSwitchStatus
(
pStmt
,
STMT_BIND
));
if
(
pStmt
->
bInfo
.
needParse
&&
pStmt
->
sql
.
runTimes
&&
pStmt
->
sql
.
type
>
0
&&
if
(
pStmt
->
bInfo
.
needParse
&&
pStmt
->
sql
.
runTimes
&&
pStmt
->
sql
.
type
>
0
&&
STMT_TYPE_MULTI_INSERT
!=
pStmt
->
sql
.
type
)
{
STMT_TYPE_MULTI_INSERT
!=
pStmt
->
sql
.
type
)
{
pStmt
->
bInfo
.
needParse
=
false
;
pStmt
->
bInfo
.
needParse
=
false
;
...
@@ -617,19 +617,40 @@ int stmtBindBatch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, int32_t colIdx) {
...
@@ -617,19 +617,40 @@ int stmtBindBatch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, int32_t colIdx) {
STMT_ERR_RET
(
stmtParseSql
(
pStmt
));
STMT_ERR_RET
(
stmtParseSql
(
pStmt
));
}
}
STMT_ERR_RET
(
stmtSwitchStatus
(
pStmt
,
STMT_BIND
));
if
(
STMT_TYPE_QUERY
==
pStmt
->
sql
.
type
)
{
if
(
STMT_TYPE_QUERY
==
pStmt
->
sql
.
type
)
{
if
(
NULL
==
pStmt
->
sql
.
pQueryPlan
)
{
STMT_ERR_RET
(
qStmtBindParams
(
pStmt
->
sql
.
pQuery
,
bind
,
colIdx
,
pStmt
->
exec
.
pRequest
->
requestId
));
STMT_ERR_RET
(
getQueryPlan
(
pStmt
->
exec
.
pRequest
,
pStmt
->
sql
.
pQuery
,
&
pStmt
->
sql
.
nodeList
));
pStmt
->
sql
.
pQueryPlan
=
pStmt
->
exec
.
pRequest
->
body
.
pDag
;
SParseContext
ctx
=
{.
requestId
=
pStmt
->
exec
.
pRequest
->
requestId
,
pStmt
->
exec
.
pRequest
->
body
.
pDag
=
NULL
;
.
acctId
=
pStmt
->
taos
->
acctId
,
STMT_ERR_RET
(
stmtBackupQueryFields
(
pStmt
));
.
db
=
pStmt
->
exec
.
pRequest
->
pDb
,
}
else
{
.
topicQuery
=
false
,
STMT_ERR_RET
(
stmtRestoreQueryFields
(
pStmt
));
.
pSql
=
pStmt
->
sql
.
sqlStr
,
.
sqlLen
=
pStmt
->
sql
.
sqlLen
,
.
pMsg
=
pStmt
->
exec
.
pRequest
->
msgBuf
,
.
msgLen
=
ERROR_MSG_BUF_DEFAULT_SIZE
,
.
pTransporter
=
pStmt
->
taos
->
pAppInfo
->
pTransporter
,
.
pStmtCb
=
NULL
,
.
pUser
=
pStmt
->
taos
->
user
};
ctx
.
mgmtEpSet
=
getEpSet_s
(
&
pStmt
->
taos
->
pAppInfo
->
mgmtEp
);
STMT_ERR_RET
(
catalogGetHandle
(
pStmt
->
taos
->
pAppInfo
->
clusterId
,
&
ctx
.
pCatalog
));
STMT_ERR_RET
(
qStmtParseQuerySql
(
&
ctx
,
pStmt
->
sql
.
pQuery
));
if
(
pStmt
->
sql
.
pQuery
->
haveResultSet
)
{
setResSchemaInfo
(
&
pStmt
->
exec
.
pRequest
->
body
.
resInfo
,
pStmt
->
sql
.
pQuery
->
pResSchema
,
pStmt
->
sql
.
pQuery
->
numOfResCols
);
setResPrecision
(
&
pStmt
->
exec
.
pRequest
->
body
.
resInfo
,
pStmt
->
sql
.
pQuery
->
precision
);
}
}
STMT_RET
(
qStmtBindParam
(
pStmt
->
sql
.
pQueryPlan
,
bind
,
colIdx
,
pStmt
->
exec
.
pRequest
->
requestId
,
&
pStmt
->
exec
.
emptyRes
));
TSWAP
(
pStmt
->
exec
.
pRequest
->
dbList
,
pStmt
->
sql
.
pQuery
->
pDbList
);
TSWAP
(
pStmt
->
exec
.
pRequest
->
tableList
,
pStmt
->
sql
.
pQuery
->
pTableList
);
//if (STMT_TYPE_QUERY == pStmt->sql.queryRes) {
// STMT_ERR_RET(stmtRestoreQueryFields(pStmt));
//}
//STMT_ERR_RET(stmtBackupQueryFields(pStmt));
return
TSDB_CODE_SUCCESS
;
}
}
STableDataBlocks
**
pDataBlock
=
(
STableDataBlocks
**
)
taosHashGet
(
pStmt
->
exec
.
pBlockHash
,
pStmt
->
bInfo
.
tbFName
,
strlen
(
pStmt
->
bInfo
.
tbFName
));
STableDataBlocks
**
pDataBlock
=
(
STableDataBlocks
**
)
taosHashGet
(
pStmt
->
exec
.
pBlockHash
,
pStmt
->
bInfo
.
tbFName
,
strlen
(
pStmt
->
bInfo
.
tbFName
));
...
@@ -736,11 +757,7 @@ int stmtExec(TAOS_STMT *stmt) {
...
@@ -736,11 +757,7 @@ int stmtExec(TAOS_STMT *stmt) {
STMT_ERR_RET
(
stmtSwitchStatus
(
pStmt
,
STMT_EXECUTE
));
STMT_ERR_RET
(
stmtSwitchStatus
(
pStmt
,
STMT_EXECUTE
));
if
(
STMT_TYPE_QUERY
==
pStmt
->
sql
.
type
)
{
if
(
STMT_TYPE_QUERY
==
pStmt
->
sql
.
type
)
{
if
(
pStmt
->
exec
.
emptyRes
)
{
launchQueryImpl
(
pStmt
->
exec
.
pRequest
,
pStmt
->
sql
.
pQuery
,
TSDB_CODE_SUCCESS
,
true
,
NULL
);
pStmt
->
exec
.
pRequest
->
type
=
TSDB_SQL_RETRIEVE_EMPTY_RESULT
;
}
else
{
scheduleQuery
(
pStmt
->
exec
.
pRequest
,
pStmt
->
sql
.
pQueryPlan
,
pStmt
->
sql
.
nodeList
,
NULL
);
}
}
else
{
}
else
{
STMT_ERR_RET
(
qBuildStmtOutput
(
pStmt
->
sql
.
pQuery
,
pStmt
->
exec
.
pVgHash
,
pStmt
->
exec
.
pBlockHash
));
STMT_ERR_RET
(
qBuildStmtOutput
(
pStmt
->
sql
.
pQuery
,
pStmt
->
exec
.
pVgHash
,
pStmt
->
exec
.
pBlockHash
));
launchQueryImpl
(
pStmt
->
exec
.
pRequest
,
pStmt
->
sql
.
pQuery
,
TSDB_CODE_SUCCESS
,
true
,
(
autoCreateTbl
?
(
void
**
)
&
pRsp
:
NULL
));
launchQueryImpl
(
pStmt
->
exec
.
pRequest
,
pStmt
->
sql
.
pQuery
,
TSDB_CODE_SUCCESS
,
true
,
(
autoCreateTbl
?
(
void
**
)
&
pRsp
:
NULL
));
...
@@ -839,16 +856,7 @@ int stmtGetParamNum(TAOS_STMT* stmt, int* nums) {
...
@@ -839,16 +856,7 @@ int stmtGetParamNum(TAOS_STMT* stmt, int* nums) {
}
}
if
(
STMT_TYPE_QUERY
==
pStmt
->
sql
.
type
)
{
if
(
STMT_TYPE_QUERY
==
pStmt
->
sql
.
type
)
{
if
(
NULL
==
pStmt
->
sql
.
pQueryPlan
)
{
*
nums
=
taosArrayGetSize
(
pStmt
->
sql
.
pQuery
->
pPlaceholderValues
);
STMT_ERR_RET
(
getQueryPlan
(
pStmt
->
exec
.
pRequest
,
pStmt
->
sql
.
pQuery
,
&
pStmt
->
sql
.
nodeList
));
pStmt
->
sql
.
pQueryPlan
=
pStmt
->
exec
.
pRequest
->
body
.
pDag
;
pStmt
->
exec
.
pRequest
->
body
.
pDag
=
NULL
;
STMT_ERR_RET
(
stmtBackupQueryFields
(
pStmt
));
}
else
{
STMT_ERR_RET
(
stmtRestoreQueryFields
(
pStmt
));
}
*
nums
=
taosArrayGetSize
(
pStmt
->
sql
.
pQueryPlan
->
pPlaceholderValues
);
}
else
{
}
else
{
STMT_ERR_RET
(
stmtFetchColFields
(
stmt
,
nums
,
NULL
));
STMT_ERR_RET
(
stmtFetchColFields
(
stmt
,
nums
,
NULL
));
}
}
...
...
source/common/src/tglobal.c
浏览文件 @
f9bcea8d
...
@@ -279,6 +279,7 @@ int32_t taosAddClientLogCfg(SConfig *pCfg) {
...
@@ -279,6 +279,7 @@ int32_t taosAddClientLogCfg(SConfig *pCfg) {
if
(
cfgAddInt32
(
pCfg
,
"cDebugFlag"
,
cDebugFlag
,
0
,
255
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"cDebugFlag"
,
cDebugFlag
,
0
,
255
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"uDebugFlag"
,
uDebugFlag
,
0
,
255
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"uDebugFlag"
,
uDebugFlag
,
0
,
255
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"rpcDebugFlag"
,
rpcDebugFlag
,
0
,
255
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"rpcDebugFlag"
,
rpcDebugFlag
,
0
,
255
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"qDebugFlag"
,
qDebugFlag
,
0
,
255
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"tmrDebugFlag"
,
tmrDebugFlag
,
0
,
255
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"tmrDebugFlag"
,
tmrDebugFlag
,
0
,
255
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"jniDebugFlag"
,
jniDebugFlag
,
0
,
255
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"jniDebugFlag"
,
jniDebugFlag
,
0
,
255
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"simDebugFlag"
,
143
,
0
,
255
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"simDebugFlag"
,
143
,
0
,
255
,
1
)
!=
0
)
return
-
1
;
...
@@ -456,6 +457,7 @@ static void taosSetClientLogCfg(SConfig *pCfg) {
...
@@ -456,6 +457,7 @@ static void taosSetClientLogCfg(SConfig *pCfg) {
tsLogKeepDays
=
cfgGetItem
(
pCfg
,
"logKeepDays"
)
->
i32
;
tsLogKeepDays
=
cfgGetItem
(
pCfg
,
"logKeepDays"
)
->
i32
;
cDebugFlag
=
cfgGetItem
(
pCfg
,
"cDebugFlag"
)
->
i32
;
cDebugFlag
=
cfgGetItem
(
pCfg
,
"cDebugFlag"
)
->
i32
;
uDebugFlag
=
cfgGetItem
(
pCfg
,
"uDebugFlag"
)
->
i32
;
uDebugFlag
=
cfgGetItem
(
pCfg
,
"uDebugFlag"
)
->
i32
;
qDebugFlag
=
cfgGetItem
(
pCfg
,
"qDebugFlag"
)
->
i32
;
rpcDebugFlag
=
cfgGetItem
(
pCfg
,
"rpcDebugFlag"
)
->
i32
;
rpcDebugFlag
=
cfgGetItem
(
pCfg
,
"rpcDebugFlag"
)
->
i32
;
tmrDebugFlag
=
cfgGetItem
(
pCfg
,
"tmrDebugFlag"
)
->
i32
;
tmrDebugFlag
=
cfgGetItem
(
pCfg
,
"tmrDebugFlag"
)
->
i32
;
jniDebugFlag
=
cfgGetItem
(
pCfg
,
"jniDebugFlag"
)
->
i32
;
jniDebugFlag
=
cfgGetItem
(
pCfg
,
"jniDebugFlag"
)
->
i32
;
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
f9bcea8d
...
@@ -842,6 +842,8 @@ int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STable
...
@@ -842,6 +842,8 @@ int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STable
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
ctgDebug
(
"Got subtable meta from cache, type:%d, dbFName:%s, tbName:%s, suid:%"
PRIx64
,
tbMeta
->
tableType
,
dbFName
,
pTableName
->
tname
,
tbMeta
->
suid
);
CTG_LOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
stbLock
);
CTG_LOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
stbLock
);
STableMeta
**
stbMeta
=
taosHashGet
(
dbCache
->
tbCache
.
stbCache
,
&
tbMeta
->
suid
,
sizeof
(
tbMeta
->
suid
));
STableMeta
**
stbMeta
=
taosHashGet
(
dbCache
->
tbCache
.
stbCache
,
&
tbMeta
->
suid
,
sizeof
(
tbMeta
->
suid
));
...
@@ -1656,6 +1658,11 @@ int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, ui
...
@@ -1656,6 +1658,11 @@ int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, ui
if
(
orig
)
{
if
(
orig
)
{
origType
=
orig
->
tableType
;
origType
=
orig
->
tableType
;
if
(
origType
==
meta
->
tableType
&&
orig
->
uid
==
meta
->
uid
&&
orig
->
sversion
>=
meta
->
sversion
&&
orig
->
tversion
>=
meta
->
tversion
)
{
CTG_UNLOCK
(
CTG_READ
,
&
tbCache
->
metaLock
);
return
TSDB_CODE_SUCCESS
;
}
if
(
origType
==
TSDB_SUPER_TABLE
)
{
if
(
origType
==
TSDB_SUPER_TABLE
)
{
if
((
!
isStb
)
||
orig
->
suid
!=
meta
->
suid
)
{
if
((
!
isStb
)
||
orig
->
suid
!=
meta
->
suid
)
{
CTG_LOCK
(
CTG_WRITE
,
&
tbCache
->
stbLock
);
CTG_LOCK
(
CTG_WRITE
,
&
tbCache
->
stbLock
);
...
@@ -1693,7 +1700,7 @@ int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, ui
...
@@ -1693,7 +1700,7 @@ int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, ui
CTG_CACHE_STAT_ADD
(
tblNum
,
1
);
CTG_CACHE_STAT_ADD
(
tblNum
,
1
);
}
}
ctgDebug
(
"tbmeta updated to cache, dbFName:%s, tbName:%s, tbType:%d
"
,
dbFName
,
tbName
,
meta
->
tableType
);
ctgDebug
(
"tbmeta updated to cache, dbFName:%s, tbName:%s, tbType:%d
, suid:%"
PRIx64
,
dbFName
,
tbName
,
meta
->
tableType
,
meta
->
suid
);
ctgdShowTableMeta
(
pCtg
,
tbName
,
meta
);
ctgdShowTableMeta
(
pCtg
,
tbName
,
meta
);
if
(
!
isStb
)
{
if
(
!
isStb
)
{
...
@@ -1701,12 +1708,6 @@ int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, ui
...
@@ -1701,12 +1708,6 @@ int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, ui
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
if
(
origType
==
TSDB_SUPER_TABLE
&&
origSuid
==
meta
->
suid
)
{
CTG_UNLOCK
(
CTG_WRITE
,
&
tbCache
->
stbLock
);
CTG_UNLOCK
(
CTG_READ
,
&
tbCache
->
metaLock
);
return
TSDB_CODE_SUCCESS
;
}
STableMeta
*
tbMeta
=
taosHashGet
(
tbCache
->
metaCache
,
tbName
,
strlen
(
tbName
));
STableMeta
*
tbMeta
=
taosHashGet
(
tbCache
->
metaCache
,
tbName
,
strlen
(
tbName
));
if
(
taosHashPut
(
tbCache
->
stbCache
,
&
meta
->
suid
,
sizeof
(
meta
->
suid
),
&
tbMeta
,
POINTER_BYTES
)
!=
0
)
{
if
(
taosHashPut
(
tbCache
->
stbCache
,
&
meta
->
suid
,
sizeof
(
meta
->
suid
),
&
tbMeta
,
POINTER_BYTES
)
!=
0
)
{
CTG_UNLOCK
(
CTG_WRITE
,
&
tbCache
->
stbLock
);
CTG_UNLOCK
(
CTG_WRITE
,
&
tbCache
->
stbLock
);
...
@@ -1721,7 +1722,7 @@ int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, ui
...
@@ -1721,7 +1722,7 @@ int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, ui
CTG_UNLOCK
(
CTG_READ
,
&
tbCache
->
metaLock
);
CTG_UNLOCK
(
CTG_READ
,
&
tbCache
->
metaLock
);
ctgDebug
(
"stb updated to stbCache, dbFName:%s, tbName:%s, tbType:%d
"
,
dbFName
,
tbName
,
meta
->
tableType
);
ctgDebug
(
"stb updated to stbCache, dbFName:%s, tbName:%s, tbType:%d
, suid:%"
PRIx64
",ma:%p"
,
dbFName
,
tbName
,
meta
->
tableType
,
meta
->
suid
,
tbMeta
);
SSTableMetaVersion
metaRent
=
{.
dbId
=
dbId
,
.
suid
=
meta
->
suid
,
.
sversion
=
meta
->
sversion
,
.
tversion
=
meta
->
tversion
};
SSTableMetaVersion
metaRent
=
{.
dbId
=
dbId
,
.
suid
=
meta
->
suid
,
.
sversion
=
meta
->
sversion
,
.
tversion
=
meta
->
tversion
};
strcpy
(
metaRent
.
dbFName
,
dbFName
);
strcpy
(
metaRent
.
dbFName
,
dbFName
);
...
...
source/libs/function/src/tudf.c
浏览文件 @
f9bcea8d
...
@@ -310,28 +310,28 @@ enum {
...
@@ -310,28 +310,28 @@ enum {
};
};
int64_t
gUdfTaskSeqNum
=
0
;
int64_t
gUdfTaskSeqNum
=
0
;
typedef
struct
SUdf
d
Proxy
{
typedef
struct
SUdf
c
Proxy
{
char
udfdPipeName
[
PATH_MAX
+
UDF_LISTEN_PIPE_NAME_LEN
+
2
];
char
udfdPipeName
[
PATH_MAX
+
UDF_LISTEN_PIPE_NAME_LEN
+
2
];
uv_barrier_t
gUdfI
nitBarrier
;
uv_barrier_t
i
nitBarrier
;
uv_loop_t
gUdfd
Loop
;
uv_loop_t
uv
Loop
;
uv_thread_t
gUdfL
oopThread
;
uv_thread_t
l
oopThread
;
uv_async_t
gUdfL
oopTaskAync
;
uv_async_t
l
oopTaskAync
;
uv_async_t
gUdfL
oopStopAsync
;
uv_async_t
l
oopStopAsync
;
uv_mutex_t
gUdfT
askQueueMutex
;
uv_mutex_t
t
askQueueMutex
;
int8_t
gU
dfcState
;
int8_t
u
dfcState
;
QUEUE
gUdfT
askQueue
;
QUEUE
t
askQueue
;
QUEUE
gU
vProcTaskQueue
;
QUEUE
u
vProcTaskQueue
;
int8_t
initialized
;
int8_t
initialized
;
}
SUdf
d
Proxy
;
}
SUdf
c
Proxy
;
SUdf
d
Proxy
gUdfdProxy
=
{
0
};
SUdf
c
Proxy
gUdfdProxy
=
{
0
};
typedef
struct
SClientUdfUvSession
{
typedef
struct
SClientUdfUvSession
{
SUdf
d
Proxy
*
udfc
;
SUdf
c
Proxy
*
udfc
;
int64_t
severHandle
;
int64_t
severHandle
;
uv_pipe_t
*
udfUvPipe
;
uv_pipe_t
*
udfUvPipe
;
...
@@ -341,7 +341,7 @@ typedef struct SClientUdfUvSession {
...
@@ -341,7 +341,7 @@ typedef struct SClientUdfUvSession {
}
SClientUdfUvSession
;
}
SClientUdfUvSession
;
typedef
struct
SClientUvTaskNode
{
typedef
struct
SClientUvTaskNode
{
SUdf
d
Proxy
*
udfc
;
SUdf
c
Proxy
*
udfc
;
int8_t
type
;
int8_t
type
;
int
errCode
;
int
errCode
;
...
@@ -1055,11 +1055,11 @@ int32_t udfcCreateUvTask(SClientUdfTask *task, int8_t uvTaskType, SClientUvTaskN
...
@@ -1055,11 +1055,11 @@ int32_t udfcCreateUvTask(SClientUdfTask *task, int8_t uvTaskType, SClientUvTaskN
int32_t
udfcQueueUvTask
(
SClientUvTaskNode
*
uvTask
)
{
int32_t
udfcQueueUvTask
(
SClientUvTaskNode
*
uvTask
)
{
fnTrace
(
"queue uv task to event loop, task: %d, %p"
,
uvTask
->
type
,
uvTask
);
fnTrace
(
"queue uv task to event loop, task: %d, %p"
,
uvTask
->
type
,
uvTask
);
SUdf
d
Proxy
*
udfc
=
uvTask
->
udfc
;
SUdf
c
Proxy
*
udfc
=
uvTask
->
udfc
;
uv_mutex_lock
(
&
udfc
->
gUdfT
askQueueMutex
);
uv_mutex_lock
(
&
udfc
->
t
askQueueMutex
);
QUEUE_INSERT_TAIL
(
&
udfc
->
gUdfT
askQueue
,
&
uvTask
->
recvTaskQueue
);
QUEUE_INSERT_TAIL
(
&
udfc
->
t
askQueue
,
&
uvTask
->
recvTaskQueue
);
uv_mutex_unlock
(
&
udfc
->
gUdfT
askQueueMutex
);
uv_mutex_unlock
(
&
udfc
->
t
askQueueMutex
);
uv_async_send
(
&
udfc
->
gUdfL
oopTaskAync
);
uv_async_send
(
&
udfc
->
l
oopTaskAync
);
uv_sem_wait
(
&
uvTask
->
taskSem
);
uv_sem_wait
(
&
uvTask
->
taskSem
);
fnInfo
(
"udfc uv task finished. task: %d, %p"
,
uvTask
->
type
,
uvTask
);
fnInfo
(
"udfc uv task finished. task: %d, %p"
,
uvTask
->
type
,
uvTask
);
...
@@ -1073,7 +1073,7 @@ int32_t udfcStartUvTask(SClientUvTaskNode *uvTask) {
...
@@ -1073,7 +1073,7 @@ int32_t udfcStartUvTask(SClientUvTaskNode *uvTask) {
switch
(
uvTask
->
type
)
{
switch
(
uvTask
->
type
)
{
case
UV_TASK_CONNECT
:
{
case
UV_TASK_CONNECT
:
{
uv_pipe_t
*
pipe
=
taosMemoryMalloc
(
sizeof
(
uv_pipe_t
));
uv_pipe_t
*
pipe
=
taosMemoryMalloc
(
sizeof
(
uv_pipe_t
));
uv_pipe_init
(
&
uvTask
->
udfc
->
gUdfd
Loop
,
pipe
,
0
);
uv_pipe_init
(
&
uvTask
->
udfc
->
uv
Loop
,
pipe
,
0
);
uvTask
->
pipe
=
pipe
;
uvTask
->
pipe
=
pipe
;
SClientUvConn
*
conn
=
taosMemoryCalloc
(
1
,
sizeof
(
SClientUvConn
));
SClientUvConn
*
conn
=
taosMemoryCalloc
(
1
,
sizeof
(
SClientUvConn
));
...
@@ -1113,46 +1113,46 @@ int32_t udfcStartUvTask(SClientUvTaskNode *uvTask) {
...
@@ -1113,46 +1113,46 @@ int32_t udfcStartUvTask(SClientUvTaskNode *uvTask) {
}
}
void
udfClientAsyncCb
(
uv_async_t
*
async
)
{
void
udfClientAsyncCb
(
uv_async_t
*
async
)
{
SUdf
d
Proxy
*
udfc
=
async
->
data
;
SUdf
c
Proxy
*
udfc
=
async
->
data
;
QUEUE
wq
;
QUEUE
wq
;
uv_mutex_lock
(
&
udfc
->
gUdfT
askQueueMutex
);
uv_mutex_lock
(
&
udfc
->
t
askQueueMutex
);
QUEUE_MOVE
(
&
udfc
->
gUdfT
askQueue
,
&
wq
);
QUEUE_MOVE
(
&
udfc
->
t
askQueue
,
&
wq
);
uv_mutex_unlock
(
&
udfc
->
gUdfT
askQueueMutex
);
uv_mutex_unlock
(
&
udfc
->
t
askQueueMutex
);
while
(
!
QUEUE_EMPTY
(
&
wq
))
{
while
(
!
QUEUE_EMPTY
(
&
wq
))
{
QUEUE
*
h
=
QUEUE_HEAD
(
&
wq
);
QUEUE
*
h
=
QUEUE_HEAD
(
&
wq
);
QUEUE_REMOVE
(
h
);
QUEUE_REMOVE
(
h
);
SClientUvTaskNode
*
task
=
QUEUE_DATA
(
h
,
SClientUvTaskNode
,
recvTaskQueue
);
SClientUvTaskNode
*
task
=
QUEUE_DATA
(
h
,
SClientUvTaskNode
,
recvTaskQueue
);
udfcStartUvTask
(
task
);
udfcStartUvTask
(
task
);
QUEUE_INSERT_TAIL
(
&
udfc
->
gU
vProcTaskQueue
,
&
task
->
procTaskQueue
);
QUEUE_INSERT_TAIL
(
&
udfc
->
u
vProcTaskQueue
,
&
task
->
procTaskQueue
);
}
}
}
}
void
cleanUpUvTasks
(
SUdf
d
Proxy
*
udfc
)
{
void
cleanUpUvTasks
(
SUdf
c
Proxy
*
udfc
)
{
fnDebug
(
"clean up uv tasks"
)
fnDebug
(
"clean up uv tasks"
)
QUEUE
wq
;
QUEUE
wq
;
uv_mutex_lock
(
&
udfc
->
gUdfT
askQueueMutex
);
uv_mutex_lock
(
&
udfc
->
t
askQueueMutex
);
QUEUE_MOVE
(
&
udfc
->
gUdfT
askQueue
,
&
wq
);
QUEUE_MOVE
(
&
udfc
->
t
askQueue
,
&
wq
);
uv_mutex_unlock
(
&
udfc
->
gUdfT
askQueueMutex
);
uv_mutex_unlock
(
&
udfc
->
t
askQueueMutex
);
while
(
!
QUEUE_EMPTY
(
&
wq
))
{
while
(
!
QUEUE_EMPTY
(
&
wq
))
{
QUEUE
*
h
=
QUEUE_HEAD
(
&
wq
);
QUEUE
*
h
=
QUEUE_HEAD
(
&
wq
);
QUEUE_REMOVE
(
h
);
QUEUE_REMOVE
(
h
);
SClientUvTaskNode
*
task
=
QUEUE_DATA
(
h
,
SClientUvTaskNode
,
recvTaskQueue
);
SClientUvTaskNode
*
task
=
QUEUE_DATA
(
h
,
SClientUvTaskNode
,
recvTaskQueue
);
if
(
udfc
->
gU
dfcState
==
UDFC_STATE_STOPPING
)
{
if
(
udfc
->
u
dfcState
==
UDFC_STATE_STOPPING
)
{
task
->
errCode
=
TSDB_CODE_UDF_STOPPING
;
task
->
errCode
=
TSDB_CODE_UDF_STOPPING
;
}
}
uv_sem_post
(
&
task
->
taskSem
);
uv_sem_post
(
&
task
->
taskSem
);
}
}
while
(
!
QUEUE_EMPTY
(
&
udfc
->
gU
vProcTaskQueue
))
{
while
(
!
QUEUE_EMPTY
(
&
udfc
->
u
vProcTaskQueue
))
{
QUEUE
*
h
=
QUEUE_HEAD
(
&
udfc
->
gU
vProcTaskQueue
);
QUEUE
*
h
=
QUEUE_HEAD
(
&
udfc
->
u
vProcTaskQueue
);
QUEUE_REMOVE
(
h
);
QUEUE_REMOVE
(
h
);
SClientUvTaskNode
*
task
=
QUEUE_DATA
(
h
,
SClientUvTaskNode
,
procTaskQueue
);
SClientUvTaskNode
*
task
=
QUEUE_DATA
(
h
,
SClientUvTaskNode
,
procTaskQueue
);
if
(
udfc
->
gU
dfcState
==
UDFC_STATE_STOPPING
)
{
if
(
udfc
->
u
dfcState
==
UDFC_STATE_STOPPING
)
{
task
->
errCode
=
TSDB_CODE_UDF_STOPPING
;
task
->
errCode
=
TSDB_CODE_UDF_STOPPING
;
}
}
uv_sem_post
(
&
task
->
taskSem
);
uv_sem_post
(
&
task
->
taskSem
);
...
@@ -1160,28 +1160,28 @@ void cleanUpUvTasks(SUdfdProxy *udfc) {
...
@@ -1160,28 +1160,28 @@ void cleanUpUvTasks(SUdfdProxy *udfc) {
}
}
void
udfStopAsyncCb
(
uv_async_t
*
async
)
{
void
udfStopAsyncCb
(
uv_async_t
*
async
)
{
SUdf
d
Proxy
*
udfc
=
async
->
data
;
SUdf
c
Proxy
*
udfc
=
async
->
data
;
cleanUpUvTasks
(
udfc
);
cleanUpUvTasks
(
udfc
);
if
(
udfc
->
gU
dfcState
==
UDFC_STATE_STOPPING
)
{
if
(
udfc
->
u
dfcState
==
UDFC_STATE_STOPPING
)
{
uv_stop
(
&
udfc
->
gUdfd
Loop
);
uv_stop
(
&
udfc
->
uv
Loop
);
}
}
}
}
void
constructUdfService
(
void
*
argsThread
)
{
void
constructUdfService
(
void
*
argsThread
)
{
SUdf
dProxy
*
udfc
=
(
SUdfdProxy
*
)
argsThread
;
SUdf
cProxy
*
udfc
=
(
SUdfcProxy
*
)
argsThread
;
uv_loop_init
(
&
udfc
->
gUdfd
Loop
);
uv_loop_init
(
&
udfc
->
uv
Loop
);
uv_async_init
(
&
udfc
->
gUdfdLoop
,
&
udfc
->
gUdfL
oopTaskAync
,
udfClientAsyncCb
);
uv_async_init
(
&
udfc
->
uvLoop
,
&
udfc
->
l
oopTaskAync
,
udfClientAsyncCb
);
udfc
->
gUdfL
oopTaskAync
.
data
=
udfc
;
udfc
->
l
oopTaskAync
.
data
=
udfc
;
uv_async_init
(
&
udfc
->
gUdfdLoop
,
&
udfc
->
gUdfL
oopStopAsync
,
udfStopAsyncCb
);
uv_async_init
(
&
udfc
->
uvLoop
,
&
udfc
->
l
oopStopAsync
,
udfStopAsyncCb
);
udfc
->
gUdfL
oopStopAsync
.
data
=
udfc
;
udfc
->
l
oopStopAsync
.
data
=
udfc
;
uv_mutex_init
(
&
udfc
->
gUdfT
askQueueMutex
);
uv_mutex_init
(
&
udfc
->
t
askQueueMutex
);
QUEUE_INIT
(
&
udfc
->
gUdfT
askQueue
);
QUEUE_INIT
(
&
udfc
->
t
askQueue
);
QUEUE_INIT
(
&
udfc
->
gU
vProcTaskQueue
);
QUEUE_INIT
(
&
udfc
->
u
vProcTaskQueue
);
uv_barrier_wait
(
&
udfc
->
gUdfI
nitBarrier
);
uv_barrier_wait
(
&
udfc
->
i
nitBarrier
);
//TODO return value of uv_run
//TODO return value of uv_run
uv_run
(
&
udfc
->
gUdfd
Loop
,
UV_RUN_DEFAULT
);
uv_run
(
&
udfc
->
uv
Loop
,
UV_RUN_DEFAULT
);
uv_loop_close
(
&
udfc
->
gUdfd
Loop
);
uv_loop_close
(
&
udfc
->
uv
Loop
);
}
}
int32_t
udfcOpen
()
{
int32_t
udfcOpen
()
{
...
@@ -1189,14 +1189,14 @@ int32_t udfcOpen() {
...
@@ -1189,14 +1189,14 @@ int32_t udfcOpen() {
if
(
old
==
1
)
{
if
(
old
==
1
)
{
return
0
;
return
0
;
}
}
SUdf
d
Proxy
*
proxy
=
&
gUdfdProxy
;
SUdf
c
Proxy
*
proxy
=
&
gUdfdProxy
;
getUdfdPipeName
(
proxy
->
udfdPipeName
,
sizeof
(
proxy
->
udfdPipeName
));
getUdfdPipeName
(
proxy
->
udfdPipeName
,
sizeof
(
proxy
->
udfdPipeName
));
proxy
->
gU
dfcState
=
UDFC_STATE_STARTNG
;
proxy
->
u
dfcState
=
UDFC_STATE_STARTNG
;
uv_barrier_init
(
&
proxy
->
gUdfI
nitBarrier
,
2
);
uv_barrier_init
(
&
proxy
->
i
nitBarrier
,
2
);
uv_thread_create
(
&
proxy
->
gUdfL
oopThread
,
constructUdfService
,
proxy
);
uv_thread_create
(
&
proxy
->
l
oopThread
,
constructUdfService
,
proxy
);
atomic_store_8
(
&
proxy
->
gU
dfcState
,
UDFC_STATE_READY
);
atomic_store_8
(
&
proxy
->
u
dfcState
,
UDFC_STATE_READY
);
proxy
->
gU
dfcState
=
UDFC_STATE_READY
;
proxy
->
u
dfcState
=
UDFC_STATE_READY
;
uv_barrier_wait
(
&
proxy
->
gUdfI
nitBarrier
);
uv_barrier_wait
(
&
proxy
->
i
nitBarrier
);
fnInfo
(
"udfc initialized"
)
fnInfo
(
"udfc initialized"
)
return
0
;
return
0
;
}
}
...
@@ -1207,13 +1207,13 @@ int32_t udfcClose() {
...
@@ -1207,13 +1207,13 @@ int32_t udfcClose() {
return
0
;
return
0
;
}
}
SUdf
d
Proxy
*
udfc
=
&
gUdfdProxy
;
SUdf
c
Proxy
*
udfc
=
&
gUdfdProxy
;
udfc
->
gU
dfcState
=
UDFC_STATE_STOPPING
;
udfc
->
u
dfcState
=
UDFC_STATE_STOPPING
;
uv_async_send
(
&
udfc
->
gUdfL
oopStopAsync
);
uv_async_send
(
&
udfc
->
l
oopStopAsync
);
uv_thread_join
(
&
udfc
->
gUdfL
oopThread
);
uv_thread_join
(
&
udfc
->
l
oopThread
);
uv_mutex_destroy
(
&
udfc
->
gUdfT
askQueueMutex
);
uv_mutex_destroy
(
&
udfc
->
t
askQueueMutex
);
uv_barrier_destroy
(
&
udfc
->
gUdfI
nitBarrier
);
uv_barrier_destroy
(
&
udfc
->
i
nitBarrier
);
udfc
->
gU
dfcState
=
UDFC_STATE_INITAL
;
udfc
->
u
dfcState
=
UDFC_STATE_INITAL
;
fnInfo
(
"udfc cleaned up"
);
fnInfo
(
"udfc cleaned up"
);
return
0
;
return
0
;
}
}
...
@@ -1236,7 +1236,7 @@ int32_t udfcRunUdfUvTask(SClientUdfTask *task, int8_t uvTaskType) {
...
@@ -1236,7 +1236,7 @@ int32_t udfcRunUdfUvTask(SClientUdfTask *task, int8_t uvTaskType) {
int32_t
setupUdf
(
char
udfName
[],
UdfcFuncHandle
*
funcHandle
)
{
int32_t
setupUdf
(
char
udfName
[],
UdfcFuncHandle
*
funcHandle
)
{
fnInfo
(
"udfc setup udf. udfName: %s"
,
udfName
);
fnInfo
(
"udfc setup udf. udfName: %s"
,
udfName
);
if
(
gUdfdProxy
.
gU
dfcState
!=
UDFC_STATE_READY
)
{
if
(
gUdfdProxy
.
u
dfcState
!=
UDFC_STATE_READY
)
{
return
TSDB_CODE_UDF_INVALID_STATE
;
return
TSDB_CODE_UDF_INVALID_STATE
;
}
}
SClientUdfTask
*
task
=
taosMemoryCalloc
(
1
,
sizeof
(
SClientUdfTask
));
SClientUdfTask
*
task
=
taosMemoryCalloc
(
1
,
sizeof
(
SClientUdfTask
));
...
@@ -1484,7 +1484,7 @@ int32_t udfAggProcess(struct SqlFunctionCtx *pCtx) {
...
@@ -1484,7 +1484,7 @@ int32_t udfAggProcess(struct SqlFunctionCtx *pCtx) {
SSDataBlock
tempBlock
=
{
0
};
SSDataBlock
tempBlock
=
{
0
};
tempBlock
.
info
.
numOfCols
=
numOfCols
;
tempBlock
.
info
.
numOfCols
=
numOfCols
;
tempBlock
.
info
.
rows
=
numOf
Rows
;
tempBlock
.
info
.
rows
=
pInput
->
total
Rows
;
tempBlock
.
info
.
uid
=
pInput
->
uid
;
tempBlock
.
info
.
uid
=
pInput
->
uid
;
bool
hasVarCol
=
false
;
bool
hasVarCol
=
false
;
tempBlock
.
pDataBlock
=
taosArrayInit
(
numOfCols
,
sizeof
(
SColumnInfoData
));
tempBlock
.
pDataBlock
=
taosArrayInit
(
numOfCols
,
sizeof
(
SColumnInfoData
));
...
...
source/libs/parser/src/parInsert.c
浏览文件 @
f9bcea8d
...
@@ -1227,16 +1227,20 @@ int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery) {
...
@@ -1227,16 +1227,20 @@ int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery) {
if
(
NULL
==
*
pQuery
)
{
if
(
NULL
==
*
pQuery
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
(
*
pQuery
)
->
pTableList
=
taosArrayInit
(
taosHashGetSize
(
context
.
pTableNameHashObj
),
sizeof
(
SName
));
if
(
NULL
==
(
*
pQuery
)
->
pTableList
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
(
*
pQuery
)
->
execMode
=
QUERY_EXEC_MODE_SCHEDULE
;
(
*
pQuery
)
->
execMode
=
QUERY_EXEC_MODE_SCHEDULE
;
(
*
pQuery
)
->
haveResultSet
=
false
;
(
*
pQuery
)
->
haveResultSet
=
false
;
(
*
pQuery
)
->
msgType
=
TDMT_VND_SUBMIT
;
(
*
pQuery
)
->
msgType
=
TDMT_VND_SUBMIT
;
(
*
pQuery
)
->
pRoot
=
(
SNode
*
)
context
.
pOutput
;
(
*
pQuery
)
->
pRoot
=
(
SNode
*
)
context
.
pOutput
;
}
}
if
(
NULL
==
(
*
pQuery
)
->
pTableList
)
{
(
*
pQuery
)
->
pTableList
=
taosArrayInit
(
taosHashGetSize
(
context
.
pTableNameHashObj
),
sizeof
(
SName
));
if
(
NULL
==
(
*
pQuery
)
->
pTableList
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
context
.
pOutput
->
payloadType
=
PAYLOAD_TYPE_KV
;
context
.
pOutput
->
payloadType
=
PAYLOAD_TYPE_KV
;
int32_t
code
=
skipInsertInto
(
&
context
);
int32_t
code
=
skipInsertInto
(
&
context
);
...
...
source/libs/parser/src/parser.c
浏览文件 @
f9bcea8d
...
@@ -184,5 +184,6 @@ int32_t qStmtParseQuerySql(SParseContext* pCxt, SQuery* pQuery) {
...
@@ -184,5 +184,6 @@ int32_t qStmtParseQuerySql(SParseContext* pCxt, SQuery* pQuery) {
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
calculateConstant
(
pCxt
,
pQuery
);
code
=
calculateConstant
(
pCxt
,
pQuery
);
}
}
return
code
;
return
code
;
}
}
source/libs/qcom/src/querymsg.c
浏览文件 @
f9bcea8d
...
@@ -290,6 +290,10 @@ int32_t queryCreateTableMetaFromMsg(STableMetaRsp *msg, bool isSuperTable, STabl
...
@@ -290,6 +290,10 @@ int32_t queryCreateTableMetaFromMsg(STableMetaRsp *msg, bool isSuperTable, STabl
pTableMeta
->
sversion
=
msg
->
sversion
;
pTableMeta
->
sversion
=
msg
->
sversion
;
pTableMeta
->
tversion
=
msg
->
tversion
;
pTableMeta
->
tversion
=
msg
->
tversion
;
if
(
isSuperTable
)
{
qDebug
(
"stable %s meta returned, suid:%"
PRIx64
,
msg
->
stbName
,
pTableMeta
->
suid
);
}
pTableMeta
->
tableInfo
.
numOfTags
=
msg
->
numOfTags
;
pTableMeta
->
tableInfo
.
numOfTags
=
msg
->
numOfTags
;
pTableMeta
->
tableInfo
.
precision
=
msg
->
precision
;
pTableMeta
->
tableInfo
.
precision
=
msg
->
precision
;
pTableMeta
->
tableInfo
.
numOfColumns
=
msg
->
numOfColumns
;
pTableMeta
->
tableInfo
.
numOfColumns
=
msg
->
numOfColumns
;
...
...
source/libs/scalar/inc/sclInt.h
浏览文件 @
f9bcea8d
...
@@ -37,7 +37,8 @@ typedef struct SScalarCtx {
...
@@ -37,7 +37,8 @@ typedef struct SScalarCtx {
#define SCL_IS_CONST_NODE(_node) ((NULL == (_node)) || (QUERY_NODE_VALUE == (_node)->type) || (QUERY_NODE_NODE_LIST == (_node)->type))
#define SCL_IS_CONST_NODE(_node) ((NULL == (_node)) || (QUERY_NODE_VALUE == (_node)->type) || (QUERY_NODE_NODE_LIST == (_node)->type))
#define SCL_IS_CONST_CALC(_ctx) (NULL == (_ctx)->pBlockList)
#define SCL_IS_CONST_CALC(_ctx) (NULL == (_ctx)->pBlockList)
#define SCL_IS_NULL_VALUE_NODE(_node) ((QUERY_NODE_VALUE == nodeType(_node)) && (TSDB_DATA_TYPE_NULL == ((SValueNode *)_node)->node.resType.type) && (((SValueNode *)_node)->placeholderNo <= 0))
//#define SCL_IS_NULL_VALUE_NODE(_node) ((QUERY_NODE_VALUE == nodeType(_node)) && (TSDB_DATA_TYPE_NULL == ((SValueNode *)_node)->node.resType.type) && (((SValueNode *)_node)->placeholderNo <= 0))
#define SCL_IS_NULL_VALUE_NODE(_node) ((QUERY_NODE_VALUE == nodeType(_node)) && (TSDB_DATA_TYPE_NULL == ((SValueNode *)_node)->node.resType.type))
#define sclFatal(...) qFatal(__VA_ARGS__)
#define sclFatal(...) qFatal(__VA_ARGS__)
#define sclError(...) qError(__VA_ARGS__)
#define sclError(...) qError(__VA_ARGS__)
...
...
tests/script/api/batchprepare.c
浏览文件 @
f9bcea8d
...
@@ -9,10 +9,12 @@
...
@@ -9,10 +9,12 @@
#include <unistd.h>
#include <unistd.h>
#include "../../../include/client/taos.h"
#include "../../../include/client/taos.h"
#define FUNCTION_TEST_IDX 1
int32_t
shortColList
[]
=
{
TSDB_DATA_TYPE_TIMESTAMP
,
TSDB_DATA_TYPE_INT
};
int32_t
shortColList
[]
=
{
TSDB_DATA_TYPE_TIMESTAMP
,
TSDB_DATA_TYPE_INT
};
int32_t
fullColList
[]
=
{
TSDB_DATA_TYPE_TIMESTAMP
,
TSDB_DATA_TYPE_BOOL
,
TSDB_DATA_TYPE_TINYINT
,
TSDB_DATA_TYPE_UTINYINT
,
TSDB_DATA_TYPE_SMALLINT
,
TSDB_DATA_TYPE_USMALLINT
,
TSDB_DATA_TYPE_INT
,
TSDB_DATA_TYPE_UINT
,
TSDB_DATA_TYPE_BIGINT
,
TSDB_DATA_TYPE_UBIGINT
,
TSDB_DATA_TYPE_FLOAT
,
TSDB_DATA_TYPE_DOUBLE
,
TSDB_DATA_TYPE_BINARY
,
TSDB_DATA_TYPE_NCHAR
};
int32_t
fullColList
[]
=
{
TSDB_DATA_TYPE_TIMESTAMP
,
TSDB_DATA_TYPE_BOOL
,
TSDB_DATA_TYPE_TINYINT
,
TSDB_DATA_TYPE_UTINYINT
,
TSDB_DATA_TYPE_SMALLINT
,
TSDB_DATA_TYPE_USMALLINT
,
TSDB_DATA_TYPE_INT
,
TSDB_DATA_TYPE_UINT
,
TSDB_DATA_TYPE_BIGINT
,
TSDB_DATA_TYPE_UBIGINT
,
TSDB_DATA_TYPE_FLOAT
,
TSDB_DATA_TYPE_DOUBLE
,
TSDB_DATA_TYPE_BINARY
,
TSDB_DATA_TYPE_NCHAR
};
int32_t
bindColTypeList
[]
=
{
TSDB_DATA_TYPE_TIMESTAMP
,
TSDB_DATA_TYPE_
NCHAR
};
int32_t
bindColTypeList
[]
=
{
TSDB_DATA_TYPE_TIMESTAMP
,
TSDB_DATA_TYPE_
INT
};
int32_t
optrIdxList
[]
=
{
0
,
9
};
int32_t
optrIdxList
[]
=
{
0
,
7
};
typedef
struct
{
typedef
struct
{
char
*
oper
;
char
*
oper
;
...
@@ -53,7 +55,6 @@ FuncInfo funcInfo[] = {
...
@@ -53,7 +55,6 @@ FuncInfo funcInfo[] = {
{
"count"
,
1
},
{
"count"
,
1
},
{
"sum"
,
1
},
{
"sum"
,
1
},
{
"min"
,
1
},
{
"min"
,
1
},
{
"sin"
,
1
},
};
};
char
*
bpStbPrefix
=
"st"
;
char
*
bpStbPrefix
=
"st"
;
...
@@ -66,6 +67,10 @@ int32_t bpDefaultStbId = 1;
...
@@ -66,6 +67,10 @@ int32_t bpDefaultStbId = 1;
//char *varoperatorList[] = {">", ">=", "<", "<=", "=", "<>", "in", "not in", "like", "not like", "match", "nmatch"};
//char *varoperatorList[] = {">", ">=", "<", "<=", "=", "<>", "in", "not in", "like", "not like", "match", "nmatch"};
#define tListLen(x) (sizeof(x) / sizeof((x)[0]))
#define tListLen(x) (sizeof(x) / sizeof((x)[0]))
#define IS_SIGNED_NUMERIC_TYPE(_t) ((_t) >= TSDB_DATA_TYPE_TINYINT && (_t) <= TSDB_DATA_TYPE_BIGINT)
#define IS_UNSIGNED_NUMERIC_TYPE(_t) ((_t) >= TSDB_DATA_TYPE_UTINYINT && (_t) <= TSDB_DATA_TYPE_UBIGINT)
#define IS_FLOAT_TYPE(_t) ((_t) == TSDB_DATA_TYPE_FLOAT || (_t) == TSDB_DATA_TYPE_DOUBLE)
#define IS_NUMERIC_TYPE(_t) ((IS_SIGNED_NUMERIC_TYPE(_t)) || (IS_UNSIGNED_NUMERIC_TYPE(_t)) || (IS_FLOAT_TYPE(_t)))
typedef
struct
{
typedef
struct
{
int64_t
*
tsData
;
int64_t
*
tsData
;
...
@@ -165,8 +170,11 @@ CaseCfg gCase[] = {
...
@@ -165,8 +170,11 @@ CaseCfg gCase[] = {
// 22
// 22
{
"insert:AUTO1-FULL"
,
tListLen
(
fullColList
),
fullColList
,
TTYPE_INSERT
,
true
,
true
,
insertAUTOTest1
,
10
,
10
,
2
,
0
,
0
,
0
,
1
,
-
1
},
{
"insert:AUTO1-FULL"
,
tListLen
(
fullColList
),
fullColList
,
TTYPE_INSERT
,
true
,
true
,
insertAUTOTest1
,
10
,
10
,
2
,
0
,
0
,
0
,
1
,
-
1
},
{
"query:SUBT-COLUMN"
,
tListLen
(
fullColList
),
fullColList
,
TTYPE_QUERY
,
false
,
false
,
queryColumnTest
,
10
,
10
,
1
,
3
,
0
,
0
,
1
,
2
},
// {"query:SUBT-COLUMN", tListLen(fullColList), fullColList, TTYPE_QUERY, false, false, queryColumnTest, 10, 10, 1, 3, 0, 0, 1, 2},
{
"query:SUBT-MISC"
,
tListLen
(
fullColList
),
fullColList
,
TTYPE_QUERY
,
false
,
false
,
queryMiscTest
,
2
,
10
,
1
,
3
,
0
,
0
,
1
,
2
},
// {"query:SUBT-MISC", tListLen(fullColList), fullColList, TTYPE_QUERY, false, false, queryMiscTest, 10, 10, 1, 3, 0, 0, 1, 2},
{
"query:SUBT-COLUMN"
,
tListLen
(
fullColList
),
fullColList
,
TTYPE_QUERY
,
false
,
false
,
queryColumnTest
,
1
,
10
,
1
,
1
,
0
,
0
,
1
,
2
},
{
"query:SUBT-MISC"
,
tListLen
(
fullColList
),
fullColList
,
TTYPE_QUERY
,
false
,
false
,
queryMiscTest
,
2
,
10
,
1
,
1
,
0
,
0
,
1
,
2
},
};
};
...
@@ -181,6 +189,7 @@ typedef struct {
...
@@ -181,6 +189,7 @@ typedef struct {
bool
printQuerySql
;
bool
printQuerySql
;
bool
printStmtSql
;
bool
printStmtSql
;
bool
autoCreateTbl
;
bool
autoCreateTbl
;
bool
numericParam
;
int32_t
rowNum
;
//row num for one table
int32_t
rowNum
;
//row num for one table
int32_t
bindColNum
;
int32_t
bindColNum
;
int32_t
bindTagNum
;
int32_t
bindTagNum
;
...
@@ -207,6 +216,7 @@ CaseCtrl gCaseCtrl = { // default
...
@@ -207,6 +216,7 @@ CaseCtrl gCaseCtrl = { // default
.printQuerySql = true,
.printQuerySql = true,
.printStmtSql = true,
.printStmtSql = true,
.autoCreateTbl = false,
.autoCreateTbl = false,
.numericParam = false,
.rowNum = 0,
.rowNum = 0,
.bindColNum = 0,
.bindColNum = 0,
.bindTagNum = 0,
.bindTagNum = 0,
...
@@ -259,26 +269,22 @@ CaseCtrl gCaseCtrl = {
...
@@ -259,26 +269,22 @@ CaseCtrl gCaseCtrl = {
#if 1
#if 1
CaseCtrl
gCaseCtrl
=
{
// query case with specified col&oper
CaseCtrl
gCaseCtrl
=
{
// query case with specified col&oper
.
bindNullNum
=
0
,
.
bindNullNum
=
1
,
.
printCreateTblSql
=
false
,
.
printCreateTblSql
=
false
,
.
printQuerySql
=
true
,
.
printQuerySql
=
true
,
.
printStmtSql
=
true
,
.
printStmtSql
=
true
,
.
rowNum
=
0
,
.
rowNum
=
0
,
.
bindColNum
=
0
,
.
bindColNum
=
0
,
.
bindRowNum
=
0
,
.
bindRowNum
=
0
,
.
bindColTypeNum
=
0
,
.
optrIdxListNum
=
tListLen
(
optrIdxList
)
,
.
bindColTypeList
=
NULL
,
.
optrIdxList
=
optrIdxList
,
.
optrIdxListNum
=
0
,
.
bindColTypeNum
=
tListLen
(
bindColTypeList
)
,
.
optrIdxList
=
NULL
,
.
bindColTypeList
=
bindColTypeList
,
.
checkParamNum
=
false
,
.
checkParamNum
=
false
,
.
printRes
=
true
,
.
printRes
=
true
,
.
runTimes
=
0
,
.
runTimes
=
0
,
.
caseRunIdx
=
-
1
,
.
caseRunIdx
=
-
1
,
.
optrIdxListNum
=
0
,
.
caseIdx
=
23
,
.
optrIdxList
=
NULL
,
.
bindColTypeNum
=
0
,
.
bindColTypeList
=
NULL
,
.
caseIdx
=
24
,
.
caseNum
=
1
,
.
caseNum
=
1
,
.
caseRunNum
=
1
,
.
caseRunNum
=
1
,
};
};
...
@@ -303,11 +309,11 @@ CaseCtrl gCaseCtrl = { // query case with specified col&oper
...
@@ -303,11 +309,11 @@ CaseCtrl gCaseCtrl = { // query case with specified col&oper
.printRes = true,
.printRes = true,
.runTimes = 0,
.runTimes = 0,
.caseRunIdx = -1,
.caseRunIdx = -1,
//
.optrIdxListNum = tListLen(optrIdxList),
.optrIdxListNum = tListLen(optrIdxList),
//
.optrIdxList = optrIdxList,
.optrIdxList = optrIdxList,
//
.bindColTypeNum = tListLen(bindColTypeList),
.bindColTypeNum = tListLen(bindColTypeList),
//
.bindColTypeList = bindColTypeList,
.bindColTypeList = bindColTypeList,
.caseIdx = 2
2
,
.caseIdx = 2
4
,
.caseNum = 1,
.caseNum = 1,
.caseRunNum = 1,
.caseRunNum = 1,
};
};
...
@@ -661,11 +667,11 @@ void bpGenerateConstInFuncSQL(BindData *data, int32_t tblIdx) {
...
@@ -661,11 +667,11 @@ void bpGenerateConstInFuncSQL(BindData *data, int32_t tblIdx) {
void
generateQueryMiscSQL
(
BindData
*
data
,
int32_t
tblIdx
)
{
void
generateQueryMiscSQL
(
BindData
*
data
,
int32_t
tblIdx
)
{
switch
(
tblIdx
)
{
switch
(
tblIdx
)
{
case
0
:
case
0
:
bpGenerateConstInOpSQL
(
data
,
tblIdx
);
break
;
case
1
:
//TODO FILL TEST
//TODO FILL TEST
default:
default:
bpGenerateConstInOpSQL
(
data
,
tblIdx
);
break
;
case
FUNCTION_TEST_IDX
:
bpGenerateConstInFuncSQL
(
data
,
tblIdx
);
bpGenerateConstInFuncSQL
(
data
,
tblIdx
);
break
;
break
;
}
}
...
@@ -709,6 +715,16 @@ void generateColDataType(BindData *data, int32_t bindIdx, int32_t colIdx, int32_
...
@@ -709,6 +715,16 @@ void generateColDataType(BindData *data, int32_t bindIdx, int32_t colIdx, int32_
}
else
if
(
gCurCase
->
fullCol
)
{
}
else
if
(
gCurCase
->
fullCol
)
{
*
dataType
=
gCurCase
->
colList
[
bindIdx
];
*
dataType
=
gCurCase
->
colList
[
bindIdx
];
return
;
return
;
}
else
if
(
gCaseCtrl
.
numericParam
)
{
while
(
true
)
{
*
dataType
=
rand
()
%
(
TSDB_DATA_TYPE_MAX
-
1
)
+
1
;
if
(
!
IS_NUMERIC_TYPE
(
*
dataType
))
{
continue
;
}
break
;
}
return
;
}
else
if
(
0
==
colIdx
)
{
}
else
if
(
0
==
colIdx
)
{
*
dataType
=
TSDB_DATA_TYPE_TIMESTAMP
;
*
dataType
=
TSDB_DATA_TYPE_TIMESTAMP
;
return
;
return
;
...
@@ -1046,6 +1062,10 @@ int32_t prepareQueryMiscData(BindData *data, int32_t tblIdx) {
...
@@ -1046,6 +1062,10 @@ int32_t prepareQueryMiscData(BindData *data, int32_t tblIdx) {
data
->
binaryLen
[
i
]
=
gVarCharLen
;
data
->
binaryLen
[
i
]
=
gVarCharLen
;
}
}
if
(
tblIdx
==
FUNCTION_TEST_IDX
)
{
gCaseCtrl
.
numericParam
=
true
;
}
for
(
int
b
=
0
;
b
<
bindNum
;
b
++
)
{
for
(
int
b
=
0
;
b
<
bindNum
;
b
++
)
{
for
(
int
c
=
0
;
c
<
gCurCase
->
bindColNum
;
++
c
)
{
for
(
int
c
=
0
;
c
<
gCurCase
->
bindColNum
;
++
c
)
{
prepareColData
(
BP_BIND_COL
,
data
,
b
*
gCurCase
->
bindColNum
+
c
,
b
*
gCurCase
->
bindRowNum
,
c
);
prepareColData
(
BP_BIND_COL
,
data
,
b
*
gCurCase
->
bindColNum
+
c
,
b
*
gCurCase
->
bindRowNum
,
c
);
...
...
tests/script/jenkins/basic.txt
浏览文件 @
f9bcea8d
...
@@ -63,7 +63,7 @@
...
@@ -63,7 +63,7 @@
# ---- tstream
# ---- tstream
./test.sh -f tsim/tstream/basic0.sim
./test.sh -f tsim/tstream/basic0.sim
#
./test.sh -f tsim/tstream/basic1.sim
./test.sh -f tsim/tstream/basic1.sim
# ---- transaction
# ---- transaction
./test.sh -f tsim/trans/create_db.sim
./test.sh -f tsim/trans/create_db.sim
...
...
tests/script/tsim/query/udf.sim
浏览文件 @
f9bcea8d
...
@@ -109,6 +109,7 @@ if $data01 != 18.547236991 then
...
@@ -109,6 +109,7 @@ if $data01 != 18.547236991 then
endi
endi
sql select udf2(udf1(f2-f1)), udf2(udf1(f2/f1)) from t2;
sql select udf2(udf1(f2-f1)), udf2(udf1(f2/f1)) from t2;
print $rows , $data00 , $data01
if $rows != 1 then
if $rows != 1 then
return -1
return -1
endi
endi
...
@@ -118,7 +119,19 @@ endi
...
@@ -118,7 +119,19 @@ endi
if $data01 != 152.420471066 then
if $data01 != 152.420471066 then
return -1
return -1
endi
endi
print $rows , $data00 , $data01
sql select udf2(f2) from udf.t2 group by 1-udf1(f1);
print $rows , $data00 , $data10
if $rows != 2 then
return -1
endi
if $data00 != 2.000000000 then
return -1
endi
if $data10 != 12.083045974 then
return -1
endi
sql drop function udf1;
sql drop function udf1;
sql show functions;
sql show functions;
if $rows != 1 then
if $rows != 1 then
...
...
tests/system-test/99-TDcase/TD-15554.py
浏览文件 @
f9bcea8d
...
@@ -14,10 +14,10 @@ from util.dnodes import *
...
@@ -14,10 +14,10 @@ from util.dnodes import *
class
TDTestCase
:
class
TDTestCase
:
hostname
=
socket
.
gethostname
()
hostname
=
socket
.
gethostname
()
clientCfgDict
=
{
'qdebugflag'
:
'143'
}
#
clientCfgDict = {'qdebugflag':'143'}
updatecfgDict
=
{
'clientCfg'
:
{},
'qdebugflag'
:
'143'
}
#
updatecfgDict = {'clientCfg': {}, 'qdebugflag':'143'}
updatecfgDict
[
"clientCfg"
]
=
clientCfgDict
#
updatecfgDict["clientCfg"] = clientCfgDict
print
(
"===================: "
,
updatecfgDict
)
#
print ("===================: ", updatecfgDict)
def
init
(
self
,
conn
,
logSql
):
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
...
...
tests/system-test/fulltest.sh
浏览文件 @
f9bcea8d
...
@@ -54,4 +54,4 @@ python3 ./test.py -f 2-query/arccos.py
...
@@ -54,4 +54,4 @@ python3 ./test.py -f 2-query/arccos.py
python3 ./test.py
-f
2-query/arctan.py
python3 ./test.py
-f
2-query/arctan.py
# python3 ./test.py -f 2-query/query_cols_tags_and_or.py
# python3 ./test.py -f 2-query/query_cols_tags_and_or.py
#
python3 ./test.py -f 7-tmq/basic5.py
python3 ./test.py
-f
7-tmq/basic5.py
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录