Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
68a68683
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看板
提交
68a68683
编写于
3月 11, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-13981 show databases rewrite
上级
d7406cab
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
97 addition
and
43 deletion
+97
-43
source/libs/parser/inc/parUtil.h
source/libs/parser/inc/parUtil.h
+7
-0
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+0
-2
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+85
-39
source/libs/parser/src/parser.c
source/libs/parser/src/parser.c
+5
-2
未找到文件。
source/libs/parser/inc/parUtil.h
浏览文件 @
68a68683
...
@@ -23,6 +23,13 @@ extern "C" {
...
@@ -23,6 +23,13 @@ extern "C" {
#include "os.h"
#include "os.h"
#include "query.h"
#include "query.h"
#define parserFatal(param, ...) qFatal("PARSER: " param, __VA_ARGS__)
#define parserError(param, ...) qError("PARSER: " param, __VA_ARGS__)
#define parserWarn(param, ...) qWarn("PARSER: " param, __VA_ARGS__)
#define parserInfo(param, ...) qInfo("PARSER: " param, __VA_ARGS__)
#define parserDebug(param, ...) qDebug("PARSER: " param, __VA_ARGS__)
#define parserTrace(param, ...) qTrace("PARSER: " param, __VA_ARGS__)
typedef
struct
SMsgBuf
{
typedef
struct
SMsgBuf
{
int32_t
len
;
int32_t
len
;
char
*
buf
;
char
*
buf
;
...
...
source/libs/parser/src/parInsert.c
浏览文件 @
68a68683
...
@@ -1024,7 +1024,6 @@ int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery) {
...
@@ -1024,7 +1024,6 @@ int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery) {
};
};
if
(
NULL
==
context
.
pVgroupsHashObj
||
NULL
==
context
.
pTableBlockHashObj
||
NULL
==
context
.
pOutput
)
{
if
(
NULL
==
context
.
pVgroupsHashObj
||
NULL
==
context
.
pTableBlockHashObj
||
NULL
==
context
.
pOutput
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
...
@@ -1043,6 +1042,5 @@ int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery) {
...
@@ -1043,6 +1042,5 @@ int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery) {
code
=
parseInsertBody
(
&
context
);
code
=
parseInsertBody
(
&
context
);
}
}
destroyInsertParseContext
(
&
context
);
destroyInsertParseContext
(
&
context
);
terrno
=
code
;
return
code
;
return
code
;
}
}
source/libs/parser/src/parTranslater.c
浏览文件 @
68a68683
...
@@ -69,14 +69,78 @@ static int32_t addNamespace(STranslateContext* pCxt, void* pTable) {
...
@@ -69,14 +69,78 @@ static int32_t addNamespace(STranslateContext* pCxt, void* pTable) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
SName
*
toName
(
int32_t
acctId
,
const
SRealTableNode
*
pRealTabl
e
,
SName
*
pName
)
{
static
SName
*
toName
(
int32_t
acctId
,
const
char
*
pDbName
,
const
char
*
pTableNam
e
,
SName
*
pName
)
{
pName
->
type
=
TSDB_TABLE_NAME_T
;
pName
->
type
=
TSDB_TABLE_NAME_T
;
pName
->
acctId
=
acctId
;
pName
->
acctId
=
acctId
;
strcpy
(
pName
->
dbname
,
p
RealTable
->
table
.
d
bName
);
strcpy
(
pName
->
dbname
,
p
D
bName
);
strcpy
(
pName
->
tname
,
p
RealTable
->
table
.
t
ableName
);
strcpy
(
pName
->
tname
,
p
T
ableName
);
return
pName
;
return
pName
;
}
}
static
int32_t
getTableMetaImpl
(
SParseContext
*
pCxt
,
const
SName
*
pName
,
STableMeta
**
pMeta
)
{
int32_t
code
=
catalogGetTableMeta
(
pCxt
->
pCatalog
,
pCxt
->
pTransporter
,
&
pCxt
->
mgmtEpSet
,
pName
,
pMeta
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
parserError
(
"catalogGetTableMeta error, code:%s, dbName:%s, tbName:%s"
,
tstrerror
(
code
),
pName
->
dbname
,
pName
->
tname
);
}
return
code
;
}
static
int32_t
getTableMeta
(
SParseContext
*
pCxt
,
const
char
*
pDbName
,
const
char
*
pTableName
,
STableMeta
**
pMeta
)
{
SName
name
=
{
.
type
=
TSDB_TABLE_NAME_T
,
.
acctId
=
pCxt
->
acctId
};
strcpy
(
name
.
dbname
,
pDbName
);
strcpy
(
name
.
tname
,
pTableName
);
return
getTableMetaImpl
(
pCxt
,
&
name
,
pMeta
);
}
static
int32_t
getTableDistVgInfo
(
SParseContext
*
pCxt
,
const
SName
*
pName
,
SArray
**
pVgInfo
)
{
int32_t
code
=
catalogGetTableDistVgInfo
(
pCxt
->
pCatalog
,
pCxt
->
pTransporter
,
&
pCxt
->
mgmtEpSet
,
pName
,
pVgInfo
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
parserError
(
"catalogGetTableDistVgInfo error, code:%s, dbName:%s, tbName:%s"
,
tstrerror
(
code
),
pName
->
dbname
,
pName
->
tname
);
}
return
code
;
}
static
int32_t
getDBVgInfoImpl
(
SParseContext
*
pCxt
,
const
SName
*
pName
,
SArray
**
pVgInfo
)
{
char
fullDbName
[
TSDB_DB_FNAME_LEN
];
tNameGetFullDbName
(
pName
,
fullDbName
);
int32_t
code
=
catalogGetDBVgInfo
(
pCxt
->
pCatalog
,
pCxt
->
pTransporter
,
&
pCxt
->
mgmtEpSet
,
fullDbName
,
pVgInfo
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
parserError
(
"catalogGetDBVgInfo error, code:%s, dbFName:%s"
,
tstrerror
(
code
),
fullDbName
);
}
return
code
;
}
static
int32_t
getDBVgInfo
(
SParseContext
*
pCxt
,
const
char
*
pDbName
,
SArray
**
pVgInfo
)
{
SName
name
;
tNameSetDbName
(
&
name
,
pCxt
->
acctId
,
pDbName
,
strlen
(
pDbName
));
char
dbFname
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
tNameGetFullDbName
(
&
name
,
dbFname
);
return
getDBVgInfoImpl
(
pCxt
,
&
name
,
pVgInfo
);
}
static
int32_t
getTableHashVgroupImpl
(
SParseContext
*
pCxt
,
const
SName
*
pName
,
SVgroupInfo
*
pInfo
)
{
int32_t
code
=
catalogGetTableHashVgroup
(
pCxt
->
pCatalog
,
pCxt
->
pTransporter
,
&
pCxt
->
mgmtEpSet
,
pName
,
pInfo
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
parserError
(
"catalogGetTableHashVgroup error, code:%s, dbName:%s, tbName:%s"
,
tstrerror
(
code
),
pName
->
dbname
,
pName
->
tname
);
}
return
code
;
}
static
int32_t
getTableHashVgroup
(
SParseContext
*
pCxt
,
const
char
*
pDbName
,
const
char
*
pTableName
,
SVgroupInfo
*
pInfo
)
{
SName
name
=
{
.
type
=
TSDB_TABLE_NAME_T
,
.
acctId
=
pCxt
->
acctId
};
strcpy
(
name
.
dbname
,
pDbName
);
strcpy
(
name
.
tname
,
pTableName
);
return
getTableHashVgroupImpl
(
pCxt
,
&
name
,
pInfo
);
}
static
int32_t
getDBVgVersion
(
SParseContext
*
pCxt
,
const
char
*
pDbFName
,
int32_t
*
pVersion
,
int64_t
*
pDbId
,
int32_t
*
pTableNum
)
{
int32_t
code
=
catalogGetDBVgVersion
(
pCxt
->
pCatalog
,
pDbFName
,
pVersion
,
pDbId
,
pTableNum
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
parserError
(
"catalogGetDBVgVersion error, code:%s, dbFName:%s"
,
tstrerror
(
code
),
pDbFName
);
}
return
code
;
}
static
bool
belongTable
(
const
char
*
currentDb
,
const
SColumnNode
*
pCol
,
const
STableNode
*
pTable
)
{
static
bool
belongTable
(
const
char
*
currentDb
,
const
SColumnNode
*
pCol
,
const
STableNode
*
pTable
)
{
int
cmp
=
0
;
int
cmp
=
0
;
if
(
'\0'
!=
pCol
->
dbName
[
0
])
{
if
(
'\0'
!=
pCol
->
dbName
[
0
])
{
...
@@ -517,17 +581,14 @@ static int32_t setTableVgroupList(SParseContext* pCxt, SName* pName, SRealTableN
...
@@ -517,17 +581,14 @@ static int32_t setTableVgroupList(SParseContext* pCxt, SName* pName, SRealTableN
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
(
TSDB_SUPER_TABLE
==
pRealTable
->
pMeta
->
tableType
)
{
if
(
TSDB_SUPER_TABLE
==
pRealTable
->
pMeta
->
tableType
)
{
SArray
*
vgroupList
=
NULL
;
SArray
*
vgroupList
=
NULL
;
code
=
catalogGetTableDistVgInfo
(
pCxt
->
pCatalog
,
pCxt
->
pTransporter
,
&
pCxt
->
mgmtEpSe
t
,
pName
,
&
vgroupList
);
code
=
getTableDistVgInfo
(
pCx
t
,
pName
,
&
vgroupList
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
toVgroupsInfo
(
vgroupList
,
&
pRealTable
->
pVgroupList
);
code
=
toVgroupsInfo
(
vgroupList
,
&
pRealTable
->
pVgroupList
);
}
}
taosArrayDestroy
(
vgroupList
);
taosArrayDestroy
(
vgroupList
);
}
else
if
(
TSDB_SYSTEM_TABLE
==
pRealTable
->
pMeta
->
tableType
)
{
}
else
if
(
TSDB_SYSTEM_TABLE
==
pRealTable
->
pMeta
->
tableType
)
{
SArray
*
vgroupList
=
NULL
;
SArray
*
vgroupList
=
NULL
;
char
fullDbName
[
TSDB_DB_FNAME_LEN
];
code
=
getDBVgInfoImpl
(
pCxt
,
pName
,
&
vgroupList
);
// tNameGetFullDbName(pName, fullDbName);
snprintf
(
fullDbName
,
TSDB_DB_FNAME_LEN
,
"%d.%s"
,
pCxt
->
acctId
,
"test"
);
code
=
catalogGetDBVgInfo
(
pCxt
->
pCatalog
,
pCxt
->
pTransporter
,
&
pCxt
->
mgmtEpSet
,
fullDbName
,
false
,
&
vgroupList
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
toVgroupsInfo
(
vgroupList
,
&
pRealTable
->
pVgroupList
);
code
=
toVgroupsInfo
(
vgroupList
,
&
pRealTable
->
pVgroupList
);
}
}
...
@@ -538,7 +599,7 @@ static int32_t setTableVgroupList(SParseContext* pCxt, SName* pName, SRealTableN
...
@@ -538,7 +599,7 @@ static int32_t setTableVgroupList(SParseContext* pCxt, SName* pName, SRealTableN
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
pRealTable
->
pVgroupList
->
numOfVgroups
=
1
;
pRealTable
->
pVgroupList
->
numOfVgroups
=
1
;
code
=
catalogGetTableHashVgroup
(
pCxt
->
pCatalog
,
pCxt
->
pTransporter
,
&
pCxt
->
mgmtEpSe
t
,
pName
,
pRealTable
->
pVgroupList
->
vgroups
);
code
=
getTableHashVgroupImpl
(
pCx
t
,
pName
,
pRealTable
->
pVgroupList
->
vgroups
);
}
}
return
code
;
return
code
;
}
}
...
@@ -549,8 +610,8 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) {
...
@@ -549,8 +610,8 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) {
case
QUERY_NODE_REAL_TABLE
:
{
case
QUERY_NODE_REAL_TABLE
:
{
SRealTableNode
*
pRealTable
=
(
SRealTableNode
*
)
pTable
;
SRealTableNode
*
pRealTable
=
(
SRealTableNode
*
)
pTable
;
SName
name
;
SName
name
;
code
=
catalogGetTableMeta
(
pCxt
->
pParseCxt
->
pCatalog
,
pCxt
->
pParseCxt
->
pTransporter
,
&
(
pCxt
->
pParseCxt
->
mgmtEpSet
)
,
code
=
getTableMetaImpl
(
pCxt
->
pParseCxt
,
toName
(
pCxt
->
pParseCxt
->
acctId
,
pRealTable
,
&
name
),
&
(
pRealTable
->
pMeta
));
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
);
}
}
...
@@ -906,11 +967,10 @@ static int32_t doTranslateDropSuperTable(STranslateContext* pCxt, const SName* p
...
@@ -906,11 +967,10 @@ static int32_t doTranslateDropSuperTable(STranslateContext* pCxt, const SName* p
static
int32_t
translateDropTable
(
STranslateContext
*
pCxt
,
SDropTableStmt
*
pStmt
)
{
static
int32_t
translateDropTable
(
STranslateContext
*
pCxt
,
SDropTableStmt
*
pStmt
)
{
SDropTableClause
*
pClause
=
nodesListGetNode
(
pStmt
->
pTables
,
0
);
SDropTableClause
*
pClause
=
nodesListGetNode
(
pStmt
->
pTables
,
0
);
SName
tableName
=
{
.
type
=
TSDB_TABLE_NAME_T
,
.
acctId
=
pCxt
->
pParseCxt
->
acctId
};
strcpy
(
tableName
.
dbname
,
pClause
->
dbName
);
strcpy
(
tableName
.
tname
,
pClause
->
tableName
);
STableMeta
*
pTableMeta
=
NULL
;
STableMeta
*
pTableMeta
=
NULL
;
int32_t
code
=
catalogGetTableMeta
(
pCxt
->
pParseCxt
->
pCatalog
,
pCxt
->
pParseCxt
->
pTransporter
,
&
(
pCxt
->
pParseCxt
->
mgmtEpSet
),
&
tableName
,
&
pTableMeta
);
SName
tableName
;
int32_t
code
=
getTableMetaImpl
(
pCxt
->
pParseCxt
,
toName
(
pCxt
->
pParseCxt
->
acctId
,
pClause
->
dbName
,
pClause
->
tableName
,
&
tableName
),
&
pTableMeta
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_SUPER_TABLE
==
pTableMeta
->
tableType
)
{
if
(
TSDB_SUPER_TABLE
==
pTableMeta
->
tableType
)
{
code
=
doTranslateDropSuperTable
(
pCxt
,
&
tableName
,
pClause
->
ignoreNotExists
);
code
=
doTranslateDropSuperTable
(
pCxt
,
&
tableName
,
pClause
->
ignoreNotExists
);
...
@@ -918,8 +978,8 @@ static int32_t translateDropTable(STranslateContext* pCxt, SDropTableStmt* pStmt
...
@@ -918,8 +978,8 @@ static int32_t translateDropTable(STranslateContext* pCxt, SDropTableStmt* pStmt
// todo : drop normal table or child table
// todo : drop normal table or child table
code
=
TSDB_CODE_FAILED
;
code
=
TSDB_CODE_FAILED
;
}
}
tfree
(
pTableMeta
);
}
}
tfree
(
pTableMeta
);
return
code
;
return
code
;
}
}
...
@@ -932,13 +992,14 @@ static int32_t translateDropSuperTable(STranslateContext* pCxt, SDropSuperTableS
...
@@ -932,13 +992,14 @@ static int32_t translateDropSuperTable(STranslateContext* pCxt, SDropSuperTableS
}
}
static
int32_t
translateUseDatabase
(
STranslateContext
*
pCxt
,
SUseDatabaseStmt
*
pStmt
)
{
static
int32_t
translateUseDatabase
(
STranslateContext
*
pCxt
,
SUseDatabaseStmt
*
pStmt
)
{
SUseDbReq
usedbReq
=
{
0
};
SName
name
=
{
0
};
SName
name
=
{
0
};
tNameSetDbName
(
&
name
,
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
dbName
,
strlen
(
pStmt
->
dbName
));
tNameSetDbName
(
&
name
,
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
dbName
,
strlen
(
pStmt
->
dbName
));
SUseDbReq
usedbReq
=
{
0
};
tNameExtractFullName
(
&
name
,
usedbReq
.
db
);
tNameExtractFullName
(
&
name
,
usedbReq
.
db
);
int32_t
code
=
getDBVgVersion
(
pCxt
->
pParseCxt
,
usedbReq
.
db
,
&
usedbReq
.
vgVersion
,
&
usedbReq
.
dbId
,
&
usedbReq
.
numOfTable
);
catalogGetDBVgVersion
(
pCxt
->
pParseCxt
->
pCatalog
,
usedbReq
.
db
,
&
usedbReq
.
vgVersion
,
&
usedbReq
.
dbId
,
&
usedbReq
.
numOfTable
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
return
code
;
}
pCxt
->
pCmdMsg
=
malloc
(
sizeof
(
SCmdMsgInfo
));
pCxt
->
pCmdMsg
=
malloc
(
sizeof
(
SCmdMsgInfo
));
if
(
NULL
==
pCxt
->
pCmdMsg
)
{
if
(
NULL
==
pCxt
->
pCmdMsg
)
{
...
@@ -1114,19 +1175,14 @@ static int32_t translateShow(STranslateContext* pCxt, SShowStmt* pStmt) {
...
@@ -1114,19 +1175,14 @@ static int32_t translateShow(STranslateContext* pCxt, SShowStmt* pStmt) {
}
}
static
int32_t
translateShowTables
(
STranslateContext
*
pCxt
)
{
static
int32_t
translateShowTables
(
STranslateContext
*
pCxt
)
{
SName
name
=
{
0
};
SVShowTablesReq
*
pShowReq
=
calloc
(
1
,
sizeof
(
SVShowTablesReq
));
SVShowTablesReq
*
pShowReq
=
calloc
(
1
,
sizeof
(
SVShowTablesReq
));
if
(
pCxt
->
pParseCxt
->
db
==
NULL
||
strlen
(
pCxt
->
pParseCxt
->
db
)
==
0
)
{
if
(
pCxt
->
pParseCxt
->
db
==
NULL
||
strlen
(
pCxt
->
pParseCxt
->
db
)
==
0
)
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_TSC_INVALID_OPERATION
,
"db not specified"
);
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_TSC_INVALID_OPERATION
,
"db not specified"
);
}
}
tNameSetDbName
(
&
name
,
pCxt
->
pParseCxt
->
acctId
,
pCxt
->
pParseCxt
->
db
,
strlen
(
pCxt
->
pParseCxt
->
db
));
char
dbFname
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
tNameGetFullDbName
(
&
name
,
dbFname
);
SArray
*
array
=
NULL
;
SArray
*
array
=
NULL
;
int32_t
code
=
catalogGetDBVgInfo
(
pCxt
->
pParseCxt
->
pCatalog
,
pCxt
->
pParseCxt
->
pTransporter
,
&
pCxt
->
pParseCxt
->
mgmtEpSet
,
dbFname
,
&
array
);
int32_t
code
=
getDBVgInfo
(
pCxt
->
pParseCxt
,
pCxt
->
pParseCxt
->
db
,
&
array
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
return
code
;
return
code
;
}
}
SVgroupInfo
*
info
=
taosArrayGet
(
array
,
0
);
SVgroupInfo
*
info
=
taosArrayGet
(
array
,
0
);
...
@@ -1353,13 +1409,6 @@ static void destroyCreateTbReqBatch(SVgroupTablesBatch* pTbBatch) {
...
@@ -1353,13 +1409,6 @@ static void destroyCreateTbReqBatch(SVgroupTablesBatch* pTbBatch) {
taosArrayDestroy
(
pTbBatch
->
req
.
pArray
);
taosArrayDestroy
(
pTbBatch
->
req
.
pArray
);
}
}
static
int32_t
getTableHashVgroup
(
SParseContext
*
pCxt
,
const
char
*
pDbName
,
const
char
*
pTableName
,
SVgroupInfo
*
pInfo
)
{
SName
name
=
{
.
type
=
TSDB_TABLE_NAME_T
,
.
acctId
=
pCxt
->
acctId
};
strcpy
(
name
.
dbname
,
pDbName
);
strcpy
(
name
.
tname
,
pTableName
);
return
catalogGetTableHashVgroup
(
pCxt
->
pCatalog
,
pCxt
->
pTransporter
,
&
pCxt
->
mgmtEpSet
,
&
name
,
pInfo
);
}
static
int32_t
rewriteToVnodeModifOpStmt
(
SQuery
*
pQuery
,
SArray
*
pBufArray
)
{
static
int32_t
rewriteToVnodeModifOpStmt
(
SQuery
*
pQuery
,
SArray
*
pBufArray
)
{
SVnodeModifOpStmt
*
pNewStmt
=
nodesMakeNode
(
QUERY_NODE_VNODE_MODIF_STMT
);
SVnodeModifOpStmt
*
pNewStmt
=
nodesMakeNode
(
QUERY_NODE_VNODE_MODIF_STMT
);
if
(
pNewStmt
==
NULL
)
{
if
(
pNewStmt
==
NULL
)
{
...
@@ -1544,12 +1593,9 @@ static int32_t buildKVRowForAllTags(STranslateContext* pCxt, SCreateSubTableClau
...
@@ -1544,12 +1593,9 @@ static int32_t buildKVRowForAllTags(STranslateContext* pCxt, SCreateSubTableClau
}
}
static
int32_t
rewriteCreateSubTable
(
STranslateContext
*
pCxt
,
SCreateSubTableClause
*
pStmt
,
SHashObj
*
pVgroupHashmap
)
{
static
int32_t
rewriteCreateSubTable
(
STranslateContext
*
pCxt
,
SCreateSubTableClause
*
pStmt
,
SHashObj
*
pVgroupHashmap
)
{
SName
name
=
{
.
type
=
TSDB_TABLE_NAME_T
,
.
acctId
=
pCxt
->
pParseCxt
->
acctId
};
strcpy
(
name
.
dbname
,
pStmt
->
useDbName
);
strcpy
(
name
.
tname
,
pStmt
->
useTableName
);
STableMeta
*
pSuperTableMeta
=
NULL
;
STableMeta
*
pSuperTableMeta
=
NULL
;
int32_t
code
=
catalogGetTableMeta
(
pCxt
->
pParseCxt
->
pCatalog
,
pCxt
->
pParseCxt
->
pTransporter
,
&
pCxt
->
pParseCxt
->
mgmtEpSet
,
&
n
ame
,
&
pSuperTableMeta
);
int32_t
code
=
getTableMeta
(
pCxt
->
pParseCxt
,
pStmt
->
useDbName
,
pStmt
->
useTableN
ame
,
&
pSuperTableMeta
);
SKVRowBuilder
kvRowBuilder
=
{
0
};
SKVRowBuilder
kvRowBuilder
=
{
0
};
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tdInitKVRowBuilder
(
&
kvRowBuilder
);
code
=
tdInitKVRowBuilder
(
&
kvRowBuilder
);
...
...
source/libs/parser/src/parser.c
浏览文件 @
68a68683
...
@@ -38,11 +38,14 @@ static int32_t parseSqlIntoAst(SParseContext* pCxt, SQuery** pQuery) {
...
@@ -38,11 +38,14 @@ static int32_t parseSqlIntoAst(SParseContext* pCxt, SQuery** pQuery) {
}
}
int32_t
qParseQuerySql
(
SParseContext
*
pCxt
,
SQuery
**
pQuery
)
{
int32_t
qParseQuerySql
(
SParseContext
*
pCxt
,
SQuery
**
pQuery
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
(
isInsertSql
(
pCxt
->
pSql
,
pCxt
->
sqlLen
))
{
if
(
isInsertSql
(
pCxt
->
pSql
,
pCxt
->
sqlLen
))
{
return
parseInsertSql
(
pCxt
,
pQuery
);
code
=
parseInsertSql
(
pCxt
,
pQuery
);
}
else
{
}
else
{
return
parseSqlIntoAst
(
pCxt
,
pQuery
);
code
=
parseSqlIntoAst
(
pCxt
,
pQuery
);
}
}
terrno
=
code
;
return
code
;
}
}
void
qDestroyQuery
(
SQuery
*
pQueryNode
)
{
void
qDestroyQuery
(
SQuery
*
pQueryNode
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录