Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ad7f9b27
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ad7f9b27
编写于
12月 20, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: improve unit tests
上级
c6701221
变更
16
展开全部
隐藏空白更改
内联
并排
Showing
16 changed file
with
705 addition
and
133 deletion
+705
-133
include/libs/nodes/cmdnodes.h
include/libs/nodes/cmdnodes.h
+1
-1
include/libs/nodes/nodes.h
include/libs/nodes/nodes.h
+1
-1
include/libs/nodes/querynodes.h
include/libs/nodes/querynodes.h
+2
-2
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+1
-1
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+3
-3
source/client/src/clientRawBlockWrite.c
source/client/src/clientRawBlockWrite.c
+25
-23
source/client/src/clientSml.c
source/client/src/clientSml.c
+39
-29
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+562
-3
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+4
-4
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+1
-1
source/libs/parser/src/parAuthenticator.c
source/libs/parser/src/parAuthenticator.c
+1
-1
source/libs/parser/src/parInsertSql.c
source/libs/parser/src/parInsertSql.c
+51
-51
source/libs/parser/src/parInsertStmt.c
source/libs/parser/src/parInsertStmt.c
+4
-3
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+5
-5
source/libs/parser/test/parAlterToBalanceTest.cpp
source/libs/parser/test/parAlterToBalanceTest.cpp
+2
-2
source/libs/planner/src/planLogicCreater.c
source/libs/planner/src/planLogicCreater.c
+3
-3
未找到文件。
include/libs/nodes/cmdnodes.h
浏览文件 @
ad7f9b27
...
...
@@ -225,7 +225,7 @@ typedef struct SAlterUserStmt {
typedef
struct
SDropUserStmt
{
ENodeType
type
;
char
useName
[
TSDB_USER_LEN
];
char
use
r
Name
[
TSDB_USER_LEN
];
}
SDropUserStmt
;
typedef
struct
SCreateDnodeStmt
{
...
...
include/libs/nodes/nodes.h
浏览文件 @
ad7f9b27
...
...
@@ -117,7 +117,7 @@ typedef enum ENodeType {
// Statement nodes are used in parser and planner module.
QUERY_NODE_SET_OPERATOR
=
100
,
QUERY_NODE_SELECT_STMT
,
QUERY_NODE_VNODE_MODIF_STMT
,
QUERY_NODE_VNODE_MODIF
Y
_STMT
,
QUERY_NODE_CREATE_DATABASE_STMT
,
QUERY_NODE_DROP_DATABASE_STMT
,
QUERY_NODE_ALTER_DATABASE_STMT
,
...
...
include/libs/nodes/querynodes.h
浏览文件 @
ad7f9b27
...
...
@@ -364,7 +364,7 @@ typedef struct SVgDataBlocks {
typedef
void
(
*
FFreeDataBlockHash
)(
SHashObj
*
);
typedef
void
(
*
FFreeDataBlockArray
)(
SArray
*
);
typedef
struct
SVnodeModifOpStmt
{
typedef
struct
SVnodeModif
y
OpStmt
{
ENodeType
nodeType
;
ENodeType
sqlNodeType
;
SArray
*
pDataBlocks
;
// data block for each vgroup, SArray<SVgDataBlocks*>.
...
...
@@ -388,7 +388,7 @@ typedef struct SVnodeModifOpStmt {
FFreeDataBlockArray
freeArrayFunc
;
bool
usingTableProcessing
;
bool
fileProcessing
;
}
SVnodeModifOpStmt
;
}
SVnodeModif
y
OpStmt
;
typedef
struct
SExplainOptions
{
ENodeType
type
;
...
...
source/client/src/clientEnv.c
浏览文件 @
ad7f9b27
...
...
@@ -76,7 +76,7 @@ static void deregisterRequest(SRequestObj *pRequest) {
"current:%d, app current:%d"
,
pRequest
->
self
,
pTscObj
->
id
,
pRequest
->
requestId
,
duration
/
1000
.
0
,
num
,
currentInst
);
if
(
QUERY_NODE_VNODE_MODIF_STMT
==
pRequest
->
stmtType
)
{
if
(
QUERY_NODE_VNODE_MODIF
Y
_STMT
==
pRequest
->
stmtType
)
{
// tscPerf("insert duration %" PRId64 "us: syntax:%" PRId64 "us, ctg:%" PRId64 "us, semantic:%" PRId64
// "us, exec:%" PRId64 "us",
// duration, pRequest->metric.syntaxEnd - pRequest->metric.syntaxStart,
...
...
source/client/src/clientImpl.c
浏览文件 @
ad7f9b27
...
...
@@ -875,7 +875,7 @@ int32_t handleQueryExecRsp(SRequestObj* pRequest) {
}
static
bool
incompletaFileParsing
(
SNode
*
pStmt
)
{
return
QUERY_NODE_VNODE_MODIF
_STMT
!=
nodeType
(
pStmt
)
?
false
:
((
SVnodeModif
OpStmt
*
)
pStmt
)
->
fileProcessing
;
return
QUERY_NODE_VNODE_MODIF
Y_STMT
!=
nodeType
(
pStmt
)
?
false
:
((
SVnodeModify
OpStmt
*
)
pStmt
)
->
fileProcessing
;
}
// todo refacto the error code mgmt
...
...
@@ -954,7 +954,7 @@ SRequestObj* launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, bool keepQue
if
(
pQuery
->
pRoot
&&
!
pRequest
->
inRetry
)
{
STscObj
*
pTscObj
=
pRequest
->
pTscObj
;
SAppClusterSummary
*
pActivity
=
&
pTscObj
->
pAppInfo
->
summary
;
if
(
QUERY_NODE_VNODE_MODIF_STMT
==
pQuery
->
pRoot
->
type
)
{
if
(
QUERY_NODE_VNODE_MODIF
Y
_STMT
==
pQuery
->
pRoot
->
type
)
{
atomic_add_fetch_64
((
int64_t
*
)
&
pActivity
->
numOfInsertsReq
,
1
);
}
else
if
(
QUERY_NODE_SELECT_STMT
==
pQuery
->
pRoot
->
type
)
{
atomic_add_fetch_64
((
int64_t
*
)
&
pActivity
->
numOfQueryReq
,
1
);
...
...
@@ -1059,7 +1059,7 @@ static int32_t asyncExecSchQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaDat
}
if
(
TSDB_CODE_SUCCESS
==
code
&&
!
pRequest
->
validateOnly
)
{
SArray
*
pNodeList
=
NULL
;
if
(
QUERY_NODE_VNODE_MODIF_STMT
!=
nodeType
(
pQuery
->
pRoot
))
{
if
(
QUERY_NODE_VNODE_MODIF
Y
_STMT
!=
nodeType
(
pQuery
->
pRoot
))
{
buildAsyncExecNodeList
(
pRequest
,
&
pNodeList
,
pMnodeList
,
pResultMeta
);
}
...
...
source/client/src/clientRawBlockWrite.c
浏览文件 @
ad7f9b27
...
...
@@ -1211,7 +1211,8 @@ static void destroyVgHash(void* data) {
taosMemoryFreeClear
(
vgData
->
data
);
}
int
taos_write_raw_block_with_fields
(
TAOS
*
taos
,
int
rows
,
char
*
pData
,
const
char
*
tbname
,
TAOS_FIELD
*
fields
,
int
numFields
){
int
taos_write_raw_block_with_fields
(
TAOS
*
taos
,
int
rows
,
char
*
pData
,
const
char
*
tbname
,
TAOS_FIELD
*
fields
,
int
numFields
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
STableMeta
*
pTableMeta
=
NULL
;
SQuery
*
pQuery
=
NULL
;
...
...
@@ -1267,14 +1268,14 @@ int taos_write_raw_block_with_fields(TAOS* taos, int rows, char* pData, const ch
uint16_t
fLen
=
0
;
int32_t
rowSize
=
0
;
int16_t
nVar
=
0
;
for
(
int
i
=
0
;
i
<
pTableMeta
->
tableInfo
.
numOfColumns
;
i
++
)
{
SSchema
*
schema
=
pTableMeta
->
schema
+
i
;
fLen
+=
TYPE_BYTES
[
schema
->
type
];
rowSize
+=
schema
->
bytes
;
if
(
IS_VAR_DATA_TYPE
(
schema
->
type
))
{
nVar
++
;
}
for
(
int
i
=
0
;
i
<
pTableMeta
->
tableInfo
.
numOfColumns
;
i
++
)
{
SSchema
*
schema
=
pTableMeta
->
schema
+
i
;
fLen
+=
TYPE_BYTES
[
schema
->
type
];
rowSize
+=
schema
->
bytes
;
if
(
IS_VAR_DATA_TYPE
(
schema
->
type
))
{
nVar
++
;
}
}
fLen
-=
sizeof
(
TSKEY
);
...
...
@@ -1294,7 +1295,8 @@ int taos_write_raw_block_with_fields(TAOS* taos, int rows, char* pData, const ch
tdSRowSetTpInfo
(
&
rb
,
numOfCols
,
fLen
);
int32_t
dataLen
=
0
;
// | version | total length | total rows | total columns | flag seg| block group id | column schema | each column length |
// | version | total length | total rows | total columns | flag seg| block group id | column schema | each column
// length |
char
*
pStart
=
pData
+
getVersion1BlockMetaSize
(
pData
,
numFields
);
int32_t
*
colLength
=
(
int32_t
*
)
pStart
;
pStart
+=
sizeof
(
int32_t
)
*
numFields
;
...
...
@@ -1326,9 +1328,9 @@ int taos_write_raw_block_with_fields(TAOS* taos, int rows, char* pData, const ch
for
(
int32_t
k
=
0
;
k
<
numOfCols
;
k
++
)
{
const
SSchema
*
pColumn
=
&
pTableMeta
->
schema
[
k
];
int32_t
*
index
=
taosHashGet
(
schemaHash
,
pColumn
->
name
,
strlen
(
pColumn
->
name
));
if
(
!
index
)
{
// add none
if
(
!
index
)
{
// add none
tdAppendColValToRow
(
&
rb
,
pColumn
->
colId
,
pColumn
->
type
,
TD_VTYPE_NONE
,
NULL
,
false
,
offset
,
k
);
}
else
{
}
else
{
if
(
IS_VAR_DATA_TYPE
(
pColumn
->
type
))
{
if
(
pCol
[
*
index
].
offset
[
j
]
!=
-
1
)
{
char
*
data
=
pCol
[
*
index
].
pData
+
pCol
[
*
index
].
offset
[
j
];
...
...
@@ -1377,13 +1379,13 @@ int taos_write_raw_block_with_fields(TAOS* taos, int rows, char* pData, const ch
pQuery
->
execMode
=
QUERY_EXEC_MODE_SCHEDULE
;
pQuery
->
haveResultSet
=
false
;
pQuery
->
msgType
=
TDMT_VND_SUBMIT
;
pQuery
->
pRoot
=
(
SNode
*
)
nodesMakeNode
(
QUERY_NODE_VNODE_MODIF_STMT
);
pQuery
->
pRoot
=
(
SNode
*
)
nodesMakeNode
(
QUERY_NODE_VNODE_MODIF
Y
_STMT
);
if
(
NULL
==
pQuery
->
pRoot
)
{
uError
(
"create pQuery->pRoot error"
);
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
end
;
}
SVnodeModif
OpStmt
*
nodeStmt
=
(
SVnodeModif
OpStmt
*
)(
pQuery
->
pRoot
);
SVnodeModif
yOpStmt
*
nodeStmt
=
(
SVnodeModify
OpStmt
*
)(
pQuery
->
pRoot
);
nodeStmt
->
pDataBlocks
=
taosArrayInit
(
1
,
POINTER_BYTES
);
SVgDataBlocks
*
dst
=
taosMemoryCalloc
(
1
,
sizeof
(
SVgDataBlocks
));
...
...
@@ -1406,7 +1408,7 @@ int taos_write_raw_block_with_fields(TAOS* taos, int rows, char* pData, const ch
launchQueryImpl
(
pRequest
,
pQuery
,
true
,
NULL
);
code
=
pRequest
->
code
;
end:
end:
taosMemoryFreeClear
(
pTableMeta
);
qDestroyQuery
(
pQuery
);
taosMemoryFree
(
subReq
);
...
...
@@ -1495,7 +1497,8 @@ int taos_write_raw_block(TAOS* taos, int rows, char* pData, const char* tbname)
tdSRowSetTpInfo
(
&
rb
,
numOfCols
,
fLen
);
int32_t
dataLen
=
0
;
// | version | total length | total rows | total columns | flag seg| block group id | column schema | each column length |
// | version | total length | total rows | total columns | flag seg| block group id | column schema | each column
// length |
char
*
pStart
=
pData
+
getVersion1BlockMetaSize
(
pData
,
numOfCols
);
int32_t
*
colLength
=
(
int32_t
*
)
pStart
;
pStart
+=
sizeof
(
int32_t
)
*
numOfCols
;
...
...
@@ -1568,13 +1571,13 @@ int taos_write_raw_block(TAOS* taos, int rows, char* pData, const char* tbname)
pQuery
->
execMode
=
QUERY_EXEC_MODE_SCHEDULE
;
pQuery
->
haveResultSet
=
false
;
pQuery
->
msgType
=
TDMT_VND_SUBMIT
;
pQuery
->
pRoot
=
(
SNode
*
)
nodesMakeNode
(
QUERY_NODE_VNODE_MODIF_STMT
);
pQuery
->
pRoot
=
(
SNode
*
)
nodesMakeNode
(
QUERY_NODE_VNODE_MODIF
Y
_STMT
);
if
(
NULL
==
pQuery
->
pRoot
)
{
uError
(
"create pQuery->pRoot error"
);
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
end
;
}
SVnodeModif
OpStmt
*
nodeStmt
=
(
SVnodeModif
OpStmt
*
)(
pQuery
->
pRoot
);
SVnodeModif
yOpStmt
*
nodeStmt
=
(
SVnodeModify
OpStmt
*
)(
pQuery
->
pRoot
);
nodeStmt
->
pDataBlocks
=
taosArrayInit
(
1
,
POINTER_BYTES
);
SVgDataBlocks
*
dst
=
taosMemoryCalloc
(
1
,
sizeof
(
SVgDataBlocks
));
...
...
@@ -1825,13 +1828,13 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) {
pQuery
->
execMode
=
QUERY_EXEC_MODE_SCHEDULE
;
pQuery
->
haveResultSet
=
false
;
pQuery
->
msgType
=
TDMT_VND_SUBMIT
;
pQuery
->
pRoot
=
(
SNode
*
)
nodesMakeNode
(
QUERY_NODE_VNODE_MODIF_STMT
);
pQuery
->
pRoot
=
(
SNode
*
)
nodesMakeNode
(
QUERY_NODE_VNODE_MODIF
Y
_STMT
);
if
(
NULL
==
pQuery
->
pRoot
)
{
uError
(
"create pQuery->pRoot error"
);
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
end
;
}
SVnodeModif
OpStmt
*
nodeStmt
=
(
SVnodeModif
OpStmt
*
)(
pQuery
->
pRoot
);
SVnodeModif
yOpStmt
*
nodeStmt
=
(
SVnodeModify
OpStmt
*
)(
pQuery
->
pRoot
);
int32_t
numOfVg
=
taosHashGetSize
(
pVgHash
);
nodeStmt
->
pDataBlocks
=
taosArrayInit
(
numOfVg
,
POINTER_BYTES
);
...
...
@@ -1873,7 +1876,6 @@ end:
return
code
;
}
static
int32_t
tmqWriteRawMetaDataImpl
(
TAOS
*
taos
,
void
*
data
,
int32_t
dataLen
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
SHashObj
*
pVgHash
=
NULL
;
...
...
@@ -2131,13 +2133,13 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
pQuery
->
execMode
=
QUERY_EXEC_MODE_SCHEDULE
;
pQuery
->
haveResultSet
=
false
;
pQuery
->
msgType
=
TDMT_VND_SUBMIT
;
pQuery
->
pRoot
=
(
SNode
*
)
nodesMakeNode
(
QUERY_NODE_VNODE_MODIF_STMT
);
pQuery
->
pRoot
=
(
SNode
*
)
nodesMakeNode
(
QUERY_NODE_VNODE_MODIF
Y
_STMT
);
if
(
NULL
==
pQuery
->
pRoot
)
{
uError
(
"create pQuery->pRoot error"
);
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
end
;
}
SVnodeModif
OpStmt
*
nodeStmt
=
(
SVnodeModif
OpStmt
*
)(
pQuery
->
pRoot
);
SVnodeModif
yOpStmt
*
nodeStmt
=
(
SVnodeModify
OpStmt
*
)(
pQuery
->
pRoot
);
int32_t
numOfVg
=
taosHashGetSize
(
pVgHash
);
nodeStmt
->
pDataBlocks
=
taosArrayInit
(
numOfVg
,
POINTER_BYTES
);
...
...
@@ -2167,7 +2169,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
launchQueryImpl
(
pRequest
,
pQuery
,
true
,
NULL
);
code
=
pRequest
->
code
;
end:
end:
tDeleteSTaosxRsp
(
&
rspObj
.
rsp
);
rspObj
.
resInfo
.
pRspMsg
=
NULL
;
doFreeReqResultInfo
(
&
rspObj
.
resInfo
);
...
...
source/client/src/clientSml.c
浏览文件 @
ad7f9b27
...
...
@@ -163,9 +163,9 @@ typedef struct {
SMLProtocolType
protocol
;
int8_t
precision
;
bool
dataFormat
;
// true means that the name and order of keys in each line are the same(only for influx protocol)
bool
isRawLine
;
int32_t
ttl
;
bool
dataFormat
;
// true means that the name and order of keys in each line are the same(only for influx protocol)
bool
isRawLine
;
int32_t
ttl
;
SHashObj
*
childTables
;
SHashObj
*
superTables
;
...
...
@@ -183,20 +183,20 @@ typedef struct {
SHashObj
*
dumplicateKey
;
// for dumplicate key
SArray
*
colsContainer
;
// for cols parse, if dataFormat == false
cJSON
*
root
;
// for parse json
cJSON
*
root
;
// for parse json
}
SSmlHandle
;
//=================================================================================================
//=================================================================================================
static
volatile
int64_t
linesSmlHandleId
=
0
;
static
int64_t
smlGenId
()
{
int64_t
id
;
int64_t
id
;
do
{
id
=
atomic_add_fetch_64
(
&
linesSmlHandleId
,
1
);
do
{
id
=
atomic_add_fetch_64
(
&
linesSmlHandleId
,
1
);
}
while
(
id
==
0
);
return
id
;
return
id
;
}
static
inline
bool
smlDoubleToInt64OverFlow
(
double
num
)
{
...
...
@@ -606,7 +606,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
end:
taosHashCleanup
(
hashTmp
);
taosMemoryFreeClear
(
pTableMeta
);
// catalogRefreshTableMeta(info->pCatalog, &conn, &pName, 1);
// catalogRefreshTableMeta(info->pCatalog, &conn, &pName, 1);
return
code
;
}
...
...
@@ -1534,7 +1534,7 @@ static SSmlHandle *smlBuildSmlInfo(STscObj *pTscObj, SRequestObj *request, SMLPr
info
->
pQuery
->
execMode
=
QUERY_EXEC_MODE_SCHEDULE
;
info
->
pQuery
->
haveResultSet
=
false
;
info
->
pQuery
->
msgType
=
TDMT_VND_SUBMIT
;
info
->
pQuery
->
pRoot
=
(
SNode
*
)
nodesMakeNode
(
QUERY_NODE_VNODE_MODIF_STMT
);
info
->
pQuery
->
pRoot
=
(
SNode
*
)
nodesMakeNode
(
QUERY_NODE_VNODE_MODIF
Y
_STMT
);
if
(
NULL
==
info
->
pQuery
->
pRoot
)
{
uError
(
"SML:0x%"
PRIx64
" create info->pQuery->pRoot error"
,
info
->
id
);
goto
cleanup
;
...
...
@@ -2079,7 +2079,8 @@ static int32_t smlParseJSONString(SSmlHandle *info, cJSON *root, SSmlTableInfo *
static
int32_t
smlParseInfluxLine
(
SSmlHandle
*
info
,
const
char
*
sql
,
const
int
len
)
{
SSmlLineInfo
elements
=
{
0
};
uDebug
(
"SML:0x%"
PRIx64
" smlParseInfluxLine raw:%d, len:%d, sql:%s"
,
info
->
id
,
info
->
isRawLine
,
len
,
(
info
->
isRawLine
?
"rawdata"
:
sql
));
uDebug
(
"SML:0x%"
PRIx64
" smlParseInfluxLine raw:%d, len:%d, sql:%s"
,
info
->
id
,
info
->
isRawLine
,
len
,
(
info
->
isRawLine
?
"rawdata"
:
sql
));
int
ret
=
smlParseInfluxString
(
sql
,
sql
+
len
,
&
elements
,
&
info
->
msgBuf
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -2371,15 +2372,16 @@ static int32_t smlInsertData(SSmlHandle *info) {
}
static
void
smlPrintStatisticInfo
(
SSmlHandle
*
info
)
{
uError
(
"SML:0x%"
PRIx64
" smlInsertLines result, code:%d,lineNum:%d,stable num:%d,ctable num:%d,create stable num:%d,alter stable tag num:%d,alter stable col num:%d \
uError
(
"SML:0x%"
PRIx64
" smlInsertLines result, code:%d,lineNum:%d,stable num:%d,ctable num:%d,create stable num:%d,alter stable tag num:%d,alter stable col num:%d \
parse cost:%"
PRId64
",schema cost:%"
PRId64
",bind cost:%"
PRId64
",rpc cost:%"
PRId64
",total cost:%"
PRId64
""
,
info
->
id
,
info
->
cost
.
code
,
info
->
cost
.
lineNum
,
info
->
cost
.
numOfSTables
,
info
->
cost
.
numOfCTables
,
info
->
cost
.
numOfCreateSTables
,
info
->
cost
.
numOfAlterTagSTables
,
info
->
cost
.
numOfAlterColSTables
,
info
->
cost
.
schemaTime
-
info
->
cost
.
parse
Time
,
info
->
cost
.
insertBindTime
-
info
->
cost
.
schemaTime
,
info
->
cost
.
insertRpcTime
-
info
->
cost
.
insertBind
Time
,
info
->
cost
.
endTime
-
info
->
cost
.
insertRpcTime
,
info
->
cost
.
endTime
-
info
->
cost
.
parseTime
);
""
,
info
->
id
,
info
->
cost
.
code
,
info
->
cost
.
lineNum
,
info
->
cost
.
numOfSTables
,
info
->
cost
.
numOfCTables
,
info
->
cost
.
numOfCreateSTables
,
info
->
cost
.
numOfAlterTagSTables
,
info
->
cost
.
numOfAlterColSTables
,
info
->
cost
.
schemaTime
-
info
->
cost
.
parseTime
,
info
->
cost
.
insertBindTime
-
info
->
cost
.
schema
Time
,
info
->
cost
.
insertRpcTime
-
info
->
cost
.
insertBindTime
,
info
->
cost
.
endTime
-
info
->
cost
.
insertRpc
Time
,
info
->
cost
.
endTime
-
info
->
cost
.
parseTime
);
}
static
int32_t
smlParseLine
(
SSmlHandle
*
info
,
char
*
lines
[],
char
*
rawLine
,
char
*
rawLineEnd
,
int
numLines
)
{
...
...
@@ -2593,7 +2595,7 @@ TAOS_RES *taos_schemaless_insert_inner(SRequestObj *request, char *lines[], char
}
info
->
isRawLine
=
(
rawLine
==
NULL
);
info
->
ttl
=
ttl
;
info
->
ttl
=
ttl
;
int32_t
perBatch
=
tsSmlBatchSize
;
...
...
@@ -2684,16 +2686,19 @@ TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int pr
return
taos_schemaless_insert_ttl_with_reqid
(
taos
,
lines
,
numLines
,
protocol
,
precision
,
TSDB_DEFAULT_TABLE_TTL
,
0
);
}
TAOS_RES
*
taos_schemaless_insert_ttl
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
int
precision
,
int32_t
ttl
)
{
TAOS_RES
*
taos_schemaless_insert_ttl
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
int
precision
,
int32_t
ttl
)
{
return
taos_schemaless_insert_ttl_with_reqid
(
taos
,
lines
,
numLines
,
protocol
,
precision
,
ttl
,
0
);
}
TAOS_RES
*
taos_schemaless_insert_with_reqid
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
int
precision
,
int64_t
reqid
)
{
return
taos_schemaless_insert_ttl_with_reqid
(
taos
,
lines
,
numLines
,
protocol
,
precision
,
TSDB_DEFAULT_TABLE_TTL
,
reqid
);
TAOS_RES
*
taos_schemaless_insert_with_reqid
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
int
precision
,
int64_t
reqid
)
{
return
taos_schemaless_insert_ttl_with_reqid
(
taos
,
lines
,
numLines
,
protocol
,
precision
,
TSDB_DEFAULT_TABLE_TTL
,
reqid
);
}
TAOS_RES
*
taos_schemaless_insert_raw_ttl_with_reqid
(
TAOS
*
taos
,
char
*
lines
,
int
len
,
int32_t
*
totalRows
,
int
protocol
,
int
precision
,
int32_t
ttl
,
int64_t
reqid
)
{
int
precision
,
int32_t
ttl
,
int64_t
reqid
)
{
if
(
NULL
==
taos
)
{
terrno
=
TSDB_CODE_TSC_DISCONNECTED
;
return
NULL
;
...
...
@@ -2727,13 +2732,18 @@ TAOS_RES *taos_schemaless_insert_raw_ttl_with_reqid(TAOS *taos, char *lines, int
return
taos_schemaless_insert_inner
(
request
,
NULL
,
lines
,
lines
+
len
,
numLines
,
protocol
,
precision
,
ttl
);
}
TAOS_RES
*
taos_schemaless_insert_raw_with_reqid
(
TAOS
*
taos
,
char
*
lines
,
int
len
,
int32_t
*
totalRows
,
int
protocol
,
int
precision
,
int64_t
reqid
)
{
return
taos_schemaless_insert_raw_ttl_with_reqid
(
taos
,
lines
,
len
,
totalRows
,
protocol
,
precision
,
TSDB_DEFAULT_TABLE_TTL
,
reqid
);
TAOS_RES
*
taos_schemaless_insert_raw_with_reqid
(
TAOS
*
taos
,
char
*
lines
,
int
len
,
int32_t
*
totalRows
,
int
protocol
,
int
precision
,
int64_t
reqid
)
{
return
taos_schemaless_insert_raw_ttl_with_reqid
(
taos
,
lines
,
len
,
totalRows
,
protocol
,
precision
,
TSDB_DEFAULT_TABLE_TTL
,
reqid
);
}
TAOS_RES
*
taos_schemaless_insert_raw_ttl
(
TAOS
*
taos
,
char
*
lines
,
int
len
,
int32_t
*
totalRows
,
int
protocol
,
int
precision
,
int32_t
ttl
)
{
TAOS_RES
*
taos_schemaless_insert_raw_ttl
(
TAOS
*
taos
,
char
*
lines
,
int
len
,
int32_t
*
totalRows
,
int
protocol
,
int
precision
,
int32_t
ttl
)
{
return
taos_schemaless_insert_raw_ttl_with_reqid
(
taos
,
lines
,
len
,
totalRows
,
protocol
,
precision
,
ttl
,
0
);
}
TAOS_RES
*
taos_schemaless_insert_raw
(
TAOS
*
taos
,
char
*
lines
,
int
len
,
int32_t
*
totalRows
,
int
protocol
,
int
precision
)
{
return
taos_schemaless_insert_raw_ttl_with_reqid
(
taos
,
lines
,
len
,
totalRows
,
protocol
,
precision
,
TSDB_DEFAULT_TABLE_TTL
,
0
);
TAOS_RES
*
taos_schemaless_insert_raw
(
TAOS
*
taos
,
char
*
lines
,
int
len
,
int32_t
*
totalRows
,
int
protocol
,
int
precision
)
{
return
taos_schemaless_insert_raw_ttl_with_reqid
(
taos
,
lines
,
len
,
totalRows
,
protocol
,
precision
,
TSDB_DEFAULT_TABLE_TTL
,
0
);
}
source/libs/nodes/src/nodesCodeFuncs.c
浏览文件 @
ad7f9b27
此差异已折叠。
点击以展开。
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
ad7f9b27
...
...
@@ -305,8 +305,8 @@ SNode* nodesMakeNode(ENodeType type) {
return
makeNode
(
type
,
sizeof
(
SSetOperator
));
case
QUERY_NODE_SELECT_STMT
:
return
makeNode
(
type
,
sizeof
(
SSelectStmt
));
case
QUERY_NODE_VNODE_MODIF_STMT
:
return
makeNode
(
type
,
sizeof
(
SVnodeModifOpStmt
));
case
QUERY_NODE_VNODE_MODIF
Y
_STMT
:
return
makeNode
(
type
,
sizeof
(
SVnodeModif
y
OpStmt
));
case
QUERY_NODE_CREATE_DATABASE_STMT
:
return
makeNode
(
type
,
sizeof
(
SCreateDatabaseStmt
));
case
QUERY_NODE_DROP_DATABASE_STMT
:
...
...
@@ -818,8 +818,8 @@ void nodesDestroyNode(SNode* pNode) {
nodesDestroyNode
((
SNode
*
)
pStmt
->
pSlimit
);
break
;
}
case
QUERY_NODE_VNODE_MODIF_STMT
:
{
SVnodeModif
OpStmt
*
pStmt
=
(
SVnodeModif
OpStmt
*
)
pNode
;
case
QUERY_NODE_VNODE_MODIF
Y
_STMT
:
{
SVnodeModif
yOpStmt
*
pStmt
=
(
SVnodeModify
OpStmt
*
)
pNode
;
destroyVgDataBlockArray
(
pStmt
->
pDataBlocks
);
taosMemoryFreeClear
(
pStmt
->
pTableMeta
);
taosHashCleanup
(
pStmt
->
pVgroupsHashObj
);
...
...
source/libs/parser/src/parAstCreater.c
浏览文件 @
ad7f9b27
...
...
@@ -1474,7 +1474,7 @@ SNode* createDropUserStmt(SAstCreateContext* pCxt, SToken* pUserName) {
}
SDropUserStmt
*
pStmt
=
(
SDropUserStmt
*
)
nodesMakeNode
(
QUERY_NODE_DROP_USER_STMT
);
CHECK_OUT_OF_MEM
(
pStmt
);
COPY_STRING_FORM_ID_TOKEN
(
pStmt
->
useName
,
pUserName
);
COPY_STRING_FORM_ID_TOKEN
(
pStmt
->
use
r
Name
,
pUserName
);
return
(
SNode
*
)
pStmt
;
}
...
...
source/libs/parser/src/parAuthenticator.c
浏览文件 @
ad7f9b27
...
...
@@ -78,7 +78,7 @@ static int32_t authSetOperator(SAuthCxt* pCxt, SSetOperator* pSetOper) {
}
static
int32_t
authDropUser
(
SAuthCxt
*
pCxt
,
SDropUserStmt
*
pStmt
)
{
if
(
!
pCxt
->
pParseCxt
->
isSuperUser
||
0
==
strcmp
(
pStmt
->
useName
,
TSDB_DEFAULT_USER
))
{
if
(
!
pCxt
->
pParseCxt
->
isSuperUser
||
0
==
strcmp
(
pStmt
->
use
r
Name
,
TSDB_DEFAULT_USER
))
{
return
TSDB_CODE_PAR_PERMISSION_DENIED
;
}
return
TSDB_CODE_SUCCESS
;
...
...
source/libs/parser/src/parInsertSql.c
浏览文件 @
ad7f9b27
此差异已折叠。
点击以展开。
source/libs/parser/src/parInsertStmt.c
浏览文件 @
ad7f9b27
...
...
@@ -37,7 +37,7 @@ int32_t qBuildStmtOutput(SQuery* pQuery, SHashObj* pVgHash, SHashObj* pBlockHash
code
=
insMergeTableDataBlocks
(
pBlockHash
,
&
pVgDataBlocks
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
insBuildOutput
(
pVgHash
,
pVgDataBlocks
,
&
((
SVnodeModifOpStmt
*
)
pQuery
->
pRoot
)
->
pDataBlocks
);
code
=
insBuildOutput
(
pVgHash
,
pVgDataBlocks
,
&
((
SVnodeModif
y
OpStmt
*
)
pQuery
->
pRoot
)
->
pDataBlocks
);
}
insDestroyBlockArrayList
(
pVgDataBlocks
);
return
code
;
...
...
@@ -47,7 +47,7 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch
TAOS_MULTI_BIND
*
bind
,
char
*
msgBuf
,
int32_t
msgBufLen
)
{
STableDataBlocks
*
pDataBlock
=
(
STableDataBlocks
*
)
pBlock
;
SMsgBuf
pBuf
=
{.
buf
=
msgBuf
,
.
len
=
msgBufLen
};
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
SParsedDataColInfo
*
tags
=
(
SParsedDataColInfo
*
)
boundTags
;
if
(
NULL
==
tags
)
{
return
TSDB_CODE_APP_ERROR
;
...
...
@@ -137,7 +137,8 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch
}
SVCreateTbReq
tbReq
=
{
0
};
insBuildCreateTbReq
(
&
tbReq
,
tName
,
pTag
,
suid
,
sTableName
,
tagName
,
pDataBlock
->
pTableMeta
->
tableInfo
.
numOfTags
,
TSDB_DEFAULT_TABLE_TTL
);
insBuildCreateTbReq
(
&
tbReq
,
tName
,
pTag
,
suid
,
sTableName
,
tagName
,
pDataBlock
->
pTableMeta
->
tableInfo
.
numOfTags
,
TSDB_DEFAULT_TABLE_TTL
);
code
=
insBuildCreateTbMsg
(
pDataBlock
,
&
tbReq
);
tdDestroySVCreateTbReq
(
&
tbReq
);
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
ad7f9b27
...
...
@@ -352,7 +352,7 @@ static int32_t getTableMetaImpl(STranslateContext* pCxt, const SName* pName, STa
code
=
catalogGetTableMeta
(
pParCxt
->
pCatalog
,
&
conn
,
pName
,
pMeta
);
}
}
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
if
(
TSDB_CODE_SUCCESS
!=
code
&&
TSDB_CODE_TSC_INVALID_TABLE_NAME
!=
code
)
{
parserError
(
"0x%"
PRIx64
" catalogGetTableMeta error, code:%s, dbName:%s, tbName:%s"
,
pCxt
->
pParseCxt
->
requestId
,
tstrerror
(
code
),
pName
->
dbname
,
pName
->
tname
);
}
...
...
@@ -5110,7 +5110,7 @@ static int32_t translateAlterUser(STranslateContext* pCxt, SAlterUserStmt* pStmt
static
int32_t
translateDropUser
(
STranslateContext
*
pCxt
,
SDropUserStmt
*
pStmt
)
{
SDropUserReq
dropReq
=
{
0
};
strcpy
(
dropReq
.
user
,
pStmt
->
useName
);
strcpy
(
dropReq
.
user
,
pStmt
->
use
r
Name
);
return
buildCmdMsg
(
pCxt
,
TDMT_MND_DROP_USER
,
(
FSerializeFunc
)
tSerializeSDropUserReq
,
&
dropReq
);
}
...
...
@@ -6645,7 +6645,7 @@ static void destroyCreateTbReqBatch(void* data) {
}
int32_t
rewriteToVnodeModifyOpStmt
(
SQuery
*
pQuery
,
SArray
*
pBufArray
)
{
SVnodeModif
OpStmt
*
pNewStmt
=
(
SVnodeModifOpStmt
*
)
nodesMakeNode
(
QUERY_NODE_VNODE_MODIF
_STMT
);
SVnodeModif
yOpStmt
*
pNewStmt
=
(
SVnodeModifyOpStmt
*
)
nodesMakeNode
(
QUERY_NODE_VNODE_MODIFY
_STMT
);
if
(
pNewStmt
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
...
...
@@ -7734,9 +7734,9 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) {
pQuery
->
execMode
=
QUERY_EXEC_MODE_SCHEDULE
;
pQuery
->
msgType
=
TDMT_VND_SUBMIT
;
break
;
case
QUERY_NODE_VNODE_MODIF_STMT
:
case
QUERY_NODE_VNODE_MODIF
Y
_STMT
:
pQuery
->
execMode
=
QUERY_EXEC_MODE_SCHEDULE
;
pQuery
->
msgType
=
toMsgType
(((
SVnodeModifOpStmt
*
)
pQuery
->
pRoot
)
->
sqlNodeType
);
pQuery
->
msgType
=
toMsgType
(((
SVnodeModif
y
OpStmt
*
)
pQuery
->
pRoot
)
->
sqlNodeType
);
break
;
case
QUERY_NODE_DESCRIBE_STMT
:
case
QUERY_NODE_SHOW_CREATE_DATABASE_STMT
:
...
...
source/libs/parser/test/parAlterToBalanceTest.cpp
浏览文件 @
ad7f9b27
...
...
@@ -504,8 +504,8 @@ TEST_F(ParserInitialATest, alterTable) {
};
setCheckDdlFunc
([
&
](
const
SQuery
*
pQuery
,
ParserStage
stage
)
{
ASSERT_EQ
(
nodeType
(
pQuery
->
pRoot
),
QUERY_NODE_VNODE_MODIF_STMT
);
SVnodeModif
OpStmt
*
pStmt
=
(
SVnodeModif
OpStmt
*
)
pQuery
->
pRoot
;
ASSERT_EQ
(
nodeType
(
pQuery
->
pRoot
),
QUERY_NODE_VNODE_MODIF
Y
_STMT
);
SVnodeModif
yOpStmt
*
pStmt
=
(
SVnodeModify
OpStmt
*
)
pQuery
->
pRoot
;
ASSERT_EQ
(
pStmt
->
sqlNodeType
,
QUERY_NODE_ALTER_TABLE_STMT
);
ASSERT_NE
(
pStmt
->
pDataBlocks
,
nullptr
);
...
...
source/libs/planner/src/planLogicCreater.c
浏览文件 @
ad7f9b27
...
...
@@ -1396,7 +1396,7 @@ static int32_t getMsgType(ENodeType sqlType) {
return
TDMT_VND_SUBMIT
;
}
static
int32_t
createVnodeModifLogicNode
(
SLogicPlanContext
*
pCxt
,
SVnodeModifOpStmt
*
pStmt
,
SLogicNode
**
pLogicNode
)
{
static
int32_t
createVnodeModifLogicNode
(
SLogicPlanContext
*
pCxt
,
SVnodeModif
y
OpStmt
*
pStmt
,
SLogicNode
**
pLogicNode
)
{
SVnodeModifyLogicNode
*
pModif
=
(
SVnodeModifyLogicNode
*
)
nodesMakeNode
(
QUERY_NODE_LOGIC_PLAN_VNODE_MODIFY
);
if
(
NULL
==
pModif
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -1580,8 +1580,8 @@ static int32_t createQueryLogicNode(SLogicPlanContext* pCxt, SNode* pStmt, SLogi
switch
(
nodeType
(
pStmt
))
{
case
QUERY_NODE_SELECT_STMT
:
return
createSelectLogicNode
(
pCxt
,
(
SSelectStmt
*
)
pStmt
,
pLogicNode
);
case
QUERY_NODE_VNODE_MODIF_STMT
:
return
createVnodeModifLogicNode
(
pCxt
,
(
SVnodeModifOpStmt
*
)
pStmt
,
pLogicNode
);
case
QUERY_NODE_VNODE_MODIF
Y
_STMT
:
return
createVnodeModifLogicNode
(
pCxt
,
(
SVnodeModif
y
OpStmt
*
)
pStmt
,
pLogicNode
);
case
QUERY_NODE_EXPLAIN_STMT
:
return
createQueryLogicNode
(
pCxt
,
((
SExplainStmt
*
)
pStmt
)
->
pQuery
,
pLogicNode
);
case
QUERY_NODE_SET_OPERATOR
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录