Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e23ead7d
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看板
提交
e23ead7d
编写于
4月 07, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add create index msg
上级
36670708
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
82 addition
and
85 deletion
+82
-85
include/common/tmsg.h
include/common/tmsg.h
+1
-0
include/common/tmsgdef.h
include/common/tmsgdef.h
+2
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+79
-85
未找到文件。
include/common/tmsg.h
浏览文件 @
e23ead7d
...
@@ -2225,6 +2225,7 @@ static FORCE_INLINE void* tDecodeTSmaWrapper(void* buf, STSmaWrapper* pSW) {
...
@@ -2225,6 +2225,7 @@ static FORCE_INLINE void* tDecodeTSmaWrapper(void* buf, STSmaWrapper* pSW) {
}
}
typedef
struct
{
typedef
struct
{
int
idx
;
}
SMCreateFullTextReq
;
}
SMCreateFullTextReq
;
int32_t
tSerializeSMCreateFullTextReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateFullTextReq
*
pReq
);
int32_t
tSerializeSMCreateFullTextReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateFullTextReq
*
pReq
);
...
...
include/common/tmsgdef.h
浏览文件 @
e23ead7d
...
@@ -155,6 +155,8 @@ enum {
...
@@ -155,6 +155,8 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_STREAM
,
"mnode-create-stream"
,
SCMCreateStreamReq
,
SCMCreateStreamRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_STREAM
,
"mnode-create-stream"
,
SCMCreateStreamReq
,
SCMCreateStreamRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_STREAM
,
"mnode-alter-stream"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_STREAM
,
"mnode-alter-stream"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_STREAM
,
"mnode-drop-stream"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_STREAM
,
"mnode-drop-stream"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_INDEX
,
"mnode-create-index"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_INDEX
,
"mnode-drop-index"
,
NULL
,
NULL
)
// Requests handled by VNODE
// Requests handled by VNODE
TD_NEW_MSG_SEG
(
TDMT_VND_MSG
)
TD_NEW_MSG_SEG
(
TDMT_VND_MSG
)
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
e23ead7d
...
@@ -107,8 +107,7 @@ static int32_t getTableMetaImpl(STranslateContext* pCxt, const SName* pName, STa
...
@@ -107,8 +107,7 @@ static int32_t getTableMetaImpl(STranslateContext* pCxt, const SName* pName, STa
code
=
catalogGetTableMeta
(
pParCxt
->
pCatalog
,
pParCxt
->
pTransporter
,
&
pParCxt
->
mgmtEpSet
,
pName
,
pMeta
);
code
=
catalogGetTableMeta
(
pParCxt
->
pCatalog
,
pParCxt
->
pTransporter
,
&
pParCxt
->
mgmtEpSet
,
pName
,
pMeta
);
}
}
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
parserError
(
"catalogGetTableMeta error, code:%s, dbName:%s, tbName:%s"
,
tstrerror
(
code
),
pName
->
dbname
,
parserError
(
"catalogGetTableMeta error, code:%s, dbName:%s, tbName:%s"
,
tstrerror
(
code
),
pName
->
dbname
,
pName
->
tname
);
pName
->
tname
);
}
}
return
code
;
return
code
;
}
}
...
@@ -130,8 +129,7 @@ static int32_t getTableDistVgInfo(STranslateContext* pCxt, const SName* pName, S
...
@@ -130,8 +129,7 @@ static int32_t getTableDistVgInfo(STranslateContext* pCxt, const SName* pName, S
code
=
catalogGetTableDistVgInfo
(
pParCxt
->
pCatalog
,
pParCxt
->
pTransporter
,
&
pParCxt
->
mgmtEpSet
,
pName
,
pVgInfo
);
code
=
catalogGetTableDistVgInfo
(
pParCxt
->
pCatalog
,
pParCxt
->
pTransporter
,
&
pParCxt
->
mgmtEpSet
,
pName
,
pVgInfo
);
}
}
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
parserError
(
"catalogGetTableDistVgInfo error, code:%s, dbName:%s, tbName:%s"
,
tstrerror
(
code
),
pName
->
dbname
,
parserError
(
"catalogGetTableDistVgInfo error, code:%s, dbName:%s, tbName:%s"
,
tstrerror
(
code
),
pName
->
dbname
,
pName
->
tname
);
pName
->
tname
);
}
}
return
code
;
return
code
;
}
}
...
@@ -168,22 +166,19 @@ static int32_t getTableHashVgroupImpl(STranslateContext* pCxt, const SName* pNam
...
@@ -168,22 +166,19 @@ static int32_t getTableHashVgroupImpl(STranslateContext* pCxt, const SName* pNam
code
=
catalogGetTableHashVgroup
(
pParCxt
->
pCatalog
,
pParCxt
->
pTransporter
,
&
pParCxt
->
mgmtEpSet
,
pName
,
pInfo
);
code
=
catalogGetTableHashVgroup
(
pParCxt
->
pCatalog
,
pParCxt
->
pTransporter
,
&
pParCxt
->
mgmtEpSet
,
pName
,
pInfo
);
}
}
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
parserError
(
"catalogGetTableHashVgroup error, code:%s, dbName:%s, tbName:%s"
,
tstrerror
(
code
),
pName
->
dbname
,
parserError
(
"catalogGetTableHashVgroup error, code:%s, dbName:%s, tbName:%s"
,
tstrerror
(
code
),
pName
->
dbname
,
pName
->
tname
);
pName
->
tname
);
}
}
return
code
;
return
code
;
}
}
static
int32_t
getTableHashVgroup
(
STranslateContext
*
pCxt
,
const
char
*
pDbName
,
const
char
*
pTableName
,
static
int32_t
getTableHashVgroup
(
STranslateContext
*
pCxt
,
const
char
*
pDbName
,
const
char
*
pTableName
,
SVgroupInfo
*
pInfo
)
{
SVgroupInfo
*
pInfo
)
{
SName
name
=
{.
type
=
TSDB_TABLE_NAME_T
,
.
acctId
=
pCxt
->
pParseCxt
->
acctId
};
SName
name
=
{.
type
=
TSDB_TABLE_NAME_T
,
.
acctId
=
pCxt
->
pParseCxt
->
acctId
};
strcpy
(
name
.
dbname
,
pDbName
);
strcpy
(
name
.
dbname
,
pDbName
);
strcpy
(
name
.
tname
,
pTableName
);
strcpy
(
name
.
tname
,
pTableName
);
return
getTableHashVgroupImpl
(
pCxt
,
&
name
,
pInfo
);
return
getTableHashVgroupImpl
(
pCxt
,
&
name
,
pInfo
);
}
}
static
int32_t
getDBVgVersion
(
STranslateContext
*
pCxt
,
const
char
*
pDbFName
,
int32_t
*
pVersion
,
int64_t
*
pDbId
,
static
int32_t
getDBVgVersion
(
STranslateContext
*
pCxt
,
const
char
*
pDbFName
,
int32_t
*
pVersion
,
int64_t
*
pDbId
,
int32_t
*
pTableNum
)
{
int32_t
*
pTableNum
)
{
SParseContext
*
pParCxt
=
pCxt
->
pParseCxt
;
SParseContext
*
pParCxt
=
pCxt
->
pParseCxt
;
int32_t
code
=
collectUseDatabaseImpl
(
pDbFName
,
pCxt
->
pDbs
);
int32_t
code
=
collectUseDatabaseImpl
(
pDbFName
,
pCxt
->
pDbs
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
...
@@ -215,8 +210,7 @@ static SNodeList* getProjectList(SNode* pNode) {
...
@@ -215,8 +210,7 @@ static SNodeList* getProjectList(SNode* pNode) {
return
NULL
;
return
NULL
;
}
}
static
void
setColumnInfoBySchema
(
const
SRealTableNode
*
pTable
,
const
SSchema
*
pColSchema
,
bool
isTag
,
static
void
setColumnInfoBySchema
(
const
SRealTableNode
*
pTable
,
const
SSchema
*
pColSchema
,
bool
isTag
,
SColumnNode
*
pCol
)
{
SColumnNode
*
pCol
)
{
strcpy
(
pCol
->
dbName
,
pTable
->
table
.
dbName
);
strcpy
(
pCol
->
dbName
,
pTable
->
table
.
dbName
);
strcpy
(
pCol
->
tableAlias
,
pTable
->
table
.
tableAlias
);
strcpy
(
pCol
->
tableAlias
,
pTable
->
table
.
tableAlias
);
strcpy
(
pCol
->
tableName
,
pTable
->
table
.
tableName
);
strcpy
(
pCol
->
tableName
,
pTable
->
table
.
tableName
);
...
@@ -253,8 +247,7 @@ static void setColumnInfoByExpr(const STableNode* pTable, SExprNode* pExpr, SCol
...
@@ -253,8 +247,7 @@ static void setColumnInfoByExpr(const STableNode* pTable, SExprNode* pExpr, SCol
static
int32_t
createColumnNodeByTable
(
STranslateContext
*
pCxt
,
const
STableNode
*
pTable
,
SNodeList
*
pList
)
{
static
int32_t
createColumnNodeByTable
(
STranslateContext
*
pCxt
,
const
STableNode
*
pTable
,
SNodeList
*
pList
)
{
if
(
QUERY_NODE_REAL_TABLE
==
nodeType
(
pTable
))
{
if
(
QUERY_NODE_REAL_TABLE
==
nodeType
(
pTable
))
{
const
STableMeta
*
pMeta
=
((
SRealTableNode
*
)
pTable
)
->
pMeta
;
const
STableMeta
*
pMeta
=
((
SRealTableNode
*
)
pTable
)
->
pMeta
;
int32_t
nums
=
int32_t
nums
=
pMeta
->
tableInfo
.
numOfColumns
+
((
TSDB_SUPER_TABLE
==
pMeta
->
tableType
)
?
pMeta
->
tableInfo
.
numOfTags
:
0
);
pMeta
->
tableInfo
.
numOfColumns
+
((
TSDB_SUPER_TABLE
==
pMeta
->
tableType
)
?
pMeta
->
tableInfo
.
numOfTags
:
0
);
for
(
int32_t
i
=
0
;
i
<
nums
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
nums
;
++
i
)
{
SColumnNode
*
pCol
=
(
SColumnNode
*
)
nodesMakeNode
(
QUERY_NODE_COLUMN
);
SColumnNode
*
pCol
=
(
SColumnNode
*
)
nodesMakeNode
(
QUERY_NODE_COLUMN
);
if
(
NULL
==
pCol
)
{
if
(
NULL
==
pCol
)
{
...
@@ -378,8 +371,7 @@ static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode* pCol) {
...
@@ -378,8 +371,7 @@ static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode* pCol) {
static
EDealRes
translateValue
(
STranslateContext
*
pCxt
,
SValueNode
*
pVal
)
{
static
EDealRes
translateValue
(
STranslateContext
*
pCxt
,
SValueNode
*
pVal
)
{
if
(
pVal
->
isDuration
)
{
if
(
pVal
->
isDuration
)
{
if
(
parseNatualDuration
(
pVal
->
literal
,
strlen
(
pVal
->
literal
),
&
pVal
->
datum
.
i
,
&
pVal
->
unit
,
if
(
parseNatualDuration
(
pVal
->
literal
,
strlen
(
pVal
->
literal
),
&
pVal
->
datum
.
i
,
&
pVal
->
unit
,
pVal
->
node
.
resType
.
precision
)
!=
TSDB_CODE_SUCCESS
)
{
pVal
->
node
.
resType
.
precision
)
!=
TSDB_CODE_SUCCESS
)
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
pVal
->
literal
);
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
pVal
->
literal
);
}
}
}
else
{
}
else
{
...
@@ -423,8 +415,7 @@ static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) {
...
@@ -423,8 +415,7 @@ static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) {
break
;
break
;
}
}
case
TSDB_DATA_TYPE_TIMESTAMP
:
{
case
TSDB_DATA_TYPE_TIMESTAMP
:
{
if
(
taosParseTime
(
pVal
->
literal
,
&
pVal
->
datum
.
i
,
pVal
->
node
.
resType
.
bytes
,
pVal
->
node
.
resType
.
precision
,
if
(
taosParseTime
(
pVal
->
literal
,
&
pVal
->
datum
.
i
,
pVal
->
node
.
resType
.
bytes
,
pVal
->
node
.
resType
.
precision
,
tsDaylight
)
!=
TSDB_CODE_SUCCESS
)
{
tsDaylight
)
!=
TSDB_CODE_SUCCESS
)
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
pVal
->
literal
);
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
pVal
->
literal
);
}
}
break
;
break
;
...
@@ -455,15 +446,13 @@ static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) {
...
@@ -455,15 +446,13 @@ static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) {
SDataType
ldt
=
((
SExprNode
*
)(
pOp
->
pLeft
))
->
resType
;
SDataType
ldt
=
((
SExprNode
*
)(
pOp
->
pLeft
))
->
resType
;
SDataType
rdt
=
((
SExprNode
*
)(
pOp
->
pRight
))
->
resType
;
SDataType
rdt
=
((
SExprNode
*
)(
pOp
->
pRight
))
->
resType
;
if
(
nodesIsArithmeticOp
(
pOp
))
{
if
(
nodesIsArithmeticOp
(
pOp
))
{
if
(
TSDB_DATA_TYPE_JSON
==
ldt
.
type
||
TSDB_DATA_TYPE_BLOB
==
ldt
.
type
||
TSDB_DATA_TYPE_JSON
==
rdt
.
type
||
if
(
TSDB_DATA_TYPE_JSON
==
ldt
.
type
||
TSDB_DATA_TYPE_BLOB
==
ldt
.
type
||
TSDB_DATA_TYPE_JSON
==
rdt
.
type
||
TSDB_DATA_TYPE_BLOB
==
rdt
.
type
)
{
TSDB_DATA_TYPE_BLOB
==
rdt
.
type
)
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
((
SExprNode
*
)(
pOp
->
pRight
))
->
aliasName
);
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
((
SExprNode
*
)(
pOp
->
pRight
))
->
aliasName
);
}
}
pOp
->
node
.
resType
.
type
=
TSDB_DATA_TYPE_DOUBLE
;
pOp
->
node
.
resType
.
type
=
TSDB_DATA_TYPE_DOUBLE
;
pOp
->
node
.
resType
.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_DOUBLE
].
bytes
;
pOp
->
node
.
resType
.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_DOUBLE
].
bytes
;
}
else
if
(
nodesIsComparisonOp
(
pOp
))
{
}
else
if
(
nodesIsComparisonOp
(
pOp
))
{
if
(
TSDB_DATA_TYPE_JSON
==
ldt
.
type
||
TSDB_DATA_TYPE_BLOB
==
ldt
.
type
||
TSDB_DATA_TYPE_JSON
==
rdt
.
type
||
if
(
TSDB_DATA_TYPE_JSON
==
ldt
.
type
||
TSDB_DATA_TYPE_BLOB
==
ldt
.
type
||
TSDB_DATA_TYPE_JSON
==
rdt
.
type
||
TSDB_DATA_TYPE_BLOB
==
rdt
.
type
)
{
TSDB_DATA_TYPE_BLOB
==
rdt
.
type
)
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
((
SExprNode
*
)(
pOp
->
pRight
))
->
aliasName
);
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
((
SExprNode
*
)(
pOp
->
pRight
))
->
aliasName
);
}
}
pOp
->
node
.
resType
.
type
=
TSDB_DATA_TYPE_BOOL
;
pOp
->
node
.
resType
.
type
=
TSDB_DATA_TYPE_BOOL
;
...
@@ -531,9 +520,7 @@ static int32_t translateExprList(STranslateContext* pCxt, SNodeList* pList) {
...
@@ -531,9 +520,7 @@ static int32_t translateExprList(STranslateContext* pCxt, SNodeList* pList) {
static
bool
isAliasColumn
(
SColumnNode
*
pCol
)
{
return
(
'\0'
==
pCol
->
tableAlias
[
0
]);
}
static
bool
isAliasColumn
(
SColumnNode
*
pCol
)
{
return
(
'\0'
==
pCol
->
tableAlias
[
0
]);
}
static
bool
isDistinctOrderBy
(
STranslateContext
*
pCxt
)
{
static
bool
isDistinctOrderBy
(
STranslateContext
*
pCxt
)
{
return
(
SQL_CLAUSE_ORDER_BY
==
pCxt
->
currClause
&&
pCxt
->
pCurrStmt
->
isDistinct
);
}
return
(
SQL_CLAUSE_ORDER_BY
==
pCxt
->
currClause
&&
pCxt
->
pCurrStmt
->
isDistinct
);
}
static
SNodeList
*
getGroupByList
(
STranslateContext
*
pCxt
)
{
static
SNodeList
*
getGroupByList
(
STranslateContext
*
pCxt
)
{
if
(
isDistinctOrderBy
(
pCxt
))
{
if
(
isDistinctOrderBy
(
pCxt
))
{
...
@@ -561,8 +548,7 @@ static EDealRes doCheckExprForGroupBy(SNode* pNode, void* pContext) {
...
@@ -561,8 +548,7 @@ static EDealRes doCheckExprForGroupBy(SNode* pNode, void* pContext) {
if
(
!
nodesIsExprNode
(
pNode
)
||
(
QUERY_NODE_COLUMN
==
nodeType
(
pNode
)
&&
isAliasColumn
((
SColumnNode
*
)
pNode
)))
{
if
(
!
nodesIsExprNode
(
pNode
)
||
(
QUERY_NODE_COLUMN
==
nodeType
(
pNode
)
&&
isAliasColumn
((
SColumnNode
*
)
pNode
)))
{
return
DEAL_RES_CONTINUE
;
return
DEAL_RES_CONTINUE
;
}
}
if
(
QUERY_NODE_FUNCTION
==
nodeType
(
pNode
)
&&
fmIsAggFunc
(((
SFunctionNode
*
)
pNode
)
->
funcId
)
&&
if
(
QUERY_NODE_FUNCTION
==
nodeType
(
pNode
)
&&
fmIsAggFunc
(((
SFunctionNode
*
)
pNode
)
->
funcId
)
&&
!
isDistinctOrderBy
(
pCxt
))
{
!
isDistinctOrderBy
(
pCxt
))
{
return
DEAL_RES_IGNORE_CHILD
;
return
DEAL_RES_IGNORE_CHILD
;
}
}
SNode
*
pGroupNode
;
SNode
*
pGroupNode
;
...
@@ -572,8 +558,7 @@ static EDealRes doCheckExprForGroupBy(SNode* pNode, void* pContext) {
...
@@ -572,8 +558,7 @@ static EDealRes doCheckExprForGroupBy(SNode* pNode, void* pContext) {
}
}
}
}
if
(
QUERY_NODE_COLUMN
==
nodeType
(
pNode
)
||
if
(
QUERY_NODE_COLUMN
==
nodeType
(
pNode
)
||
(
QUERY_NODE_FUNCTION
==
nodeType
(
pNode
)
&&
fmIsAggFunc
(((
SFunctionNode
*
)
pNode
)
->
funcId
)
&&
(
QUERY_NODE_FUNCTION
==
nodeType
(
pNode
)
&&
fmIsAggFunc
(((
SFunctionNode
*
)
pNode
)
->
funcId
)
&&
isDistinctOrderBy
(
pCxt
)))
{
isDistinctOrderBy
(
pCxt
)))
{
return
generateDealNodeErrMsg
(
pCxt
,
getGroupByErrorCode
(
pCxt
));
return
generateDealNodeErrMsg
(
pCxt
,
getGroupByErrorCode
(
pCxt
));
}
}
return
DEAL_RES_CONTINUE
;
return
DEAL_RES_CONTINUE
;
...
@@ -693,9 +678,7 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) {
...
@@ -693,9 +678,7 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) {
SRealTableNode
*
pRealTable
=
(
SRealTableNode
*
)
pTable
;
SRealTableNode
*
pRealTable
=
(
SRealTableNode
*
)
pTable
;
pRealTable
->
ratio
=
(
NULL
!=
pCxt
->
pExplainOpt
?
pCxt
->
pExplainOpt
->
ratio
:
1
.
0
);
pRealTable
->
ratio
=
(
NULL
!=
pCxt
->
pExplainOpt
?
pCxt
->
pExplainOpt
->
ratio
:
1
.
0
);
SName
name
;
SName
name
;
code
=
getTableMetaImpl
(
code
=
getTableMetaImpl
(
pCxt
,
toName
(
pCxt
->
pParseCxt
->
acctId
,
pRealTable
->
table
.
dbName
,
pRealTable
->
table
.
tableName
,
&
name
),
&
(
pRealTable
->
pMeta
));
pCxt
,
toName
(
pCxt
->
pParseCxt
->
acctId
,
pRealTable
->
table
.
dbName
,
pRealTable
->
table
.
tableName
,
&
name
),
&
(
pRealTable
->
pMeta
));
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_TABLE_NOT_EXIST
,
pRealTable
->
table
.
tableName
);
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_TABLE_NOT_EXIST
,
pRealTable
->
table
.
tableName
);
}
}
...
@@ -782,8 +765,7 @@ static int32_t getPositionValue(const SValueNode* pVal) {
...
@@ -782,8 +765,7 @@ static int32_t getPositionValue(const SValueNode* pVal) {
return
-
1
;
return
-
1
;
}
}
static
int32_t
translateOrderByPosition
(
STranslateContext
*
pCxt
,
SNodeList
*
pProjectionList
,
SNodeList
*
pOrderByList
,
static
int32_t
translateOrderByPosition
(
STranslateContext
*
pCxt
,
SNodeList
*
pProjectionList
,
SNodeList
*
pOrderByList
,
bool
*
pOther
)
{
bool
*
pOther
)
{
*
pOther
=
false
;
*
pOther
=
false
;
SNode
*
pNode
;
SNode
*
pNode
;
FOREACH
(
pNode
,
pOrderByList
)
{
FOREACH
(
pNode
,
pOrderByList
)
{
...
@@ -954,8 +936,7 @@ static int32_t buildCreateDbRetentions(const SNodeList* pRetentions, SCreateDbRe
...
@@ -954,8 +936,7 @@ static int32_t buildCreateDbRetentions(const SNodeList* pRetentions, SCreateDbRe
pFreq
=
(
SValueNode
*
)
pNode
;
pFreq
=
(
SValueNode
*
)
pNode
;
}
else
{
}
else
{
pKeep
=
(
SValueNode
*
)
pNode
;
pKeep
=
(
SValueNode
*
)
pNode
;
SRetention
retention
=
{
SRetention
retention
=
{.
freq
=
pFreq
->
datum
.
i
,
.
freqUnit
=
pFreq
->
unit
,
.
keep
=
pKeep
->
datum
.
i
,
.
keepUnit
=
pKeep
->
unit
};
.
freq
=
pFreq
->
datum
.
i
,
.
freqUnit
=
pFreq
->
unit
,
.
keep
=
pKeep
->
datum
.
i
,
.
keepUnit
=
pKeep
->
unit
};
taosArrayPush
(
pReq
->
pRetensions
,
&
retention
);
taosArrayPush
(
pReq
->
pRetensions
,
&
retention
);
}
}
}
}
...
@@ -1235,8 +1216,7 @@ static int32_t translateDropTable(STranslateContext* pCxt, SDropTableStmt* pStmt
...
@@ -1235,8 +1216,7 @@ static int32_t translateDropTable(STranslateContext* pCxt, SDropTableStmt* pStmt
STableMeta
*
pTableMeta
=
NULL
;
STableMeta
*
pTableMeta
=
NULL
;
SName
tableName
;
SName
tableName
;
int32_t
code
=
getTableMetaImpl
(
int32_t
code
=
getTableMetaImpl
(
pCxt
,
toName
(
pCxt
->
pParseCxt
->
acctId
,
pClause
->
dbName
,
pClause
->
tableName
,
&
tableName
),
&
pTableMeta
);
pCxt
,
toName
(
pCxt
->
pParseCxt
->
acctId
,
pClause
->
dbName
,
pClause
->
tableName
,
&
tableName
),
&
pTableMeta
);
if
((
TSDB_CODE_TDB_INVALID_TABLE_ID
==
code
||
TSDB_CODE_VND_TB_NOT_EXIST
==
code
)
&&
pClause
->
ignoreNotExists
)
{
if
((
TSDB_CODE_TDB_INVALID_TABLE_ID
==
code
||
TSDB_CODE_VND_TB_NOT_EXIST
==
code
)
&&
pClause
->
ignoreNotExists
)
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -1584,8 +1564,7 @@ static int32_t getSmaIndexBuildAst(STranslateContext* pCxt, SCreateIndexStmt* pS
...
@@ -1584,8 +1564,7 @@ static int32_t getSmaIndexBuildAst(STranslateContext* pCxt, SCreateIndexStmt* pS
pInterval
->
pInterval
=
nodesCloneNode
(
pStmt
->
pOptions
->
pInterval
);
pInterval
->
pInterval
=
nodesCloneNode
(
pStmt
->
pOptions
->
pInterval
);
pInterval
->
pOffset
=
nodesCloneNode
(
pStmt
->
pOptions
->
pOffset
);
pInterval
->
pOffset
=
nodesCloneNode
(
pStmt
->
pOptions
->
pOffset
);
pInterval
->
pSliding
=
nodesCloneNode
(
pStmt
->
pOptions
->
pSliding
);
pInterval
->
pSliding
=
nodesCloneNode
(
pStmt
->
pOptions
->
pSliding
);
if
(
NULL
==
pInterval
->
pCol
||
NULL
==
pInterval
->
pInterval
||
if
(
NULL
==
pInterval
->
pCol
||
NULL
==
pInterval
->
pInterval
||
(
NULL
!=
pStmt
->
pOptions
->
pOffset
&&
NULL
==
pInterval
->
pOffset
)
||
(
NULL
!=
pStmt
->
pOptions
->
pOffset
&&
NULL
==
pInterval
->
pOffset
)
||
(
NULL
!=
pStmt
->
pOptions
->
pSliding
&&
NULL
==
pInterval
->
pSliding
))
{
(
NULL
!=
pStmt
->
pOptions
->
pSliding
&&
NULL
==
pInterval
->
pSliding
))
{
nodesDestroyNode
(
pSelect
);
nodesDestroyNode
(
pSelect
);
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
...
@@ -1613,10 +1592,8 @@ static int32_t buildCreateSmaReq(STranslateContext* pCxt, SCreateIndexStmt* pStm
...
@@ -1613,10 +1592,8 @@ static int32_t buildCreateSmaReq(STranslateContext* pCxt, SCreateIndexStmt* pStm
pReq
->
interval
=
((
SValueNode
*
)
pStmt
->
pOptions
->
pInterval
)
->
datum
.
i
;
pReq
->
interval
=
((
SValueNode
*
)
pStmt
->
pOptions
->
pInterval
)
->
datum
.
i
;
pReq
->
intervalUnit
=
((
SValueNode
*
)
pStmt
->
pOptions
->
pInterval
)
->
unit
;
pReq
->
intervalUnit
=
((
SValueNode
*
)
pStmt
->
pOptions
->
pInterval
)
->
unit
;
pReq
->
offset
=
(
NULL
!=
pStmt
->
pOptions
->
pOffset
?
((
SValueNode
*
)
pStmt
->
pOptions
->
pOffset
)
->
datum
.
i
:
0
);
pReq
->
offset
=
(
NULL
!=
pStmt
->
pOptions
->
pOffset
?
((
SValueNode
*
)
pStmt
->
pOptions
->
pOffset
)
->
datum
.
i
:
0
);
pReq
->
sliding
=
pReq
->
sliding
=
(
NULL
!=
pStmt
->
pOptions
->
pSliding
?
((
SValueNode
*
)
pStmt
->
pOptions
->
pSliding
)
->
datum
.
i
:
pReq
->
interval
);
(
NULL
!=
pStmt
->
pOptions
->
pSliding
?
((
SValueNode
*
)
pStmt
->
pOptions
->
pSliding
)
->
datum
.
i
:
pReq
->
interval
);
pReq
->
slidingUnit
=
(
NULL
!=
pStmt
->
pOptions
->
pSliding
?
((
SValueNode
*
)
pStmt
->
pOptions
->
pSliding
)
->
unit
:
pReq
->
intervalUnit
);
pReq
->
slidingUnit
=
(
NULL
!=
pStmt
->
pOptions
->
pSliding
?
((
SValueNode
*
)
pStmt
->
pOptions
->
pSliding
)
->
unit
:
pReq
->
intervalUnit
);
int32_t
code
=
getSmaIndexDstVgId
(
pCxt
,
pStmt
->
tableName
,
&
pReq
->
dstVgId
);
int32_t
code
=
getSmaIndexDstVgId
(
pCxt
,
pStmt
->
tableName
,
&
pReq
->
dstVgId
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
...
@@ -1634,14 +1611,13 @@ static int32_t buildCreateSmaReq(STranslateContext* pCxt, SCreateIndexStmt* pStm
...
@@ -1634,14 +1611,13 @@ static int32_t buildCreateSmaReq(STranslateContext* pCxt, SCreateIndexStmt* pStm
static
int32_t
translateCreateSmaIndex
(
STranslateContext
*
pCxt
,
SCreateIndexStmt
*
pStmt
)
{
static
int32_t
translateCreateSmaIndex
(
STranslateContext
*
pCxt
,
SCreateIndexStmt
*
pStmt
)
{
if
(
DEAL_RES_ERROR
==
translateValue
(
pCxt
,
(
SValueNode
*
)
pStmt
->
pOptions
->
pInterval
)
||
if
(
DEAL_RES_ERROR
==
translateValue
(
pCxt
,
(
SValueNode
*
)
pStmt
->
pOptions
->
pInterval
)
||
(
NULL
!=
pStmt
->
pOptions
->
pOffset
&&
(
NULL
!=
pStmt
->
pOptions
->
pOffset
&&
DEAL_RES_ERROR
==
translateValue
(
pCxt
,
(
SValueNode
*
)
pStmt
->
pOptions
->
pOffset
))
||
DEAL_RES_ERROR
==
translateValue
(
pCxt
,
(
SValueNode
*
)
pStmt
->
pOptions
->
pOffset
))
||
(
NULL
!=
pStmt
->
pOptions
->
pSliding
&&
DEAL_RES_ERROR
==
translateValue
(
pCxt
,
(
SValueNode
*
)
pStmt
->
pOptions
->
pSliding
)))
{
(
NULL
!=
pStmt
->
pOptions
->
pSliding
&&
DEAL_RES_ERROR
==
translateValue
(
pCxt
,
(
SValueNode
*
)
pStmt
->
pOptions
->
pSliding
)))
{
return
pCxt
->
errCode
;
return
pCxt
->
errCode
;
}
}
SMCreateSmaReq
createSmaReq
=
{
0
};
SMCreateSmaReq
createSmaReq
=
{
0
};
int32_t
code
=
buildCreateSmaReq
(
pCxt
,
pStmt
,
&
createSmaReq
);
int32_t
code
=
buildCreateSmaReq
(
pCxt
,
pStmt
,
&
createSmaReq
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
return
code
;
return
code
;
...
@@ -1663,12 +1639,44 @@ static int32_t translateCreateSmaIndex(STranslateContext* pCxt, SCreateIndexStmt
...
@@ -1663,12 +1639,44 @@ static int32_t translateCreateSmaIndex(STranslateContext* pCxt, SCreateIndexStmt
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
translateCreateFullTextIndex
(
STranslateContext
*
pCxt
,
SCreateIndexStmt
*
pStmt
)
{}
static
int32_t
buildCreateFullTextReq
(
STranslateContext
*
pCxt
,
SCreateIndexStmt
*
pStmt
,
SMCreateFullTextReq
*
pReq
)
{
// impl later
return
0
;
}
static
int32_t
translateCreateFullTextIndex
(
STranslateContext
*
pCxt
,
SCreateIndexStmt
*
pStmt
)
{
if
(
DEAL_RES_ERROR
==
translateValue
(
pCxt
,
(
SValueNode
*
)
pStmt
->
pOptions
->
pInterval
)
||
(
NULL
!=
pStmt
->
pOptions
->
pOffset
&&
DEAL_RES_ERROR
==
translateValue
(
pCxt
,
(
SValueNode
*
)
pStmt
->
pOptions
->
pOffset
))
||
(
NULL
!=
pStmt
->
pOptions
->
pSliding
&&
DEAL_RES_ERROR
==
translateValue
(
pCxt
,
(
SValueNode
*
)
pStmt
->
pOptions
->
pSliding
)))
{
return
pCxt
->
errCode
;
}
SMCreateFullTextReq
createFTReq
=
{
0
};
int32_t
code
=
buildCreateFullTextReq
(
pCxt
,
pStmt
,
&
createFTReq
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
return
code
;
}
pCxt
->
pCmdMsg
=
taosMemoryMalloc
(
sizeof
(
SCmdMsgInfo
));
if
(
NULL
==
pCxt
->
pCmdMsg
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pCxt
->
pCmdMsg
->
epSet
=
pCxt
->
pParseCxt
->
mgmtEpSet
;
pCxt
->
pCmdMsg
->
msgType
=
TDMT_MND_CREATE_INDEX
;
pCxt
->
pCmdMsg
->
msgLen
=
tSerializeSMCreateFullTextReq
(
NULL
,
0
,
&
createFTReq
);
pCxt
->
pCmdMsg
->
pMsg
=
taosMemoryMalloc
(
pCxt
->
pCmdMsg
->
msgLen
);
if
(
NULL
==
pCxt
->
pCmdMsg
->
pMsg
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
tSerializeSMCreateFullTextReq
(
pCxt
->
pCmdMsg
->
pMsg
,
pCxt
->
pCmdMsg
->
msgLen
,
&
createFTReq
);
tFreeSMCreateFullTextReq
(
&
createFTReq
);
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
translateCreateIndex
(
STranslateContext
*
pCxt
,
SCreateIndexStmt
*
pStmt
)
{
static
int32_t
translateCreateIndex
(
STranslateContext
*
pCxt
,
SCreateIndexStmt
*
pStmt
)
{
if
(
INDEX_TYPE_SMA
==
pStmt
->
indexType
)
{
if
(
INDEX_TYPE_SMA
==
pStmt
->
indexType
)
{
return
translateCreateSmaIndex
(
pCxt
,
pStmt
);
return
translateCreateSmaIndex
(
pCxt
,
pStmt
);
}
else
if
(
INDEX_TYPE_FULLTEXT
==
pStmt
->
indexType
)
{
}
else
if
(
INDEX_TYPE_FULLTEXT
==
pStmt
->
indexType
)
{
return
translateCreateFullTextIndex
(
pCxt
,
pStmt
);
// todo fulltext index
// todo fulltext index
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
...
@@ -1814,9 +1822,7 @@ static int32_t translateExplain(STranslateContext* pCxt, SExplainStmt* pStmt) {
...
@@ -1814,9 +1822,7 @@ static int32_t translateExplain(STranslateContext* pCxt, SExplainStmt* pStmt) {
return
translateQuery
(
pCxt
,
pStmt
->
pQuery
);
return
translateQuery
(
pCxt
,
pStmt
->
pQuery
);
}
}
static
int32_t
translateDescribe
(
STranslateContext
*
pCxt
,
SDescribeStmt
*
pStmt
)
{
static
int32_t
translateDescribe
(
STranslateContext
*
pCxt
,
SDescribeStmt
*
pStmt
)
{
return
getTableMeta
(
pCxt
,
pStmt
->
dbName
,
pStmt
->
tableName
,
&
pStmt
->
pMeta
);
}
return
getTableMeta
(
pCxt
,
pStmt
->
dbName
,
pStmt
->
tableName
,
&
pStmt
->
pMeta
);
}
static
int32_t
translateQuery
(
STranslateContext
*
pCxt
,
SNode
*
pNode
)
{
static
int32_t
translateQuery
(
STranslateContext
*
pCxt
,
SNode
*
pNode
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
...
@@ -2097,9 +2103,7 @@ static int32_t createOperatorNode(EOperatorType opType, const char* pColName, SN
...
@@ -2097,9 +2103,7 @@ static int32_t createOperatorNode(EOperatorType opType, const char* pColName, SN
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
const
char
*
getTbNameColName
(
ENodeType
type
)
{
static
const
char
*
getTbNameColName
(
ENodeType
type
)
{
return
(
QUERY_NODE_SHOW_STABLES_STMT
==
type
?
"stable_name"
:
"table_name"
);
}
return
(
QUERY_NODE_SHOW_STABLES_STMT
==
type
?
"stable_name"
:
"table_name"
);
}
static
int32_t
createLogicCondNode
(
SNode
*
pCond1
,
SNode
*
pCond2
,
SNode
**
pCond
)
{
static
int32_t
createLogicCondNode
(
SNode
*
pCond1
,
SNode
*
pCond2
,
SNode
**
pCond
)
{
SLogicConditionNode
*
pCondition
=
nodesMakeNode
(
QUERY_NODE_LOGIC_CONDITION
);
SLogicConditionNode
*
pCondition
=
nodesMakeNode
(
QUERY_NODE_LOGIC_CONDITION
);
...
@@ -2112,8 +2116,7 @@ static int32_t createLogicCondNode(SNode* pCond1, SNode* pCond2, SNode** pCond)
...
@@ -2112,8 +2116,7 @@ static int32_t createLogicCondNode(SNode* pCond1, SNode* pCond2, SNode** pCond)
nodesDestroyNode
(
pCondition
);
nodesDestroyNode
(
pCondition
);
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
if
(
TSDB_CODE_SUCCESS
!=
nodesListAppend
(
pCondition
->
pParameterList
,
pCond1
)
||
if
(
TSDB_CODE_SUCCESS
!=
nodesListAppend
(
pCondition
->
pParameterList
,
pCond1
)
||
TSDB_CODE_SUCCESS
!=
nodesListAppend
(
pCondition
->
pParameterList
,
pCond2
))
{
TSDB_CODE_SUCCESS
!=
nodesListAppend
(
pCondition
->
pParameterList
,
pCond2
))
{
nodesDestroyNode
(
pCondition
);
nodesDestroyNode
(
pCondition
);
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
...
@@ -2126,8 +2129,7 @@ static int32_t createShowCondition(const SShowStmt* pShow, SSelectStmt* pSelect)
...
@@ -2126,8 +2129,7 @@ static int32_t createShowCondition(const SShowStmt* pShow, SSelectStmt* pSelect)
SNode
*
pDbCond
=
NULL
;
SNode
*
pDbCond
=
NULL
;
SNode
*
pTbCond
=
NULL
;
SNode
*
pTbCond
=
NULL
;
if
(
TSDB_CODE_SUCCESS
!=
createOperatorNode
(
OP_TYPE_EQUAL
,
"db_name"
,
pShow
->
pDbName
,
&
pDbCond
)
||
if
(
TSDB_CODE_SUCCESS
!=
createOperatorNode
(
OP_TYPE_EQUAL
,
"db_name"
,
pShow
->
pDbName
,
&
pDbCond
)
||
TSDB_CODE_SUCCESS
!=
TSDB_CODE_SUCCESS
!=
createOperatorNode
(
OP_TYPE_LIKE
,
getTbNameColName
(
nodeType
(
pShow
)),
pShow
->
pTbNamePattern
,
&
pTbCond
))
{
createOperatorNode
(
OP_TYPE_LIKE
,
getTbNameColName
(
nodeType
(
pShow
)),
pShow
->
pTbNamePattern
,
&
pTbCond
))
{
nodesDestroyNode
(
pDbCond
);
nodesDestroyNode
(
pDbCond
);
nodesDestroyNode
(
pTbCond
);
nodesDestroyNode
(
pTbCond
);
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
...
@@ -2207,8 +2209,7 @@ static int32_t buildSmaParam(STableOptions* pOptions, SVCreateTbReq* pReq) {
...
@@ -2207,8 +2209,7 @@ static int32_t buildSmaParam(STableOptions* pOptions, SVCreateTbReq* pReq) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
buildNormalTableBatchReq
(
int32_t
acctId
,
const
SCreateTableStmt
*
pStmt
,
const
SVgroupInfo
*
pVgroupInfo
,
static
int32_t
buildNormalTableBatchReq
(
int32_t
acctId
,
const
SCreateTableStmt
*
pStmt
,
const
SVgroupInfo
*
pVgroupInfo
,
SVgroupTablesBatch
*
pBatch
)
{
SVgroupTablesBatch
*
pBatch
)
{
char
dbFName
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
char
dbFName
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
SName
name
=
{.
type
=
TSDB_DB_NAME_T
,
.
acctId
=
acctId
};
SName
name
=
{.
type
=
TSDB_DB_NAME_T
,
.
acctId
=
acctId
};
strcpy
(
name
.
dbname
,
pStmt
->
dbName
);
strcpy
(
name
.
dbname
,
pStmt
->
dbName
);
...
@@ -2310,8 +2311,7 @@ static void destroyCreateTbReqArray(SArray* pArray) {
...
@@ -2310,8 +2311,7 @@ static void destroyCreateTbReqArray(SArray* pArray) {
taosArrayDestroy
(
pArray
);
taosArrayDestroy
(
pArray
);
}
}
static
int32_t
buildCreateTableDataBlock
(
int32_t
acctId
,
const
SCreateTableStmt
*
pStmt
,
const
SVgroupInfo
*
pInfo
,
static
int32_t
buildCreateTableDataBlock
(
int32_t
acctId
,
const
SCreateTableStmt
*
pStmt
,
const
SVgroupInfo
*
pInfo
,
SArray
**
pBufArray
)
{
SArray
**
pBufArray
)
{
*
pBufArray
=
taosArrayInit
(
1
,
POINTER_BYTES
);
*
pBufArray
=
taosArrayInit
(
1
,
POINTER_BYTES
);
if
(
NULL
==
*
pBufArray
)
{
if
(
NULL
==
*
pBufArray
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
...
@@ -2352,8 +2352,8 @@ static int32_t rewriteCreateTable(STranslateContext* pCxt, SQuery* pQuery) {
...
@@ -2352,8 +2352,8 @@ static int32_t rewriteCreateTable(STranslateContext* pCxt, SQuery* pQuery) {
return
code
;
return
code
;
}
}
static
void
addCreateTbReqIntoVgroup
(
int32_t
acctId
,
SHashObj
*
pVgroupHashmap
,
const
char
*
pDbName
,
static
void
addCreateTbReqIntoVgroup
(
int32_t
acctId
,
SHashObj
*
pVgroupHashmap
,
const
char
*
pDbName
,
const
char
*
pTableName
,
SKVRow
row
,
uint64_t
suid
,
const
char
*
pTableName
,
SKVRow
row
,
uint64_t
suid
,
SVgroupInfo
*
pVgInfo
)
{
SVgroupInfo
*
pVgInfo
)
{
char
dbFName
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
char
dbFName
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
SName
name
=
{.
type
=
TSDB_DB_NAME_T
,
.
acctId
=
acctId
};
SName
name
=
{.
type
=
TSDB_DB_NAME_T
,
.
acctId
=
acctId
};
strcpy
(
name
.
dbname
,
pDbName
);
strcpy
(
name
.
dbname
,
pDbName
);
...
@@ -2381,8 +2381,7 @@ static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, c
...
@@ -2381,8 +2381,7 @@ static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, c
}
}
}
}
static
int32_t
addValToKVRow
(
STranslateContext
*
pCxt
,
SValueNode
*
pVal
,
const
SSchema
*
pSchema
,
static
int32_t
addValToKVRow
(
STranslateContext
*
pCxt
,
SValueNode
*
pVal
,
const
SSchema
*
pSchema
,
SKVRowBuilder
*
pBuilder
)
{
SKVRowBuilder
*
pBuilder
)
{
if
(
DEAL_RES_ERROR
==
translateValue
(
pCxt
,
pVal
))
{
if
(
DEAL_RES_ERROR
==
translateValue
(
pCxt
,
pVal
))
{
return
pCxt
->
errCode
;
return
pCxt
->
errCode
;
}
}
...
@@ -2396,11 +2395,9 @@ static int32_t addValToKVRow(STranslateContext* pCxt, SValueNode* pVal, const SS
...
@@ -2396,11 +2395,9 @@ static int32_t addValToKVRow(STranslateContext* pCxt, SValueNode* pVal, const SS
return
code
;
return
code
;
}
}
static
int32_t
buildKVRowForBindTags
(
STranslateContext
*
pCxt
,
SCreateSubTableClause
*
pStmt
,
STableMeta
*
pSuperTableMeta
,
static
int32_t
buildKVRowForBindTags
(
STranslateContext
*
pCxt
,
SCreateSubTableClause
*
pStmt
,
STableMeta
*
pSuperTableMeta
,
SKVRowBuilder
*
pBuilder
)
{
SKVRowBuilder
*
pBuilder
)
{
int32_t
numOfTags
=
getNumOfTags
(
pSuperTableMeta
);
int32_t
numOfTags
=
getNumOfTags
(
pSuperTableMeta
);
if
(
LIST_LENGTH
(
pStmt
->
pValsOfTags
)
!=
LIST_LENGTH
(
pStmt
->
pSpecificTags
)
||
if
(
LIST_LENGTH
(
pStmt
->
pValsOfTags
)
!=
LIST_LENGTH
(
pStmt
->
pSpecificTags
)
||
numOfTags
<
LIST_LENGTH
(
pStmt
->
pValsOfTags
))
{
numOfTags
<
LIST_LENGTH
(
pStmt
->
pValsOfTags
))
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_TAGS_NOT_MATCHED
);
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_TAGS_NOT_MATCHED
);
}
}
...
@@ -2427,8 +2424,7 @@ static int32_t buildKVRowForBindTags(STranslateContext* pCxt, SCreateSubTableCla
...
@@ -2427,8 +2424,7 @@ static int32_t buildKVRowForBindTags(STranslateContext* pCxt, SCreateSubTableCla
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
buildKVRowForAllTags
(
STranslateContext
*
pCxt
,
SCreateSubTableClause
*
pStmt
,
STableMeta
*
pSuperTableMeta
,
static
int32_t
buildKVRowForAllTags
(
STranslateContext
*
pCxt
,
SCreateSubTableClause
*
pStmt
,
STableMeta
*
pSuperTableMeta
,
SKVRowBuilder
*
pBuilder
)
{
SKVRowBuilder
*
pBuilder
)
{
if
(
getNumOfTags
(
pSuperTableMeta
)
!=
LIST_LENGTH
(
pStmt
->
pValsOfTags
))
{
if
(
getNumOfTags
(
pSuperTableMeta
)
!=
LIST_LENGTH
(
pStmt
->
pValsOfTags
))
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_TAGS_NOT_MATCHED
);
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_TAGS_NOT_MATCHED
);
}
}
...
@@ -2489,8 +2485,7 @@ static int32_t rewriteCreateSubTable(STranslateContext* pCxt, SCreateSubTableCla
...
@@ -2489,8 +2485,7 @@ static int32_t rewriteCreateSubTable(STranslateContext* pCxt, SCreateSubTableCla
code
=
getTableHashVgroup
(
pCxt
,
pStmt
->
dbName
,
pStmt
->
tableName
,
&
info
);
code
=
getTableHashVgroup
(
pCxt
,
pStmt
->
dbName
,
pStmt
->
tableName
,
&
info
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
addCreateTbReqIntoVgroup
(
pCxt
->
pParseCxt
->
acctId
,
pVgroupHashmap
,
pStmt
->
dbName
,
pStmt
->
tableName
,
row
,
addCreateTbReqIntoVgroup
(
pCxt
->
pParseCxt
->
acctId
,
pVgroupHashmap
,
pStmt
->
dbName
,
pStmt
->
tableName
,
row
,
pSuperTableMeta
->
uid
,
&
info
);
pSuperTableMeta
->
uid
,
&
info
);
}
}
taosMemoryFreeClear
(
pSuperTableMeta
);
taosMemoryFreeClear
(
pSuperTableMeta
);
...
@@ -2647,8 +2642,7 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) {
...
@@ -2647,8 +2642,7 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) {
}
}
int32_t
translate
(
SParseContext
*
pParseCxt
,
SQuery
*
pQuery
)
{
int32_t
translate
(
SParseContext
*
pParseCxt
,
SQuery
*
pQuery
)
{
STranslateContext
cxt
=
{
STranslateContext
cxt
=
{.
pParseCxt
=
pParseCxt
,
.
pParseCxt
=
pParseCxt
,
.
errCode
=
TSDB_CODE_SUCCESS
,
.
errCode
=
TSDB_CODE_SUCCESS
,
.
msgBuf
=
{.
buf
=
pParseCxt
->
pMsg
,
.
len
=
pParseCxt
->
msgLen
},
.
msgBuf
=
{.
buf
=
pParseCxt
->
pMsg
,
.
len
=
pParseCxt
->
msgLen
},
.
pNsLevel
=
taosArrayInit
(
TARRAY_MIN_SIZE
,
POINTER_BYTES
),
.
pNsLevel
=
taosArrayInit
(
TARRAY_MIN_SIZE
,
POINTER_BYTES
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录