Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
70a02863
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看板
提交
70a02863
编写于
4月 20, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-2859] refactor and fix memory leaks.
上级
fb8024fb
变更
14
展开全部
隐藏空白更改
内联
并排
Showing
14 changed file
with
420 addition
and
1134 deletion
+420
-1134
src/client/inc/tscLocalMerge.h
src/client/inc/tscLocalMerge.h
+1
-11
src/client/src/tscLocalMerge.c
src/client/src/tscLocalMerge.c
+152
-884
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+82
-77
src/client/src/tscServer.c
src/client/src/tscServer.c
+1
-1
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+2
-0
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+55
-21
src/inc/tsdb.h
src/inc/tsdb.h
+1
-1
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+2
-0
src/query/inc/qSqlparser.h
src/query/inc/qSqlparser.h
+26
-30
src/query/inc/sql.y
src/query/inc/sql.y
+6
-6
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+1
-1
src/query/src/qSqlParser.c
src/query/src/qSqlParser.c
+61
-73
src/query/src/sql.c
src/query/src/sql.c
+25
-26
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+5
-3
未找到文件。
src/client/inc/tscLocalMerge.h
浏览文件 @
70a02863
...
@@ -44,26 +44,16 @@ typedef struct SLocalMerger {
...
@@ -44,26 +44,16 @@ typedef struct SLocalMerger {
int32_t
numOfCompleted
;
int32_t
numOfCompleted
;
int32_t
numOfVnode
;
int32_t
numOfVnode
;
SLoserTreeInfo
*
pLoserTree
;
SLoserTreeInfo
*
pLoserTree
;
char
*
prevRowOfInput
;
tFilePage
*
pResultBuf
;
tFilePage
*
pResultBuf
;
int32_t
nResultBufSize
;
int32_t
nResultBufSize
;
tFilePage
*
pTempBuffer
;
tFilePage
*
pTempBuffer
;
struct
SQLFunctionCtx
*
pCtx
;
struct
SQLFunctionCtx
*
pCtx
;
int32_t
rowSize
;
// size of each intermediate result.
int32_t
rowSize
;
// size of each intermediate result.
bool
hasPrevRow
;
// cannot be released
bool
hasUnprocessedRow
;
tOrderDescriptor
*
pDesc
;
tOrderDescriptor
*
pDesc
;
SColumnModel
*
resColModel
;
SColumnModel
*
resColModel
;
SColumnModel
*
finalModel
;
SColumnModel
*
finalModel
;
tExtMemBuffer
**
pExtMemBuffer
;
// disk-based buffer
tExtMemBuffer
**
pExtMemBuffer
;
// disk-based buffer
SFillInfo
*
pFillInfo
;
// interpolation support structure
char
*
pFinalRes
;
// result data after interpo
tFilePage
*
discardData
;
bool
discard
;
int32_t
offset
;
// limit offset value
bool
orderPrjOnSTable
;
// projection query on stable
bool
orderPrjOnSTable
;
// projection query on stable
char
*
tagBuf
;
// max tag buffer
int32_t
tagBufLen
;
}
SLocalMerger
;
}
SLocalMerger
;
typedef
struct
SRetrieveSupport
{
typedef
struct
SRetrieveSupport
{
...
@@ -96,7 +86,7 @@ void tscCreateLocalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrde
...
@@ -96,7 +86,7 @@ void tscCreateLocalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrde
void
tscDestroyLocalMerger
(
SSqlObj
*
pSql
);
void
tscDestroyLocalMerger
(
SSqlObj
*
pSql
);
int32_t
tscDoLocalMerge
(
SSqlObj
*
pSql
);
//
int32_t tscDoLocalMerge(SSqlObj *pSql);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
src/client/src/tscLocalMerge.c
浏览文件 @
70a02863
此差异已折叠。
点击以展开。
src/client/src/tscSQLParser.c
浏览文件 @
70a02863
此差异已折叠。
点击以展开。
src/client/src/tscServer.c
浏览文件 @
70a02863
...
@@ -1383,7 +1383,7 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1383,7 +1383,7 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pMsg
=
(
char
*
)
pSchema
;
pMsg
=
(
char
*
)
pSchema
;
if
(
type
==
TSQL_CREATE_STREAM
)
{
// check if it is a stream sql
if
(
type
==
TSQL_CREATE_STREAM
)
{
// check if it is a stream sql
S
Query
SqlNode
*
pQuerySql
=
pInfo
->
pCreateTableInfo
->
pSelect
;
SSqlNode
*
pQuerySql
=
pInfo
->
pCreateTableInfo
->
pSelect
;
strncpy
(
pMsg
,
pQuerySql
->
sqlstr
.
z
,
pQuerySql
->
sqlstr
.
n
+
1
);
strncpy
(
pMsg
,
pQuerySql
->
sqlstr
.
z
,
pQuerySql
->
sqlstr
.
n
+
1
);
pCreateMsg
->
sqlLen
=
htons
(
pQuerySql
->
sqlstr
.
n
+
1
);
pCreateMsg
->
sqlLen
=
htons
(
pQuerySql
->
sqlstr
.
n
+
1
);
...
...
src/client/src/tscSubquery.c
浏览文件 @
70a02863
...
@@ -3590,6 +3590,8 @@ void* createQueryInfoFromQueryNode(SQueryInfo* pQueryInfo, SExprInfo* pExprs, ST
...
@@ -3590,6 +3590,8 @@ void* createQueryInfoFromQueryNode(SQueryInfo* pQueryInfo, SExprInfo* pExprs, ST
STsBufInfo
bufInfo
=
{
0
};
STsBufInfo
bufInfo
=
{
0
};
SQueryParam
param
=
{.
pOperator
=
pa
};
SQueryParam
param
=
{.
pOperator
=
pa
};
/*int32_t code = */
initQInfo
(
&
bufInfo
,
NULL
,
pSourceOperator
,
pQInfo
,
&
param
,
NULL
,
0
,
merger
);
/*int32_t code = */
initQInfo
(
&
bufInfo
,
NULL
,
pSourceOperator
,
pQInfo
,
&
param
,
NULL
,
0
,
merger
);
taosArrayDestroy
(
pa
);
return
pQInfo
;
return
pQInfo
;
_cleanup:
_cleanup:
...
...
src/client/src/tscUtil.c
浏览文件 @
70a02863
...
@@ -525,18 +525,14 @@ void tscSetResRawPtr(SSqlRes* pRes, SQueryInfo* pQueryInfo) {
...
@@ -525,18 +525,14 @@ void tscSetResRawPtr(SSqlRes* pRes, SQueryInfo* pQueryInfo) {
void
tscSetResRawPtrRv
(
SSqlRes
*
pRes
,
SQueryInfo
*
pQueryInfo
,
SSDataBlock
*
pBlock
)
{
void
tscSetResRawPtrRv
(
SSqlRes
*
pRes
,
SQueryInfo
*
pQueryInfo
,
SSDataBlock
*
pBlock
)
{
assert
(
pRes
->
numOfCols
>
0
);
assert
(
pRes
->
numOfCols
>
0
);
// int32_t offset = 0;
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
fieldsInfo
.
numOfOutput
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
fieldsInfo
.
numOfOutput
;
++
i
)
{
SInternalField
*
pInfo
=
(
SInternalField
*
)
TARRAY_GET_ELEM
(
pQueryInfo
->
fieldsInfo
.
internalField
,
i
);
SInternalField
*
pInfo
=
(
SInternalField
*
)
TARRAY_GET_ELEM
(
pQueryInfo
->
fieldsInfo
.
internalField
,
i
);
SColumnInfoData
*
pColData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
SColumnInfoData
*
pColData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
pRes
->
urow
[
i
]
=
pColData
->
pData
/* + offset * pColData->info.bytes*/
;
pRes
->
urow
[
i
]
=
pColData
->
pData
;
pRes
->
length
[
i
]
=
pInfo
->
field
.
bytes
;
pRes
->
length
[
i
]
=
pInfo
->
field
.
bytes
;
//offset += pInfo->field.bytes;
// generated the user-defined column result
// generated the user-defined column result
if
(
pInfo
->
pExpr
->
pExpr
==
NULL
&&
TSDB_COL_IS_UD_COL
(
pInfo
->
pExpr
->
base
.
colInfo
.
flag
))
{
if
(
pInfo
->
pExpr
->
pExpr
==
NULL
&&
TSDB_COL_IS_UD_COL
(
pInfo
->
pExpr
->
base
.
colInfo
.
flag
))
{
if
(
pInfo
->
pExpr
->
base
.
param
[
1
].
nType
==
TSDB_DATA_TYPE_NULL
)
{
if
(
pInfo
->
pExpr
->
base
.
param
[
1
].
nType
==
TSDB_DATA_TYPE_NULL
)
{
...
@@ -609,7 +605,7 @@ static SColumnInfo* extractColumnInfoFromResult(STableMeta* pTableMeta, SArray*
...
@@ -609,7 +605,7 @@ static SColumnInfo* extractColumnInfoFromResult(STableMeta* pTableMeta, SArray*
}
}
typedef
struct
SDummyInputInfo
{
typedef
struct
SDummyInputInfo
{
SSDataBlock
block
;
SSDataBlock
*
block
;
SSqlRes
*
pRes
;
// refactor: remove it
SSqlRes
*
pRes
;
// refactor: remove it
}
SDummyInputInfo
;
}
SDummyInputInfo
;
...
@@ -619,7 +615,7 @@ SSDataBlock* doGetDataBlock(void* param, bool* newgroup) {
...
@@ -619,7 +615,7 @@ SSDataBlock* doGetDataBlock(void* param, bool* newgroup) {
SDummyInputInfo
*
pInput
=
pOperator
->
info
;
SDummyInputInfo
*
pInput
=
pOperator
->
info
;
char
*
pData
=
pInput
->
pRes
->
data
;
char
*
pData
=
pInput
->
pRes
->
data
;
SSDataBlock
*
pBlock
=
&
pInput
->
block
;
SSDataBlock
*
pBlock
=
pInput
->
block
;
pBlock
->
info
.
rows
=
pInput
->
pRes
->
numOfRows
;
pBlock
->
info
.
rows
=
pInput
->
pRes
->
numOfRows
;
if
(
pBlock
->
info
.
rows
==
0
)
{
if
(
pBlock
->
info
.
rows
==
0
)
{
return
NULL
;
return
NULL
;
...
@@ -638,30 +634,47 @@ SSDataBlock* doGetDataBlock(void* param, bool* newgroup) {
...
@@ -638,30 +634,47 @@ SSDataBlock* doGetDataBlock(void* param, bool* newgroup) {
return
pBlock
;
return
pBlock
;
}
}
static
void
destroyDummyInputOperator
(
void
*
param
,
int32_t
numOfOutput
)
{
SDummyInputInfo
*
pInfo
=
(
SDummyInputInfo
*
)
param
;
// tricky
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pInfo
->
block
->
pDataBlock
,
i
);
pColInfoData
->
pData
=
NULL
;
}
pInfo
->
block
=
destroyOutputBuf
(
pInfo
->
block
);
pInfo
->
pRes
=
NULL
;
}
// todo this operator servers as the adapter for Operator tree and SqlRes result, remove it later
SOperatorInfo
*
createDummyInputOperator
(
char
*
pResult
,
SSchema
*
pSchema
,
int32_t
numOfCols
)
{
SOperatorInfo
*
createDummyInputOperator
(
char
*
pResult
,
SSchema
*
pSchema
,
int32_t
numOfCols
)
{
assert
(
numOfCols
>
0
);
assert
(
numOfCols
>
0
);
SDummyInputInfo
*
pInfo
=
calloc
(
1
,
sizeof
(
SDummyInputInfo
));
SDummyInputInfo
*
pInfo
=
calloc
(
1
,
sizeof
(
SDummyInputInfo
));
pInfo
->
pRes
=
(
SSqlRes
*
)
pResult
;
pInfo
->
pRes
=
(
SSqlRes
*
)
pResult
;
pInfo
->
block
.
info
.
numOfCols
=
numOfCols
;
pInfo
->
block
=
calloc
(
numOfCols
,
sizeof
(
SSDataBlock
));
pInfo
->
block
.
pDataBlock
=
taosArrayInit
(
numOfCols
,
sizeof
(
SColumnInfoData
));
pInfo
->
block
->
info
.
numOfCols
=
numOfCols
;
pInfo
->
block
->
pDataBlock
=
taosArrayInit
(
numOfCols
,
sizeof
(
SColumnInfoData
));
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
colData
=
{
0
};
SColumnInfoData
colData
=
{
0
};
colData
.
info
.
bytes
=
pSchema
[
i
].
bytes
;
colData
.
info
.
bytes
=
pSchema
[
i
].
bytes
;
colData
.
info
.
type
=
pSchema
[
i
].
type
;
colData
.
info
.
type
=
pSchema
[
i
].
type
;
colData
.
info
.
colId
=
pSchema
[
i
].
colId
;
colData
.
info
.
colId
=
pSchema
[
i
].
colId
;
taosArrayPush
(
pInfo
->
block
.
pDataBlock
,
&
colData
);
taosArrayPush
(
pInfo
->
block
->
pDataBlock
,
&
colData
);
}
}
SOperatorInfo
*
pOptr
=
calloc
(
1
,
sizeof
(
SOperatorInfo
));
SOperatorInfo
*
pOptr
=
calloc
(
1
,
sizeof
(
SOperatorInfo
));
pOptr
->
name
=
"DummyInputOperator"
;
pOptr
->
name
=
"DummyInputOperator"
;
pOptr
->
operatorType
=
OP_DummyInput
;
pOptr
->
operatorType
=
OP_DummyInput
;
pOptr
->
numOfOutput
=
numOfCols
;
pOptr
->
blockingOptr
=
false
;
pOptr
->
blockingOptr
=
false
;
pOptr
->
info
=
pInfo
;
pOptr
->
info
=
pInfo
;
pOptr
->
exec
=
doGetDataBlock
;
pOptr
->
exec
=
doGetDataBlock
;
pOptr
->
cleanup
=
destroyDummyInputOperator
;
return
pOptr
;
return
pOptr
;
}
}
...
@@ -683,18 +696,12 @@ void prepareInputDataFromUpstream(SSqlRes* pRes, SQueryInfo* pQueryInfo) {
...
@@ -683,18 +696,12 @@ void prepareInputDataFromUpstream(SSqlRes* pRes, SQueryInfo* pQueryInfo) {
if
(
pQueryInfo
->
pDownstream
!=
NULL
)
{
if
(
pQueryInfo
->
pDownstream
!=
NULL
)
{
// handle the following query process
// handle the following query process
SQueryInfo
*
px
=
pQueryInfo
->
pDownstream
;
SQueryInfo
*
px
=
pQueryInfo
->
pDownstream
;
SColumnInfo
*
col
Info
=
extractColumnInfoFromResult
(
px
->
pTableMetaInfo
[
0
]
->
pTableMeta
,
px
->
colList
);
SColumnInfo
*
pColumn
Info
=
extractColumnInfoFromResult
(
px
->
pTableMetaInfo
[
0
]
->
pTableMeta
,
px
->
colList
);
int32_t
numOfOutput
=
tscSqlExprNumOfExprs
(
px
);
int32_t
numOfOutput
=
tscSqlExprNumOfExprs
(
px
);
SExprInfo
*
exprInfo
=
NULL
;
SQLFunctionCtx
*
pCtx
=
calloc
(
numOfOutput
,
sizeof
(
SQLFunctionCtx
));
int32_t
numOfCols
=
taosArrayGetSize
(
px
->
colList
);
int32_t
numOfCols
=
taosArrayGetSize
(
px
->
colList
);
SQueriedTableInfo
info
=
{.
colList
=
colInfo
,
.
numOfCols
=
numOfCols
,};
SQueriedTableInfo
info
=
{.
colList
=
pColumnInfo
,
.
numOfCols
=
numOfCols
,};
/*int32_t code = */
createQueryFunc
(
&
info
,
numOfOutput
,
&
exprInfo
,
px
->
exprList
->
pData
,
NULL
,
px
->
type
,
NULL
);
SSchema
*
pSchema
=
tscGetTableSchema
(
px
->
pTableMetaInfo
[
0
]
->
pTableMeta
);
SSchema
*
pSchema
=
tscGetTableSchema
(
px
->
pTableMetaInfo
[
0
]
->
pTableMeta
);
tsCreateSQLFunctionCtx
(
px
,
pCtx
,
pSchema
);
STableGroupInfo
tableGroupInfo
=
{.
numOfTables
=
1
,
.
pGroupList
=
taosArrayInit
(
1
,
POINTER_BYTES
),};
STableGroupInfo
tableGroupInfo
=
{.
numOfTables
=
1
,
.
pGroupList
=
taosArrayInit
(
1
,
POINTER_BYTES
),};
tableGroupInfo
.
map
=
taosHashInit
(
1
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_INT
),
true
,
HASH_NO_LOCK
);
tableGroupInfo
.
map
=
taosHashInit
(
1
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_INT
),
true
,
HASH_NO_LOCK
);
...
@@ -708,11 +715,15 @@ void prepareInputDataFromUpstream(SSqlRes* pRes, SQueryInfo* pQueryInfo) {
...
@@ -708,11 +715,15 @@ void prepareInputDataFromUpstream(SSqlRes* pRes, SQueryInfo* pQueryInfo) {
SOperatorInfo
*
pSourceOptr
=
createDummyInputOperator
((
char
*
)
pRes
,
pSchema
,
numOfOutput
);
SOperatorInfo
*
pSourceOptr
=
createDummyInputOperator
((
char
*
)
pRes
,
pSchema
,
numOfOutput
);
SExprInfo
*
exprInfo
=
NULL
;
/*int32_t code = */
createQueryFunc
(
&
info
,
numOfOutput
,
&
exprInfo
,
px
->
exprList
->
pData
,
NULL
,
px
->
type
,
NULL
);
px
->
pQInfo
=
createQueryInfoFromQueryNode
(
px
,
exprInfo
,
&
tableGroupInfo
,
pSourceOptr
,
NULL
,
NULL
,
MASTER_SCAN
);
px
->
pQInfo
=
createQueryInfoFromQueryNode
(
px
,
exprInfo
,
&
tableGroupInfo
,
pSourceOptr
,
NULL
,
NULL
,
MASTER_SCAN
);
uint64_t
qId
=
0
;
uint64_t
qId
=
0
;
qTableQuery
(
px
->
pQInfo
,
&
qId
);
qTableQuery
(
px
->
pQInfo
,
&
qId
);
convertQueryResult
(
pRes
,
px
);
convertQueryResult
(
pRes
,
px
);
tfree
(
pColumnInfo
);
}
}
}
}
...
@@ -750,9 +761,28 @@ void tscFreeQueryInfo(SSqlCmd* pCmd, bool removeMeta) {
...
@@ -750,9 +761,28 @@ void tscFreeQueryInfo(SSqlCmd* pCmd, bool removeMeta) {
for
(
int32_t
i
=
0
;
i
<
pCmd
->
numOfClause
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pCmd
->
numOfClause
;
++
i
)
{
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfo
(
pCmd
,
i
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfo
(
pCmd
,
i
);
// recursive call it
if
(
taosArrayGetSize
(
pQueryInfo
->
pUpstream
)
>
0
)
{
SQueryInfo
*
pUp
=
taosArrayGetP
(
pQueryInfo
->
pUpstream
,
0
);
freeQueryInfoImpl
(
pUp
);
clearAllTableMetaInfo
(
pUp
,
removeMeta
);
if
(
pUp
->
pQInfo
!=
NULL
)
{
qDestroyQueryInfo
(
pUp
->
pQInfo
);
pUp
->
pQInfo
=
NULL
;
}
tfree
(
pUp
);
}
freeQueryInfoImpl
(
pQueryInfo
);
freeQueryInfoImpl
(
pQueryInfo
);
clearAllTableMetaInfo
(
pQueryInfo
,
removeMeta
);
clearAllTableMetaInfo
(
pQueryInfo
,
removeMeta
);
if
(
pQueryInfo
->
pQInfo
!=
NULL
)
{
qDestroyQueryInfo
(
pQueryInfo
->
pQInfo
);
pQueryInfo
->
pQInfo
=
NULL
;
}
tfree
(
pQueryInfo
);
tfree
(
pQueryInfo
);
}
}
...
@@ -2312,7 +2342,11 @@ void clearAllTableMetaInfo(SQueryInfo* pQueryInfo, bool removeMeta) {
...
@@ -2312,7 +2342,11 @@ void clearAllTableMetaInfo(SQueryInfo* pQueryInfo, bool removeMeta) {
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
i
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
i
);
if
(
removeMeta
)
{
if
(
pTableMetaInfo
->
pTableMeta
&&
pTableMetaInfo
->
pTableMeta
->
tableType
==
TSDB_TEMP_TABLE
)
{
tfree
(
pTableMetaInfo
->
pTableMeta
);
}
if
(
removeMeta
)
{
char
name
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
char
name
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
tNameExtractFullName
(
&
pTableMetaInfo
->
name
,
name
);
tNameExtractFullName
(
&
pTableMetaInfo
->
name
,
name
);
...
...
src/inc/tsdb.h
浏览文件 @
70a02863
...
@@ -221,7 +221,7 @@ typedef struct {
...
@@ -221,7 +221,7 @@ typedef struct {
typedef
struct
{
typedef
struct
{
uint32_t
numOfTables
;
uint32_t
numOfTables
;
SArray
*
pGroupList
;
SArray
*
pGroupList
;
SHashObj
*
map
;
// speedup acquire the tableQueryInfo by table uid
SHashObj
*
map
;
// speedup acquire the tableQueryInfo by table uid
}
STableGroupInfo
;
}
STableGroupInfo
;
...
...
src/query/inc/qExecutor.h
浏览文件 @
70a02863
...
@@ -503,6 +503,8 @@ SSDataBlock* doMultiwayMergeSort(void* param, bool* newgroup);
...
@@ -503,6 +503,8 @@ SSDataBlock* doMultiwayMergeSort(void* param, bool* newgroup);
SSDataBlock
*
doSLimit
(
void
*
param
,
bool
*
newgroup
);
SSDataBlock
*
doSLimit
(
void
*
param
,
bool
*
newgroup
);
SSDataBlock
*
createOutputBuf
(
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
int32_t
numOfRows
);
SSDataBlock
*
createOutputBuf
(
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
int32_t
numOfRows
);
void
*
destroyOutputBuf
(
SSDataBlock
*
pBlock
);
void
setInputDataBlock
(
SOperatorInfo
*
pOperator
,
SQLFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
,
int32_t
order
);
void
setInputDataBlock
(
SOperatorInfo
*
pOperator
,
SQLFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
,
int32_t
order
);
int32_t
getNumOfResult
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SQLFunctionCtx
*
pCtx
,
int32_t
numOfOutput
);
int32_t
getNumOfResult
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SQLFunctionCtx
*
pCtx
,
int32_t
numOfOutput
);
void
finalizeQueryResult
(
SOperatorInfo
*
pOperator
,
SQLFunctionCtx
*
pCtx
,
SResultRowInfo
*
pResultRowInfo
,
int32_t
*
rowCellInfoOffset
);
void
finalizeQueryResult
(
SOperatorInfo
*
pOperator
,
SQLFunctionCtx
*
pCtx
,
SResultRowInfo
*
pResultRowInfo
,
int32_t
*
rowCellInfoOffset
);
...
...
src/query/inc/qSqlparser.h
浏览文件 @
70a02863
...
@@ -40,8 +40,8 @@ enum SQL_NODE_TYPE {
...
@@ -40,8 +40,8 @@ enum SQL_NODE_TYPE {
};
};
enum
SQL_NODE_FROM_TYPE
{
enum
SQL_NODE_FROM_TYPE
{
SQL_NODE_FROM_SUBQUERY
=
1
,
SQL_NODE_FROM_SUBQUERY
=
1
,
SQL_NODE_FROM_
NAM
ELIST
=
2
,
SQL_NODE_FROM_
TABL
ELIST
=
2
,
};
};
extern
char
tTokenTypeSwitcher
[
13
];
extern
char
tTokenTypeSwitcher
[
13
];
...
@@ -83,11 +83,11 @@ typedef struct SSessionWindowVal {
...
@@ -83,11 +83,11 @@ typedef struct SSessionWindowVal {
SStrToken
gap
;
SStrToken
gap
;
}
SSessionWindowVal
;
}
SSessionWindowVal
;
struct
S
From
Info
;
struct
S
Relation
Info
;
typedef
struct
S
Query
SqlNode
{
typedef
struct
SSqlNode
{
struct
SArray
*
pSelNodeList
;
// select clause
struct
SArray
*
pSelNodeList
;
// select clause
struct
S
FromInfo
*
from
;
// from clause SArray<SQuery
SqlNode>
struct
S
RelationInfo
*
from
;
// from clause SArray<S
SqlNode>
struct
tSqlExpr
*
pWhere
;
// where clause [optional]
struct
tSqlExpr
*
pWhere
;
// where clause [optional]
SArray
*
pGroupby
;
// groupby clause, only for tags[optional], SArray<tVariantListItem>
SArray
*
pGroupby
;
// groupby clause, only for tags[optional], SArray<tVariantListItem>
SArray
*
pSortOrder
;
// orderby [optional], SArray<tVariantListItem>
SArray
*
pSortOrder
;
// orderby [optional], SArray<tVariantListItem>
...
@@ -98,25 +98,22 @@ typedef struct SQuerySqlNode {
...
@@ -98,25 +98,22 @@ typedef struct SQuerySqlNode {
SLimitVal
limit
;
// limit offset [optional]
SLimitVal
limit
;
// limit offset [optional]
SLimitVal
slimit
;
// group limit offset [optional]
SLimitVal
slimit
;
// group limit offset [optional]
SStrToken
sqlstr
;
// sql string in select clause
SStrToken
sqlstr
;
// sql string in select clause
}
S
Query
SqlNode
;
}
SSqlNode
;
typedef
struct
STableNamePair
{
typedef
struct
STableNamePair
{
SStrToken
name
;
SStrToken
name
;
SStrToken
aliasName
;
SStrToken
aliasName
;
}
STableNamePair
;
}
STableNamePair
;
typedef
struct
SSubclauseInfo
{
// "UNION" multiple select sub-clause
//
typedef struct SSubclauseInfo { // "UNION" multiple select sub-clause
SQuery
SqlNode
**
pClause
;
// S
SqlNode **pClause;
int32_t
numOfClause
;
// int32_t
numOfClause;
}
SSubclauseInfo
;
//
} SSubclauseInfo;
typedef
struct
SFromInfo
{
typedef
struct
SRelationInfo
{
int32_t
type
;
// nested query|table name list
int32_t
type
;
// nested query|table name list
union
{
SArray
*
list
;
// SArray<STableNamePair>|SArray<SSqlNode*>
SSubclauseInfo
pNode
;
}
SRelationInfo
;
SArray
*
tableList
;
// SArray<STableNamePair>
};
}
SFromInfo
;
typedef
struct
SCreatedTableInfo
{
typedef
struct
SCreatedTableInfo
{
SStrToken
name
;
// table name token
SStrToken
name
;
// table name token
...
@@ -139,7 +136,7 @@ typedef struct SCreateTableSql {
...
@@ -139,7 +136,7 @@ typedef struct SCreateTableSql {
}
colInfo
;
}
colInfo
;
SArray
*
childTableInfo
;
// SArray<SCreatedTableInfo>
SArray
*
childTableInfo
;
// SArray<SCreatedTableInfo>
S
Query
SqlNode
*
pSelect
;
SSqlNode
*
pSelect
;
}
SCreateTableSql
;
}
SCreateTableSql
;
typedef
struct
SAlterTableInfo
{
typedef
struct
SAlterTableInfo
{
...
@@ -216,7 +213,7 @@ typedef struct SMiscInfo {
...
@@ -216,7 +213,7 @@ typedef struct SMiscInfo {
typedef
struct
SSqlInfo
{
typedef
struct
SSqlInfo
{
int32_t
type
;
int32_t
type
;
bool
valid
;
bool
valid
;
S
SubclauseInfo
subclauseInfo
;
S
Array
*
list
;
// todo refactor
char
msg
[
256
];
char
msg
[
256
];
union
{
union
{
SCreateTableSql
*
pCreateTableInfo
;
SCreateTableSql
*
pCreateTableInfo
;
...
@@ -253,9 +250,9 @@ SArray *tVariantListAppend(SArray *pList, tVariant *pVar, uint8_t sortOrder);
...
@@ -253,9 +250,9 @@ SArray *tVariantListAppend(SArray *pList, tVariant *pVar, uint8_t sortOrder);
SArray
*
tVariantListInsert
(
SArray
*
pList
,
tVariant
*
pVar
,
uint8_t
sortOrder
,
int32_t
index
);
SArray
*
tVariantListInsert
(
SArray
*
pList
,
tVariant
*
pVar
,
uint8_t
sortOrder
,
int32_t
index
);
SArray
*
tVariantListAppendToken
(
SArray
*
pList
,
SStrToken
*
pAliasToken
,
uint8_t
sortOrder
);
SArray
*
tVariantListAppendToken
(
SArray
*
pList
,
SStrToken
*
pAliasToken
,
uint8_t
sortOrder
);
S
FromInfo
*
setTableNameList
(
SFrom
Info
*
pFromInfo
,
SStrToken
*
pName
,
SStrToken
*
pAlias
);
S
RelationInfo
*
setTableNameList
(
SRelation
Info
*
pFromInfo
,
SStrToken
*
pName
,
SStrToken
*
pAlias
);
S
FromInfo
*
setSubquery
(
SFromInfo
*
pFromInfo
,
SSubclauseInfo
*
pSqlNode
);
S
RelationInfo
*
setSubquery
(
SRelationInfo
*
pFromInfo
,
SArray
*
pSqlNode
);
void
*
destroyFromInfo
(
S
From
Info
*
pFromInfo
);
void
*
destroyFromInfo
(
S
Relation
Info
*
pFromInfo
);
// sql expr leaf node
// sql expr leaf node
tSqlExpr
*
tSqlExprCreateIdValue
(
SStrToken
*
pToken
,
int32_t
optrType
);
tSqlExpr
*
tSqlExprCreateIdValue
(
SStrToken
*
pToken
,
int32_t
optrType
);
...
@@ -270,23 +267,22 @@ void tSqlExprDestroy(tSqlExpr *pExpr);
...
@@ -270,23 +267,22 @@ void tSqlExprDestroy(tSqlExpr *pExpr);
SArray
*
tSqlExprListAppend
(
SArray
*
pList
,
tSqlExpr
*
pNode
,
SStrToken
*
pDistinct
,
SStrToken
*
pToken
);
SArray
*
tSqlExprListAppend
(
SArray
*
pList
,
tSqlExpr
*
pNode
,
SStrToken
*
pDistinct
,
SStrToken
*
pToken
);
void
tSqlExprListDestroy
(
SArray
*
pList
);
void
tSqlExprListDestroy
(
SArray
*
pList
);
S
QuerySqlNode
*
tSetQuerySqlNode
(
SStrToken
*
pSelectToken
,
SArray
*
pSelNodeList
,
SFrom
Info
*
pFrom
,
tSqlExpr
*
pWhere
,
S
SqlNode
*
tSetQuerySqlNode
(
SStrToken
*
pSelectToken
,
SArray
*
pSelNodeList
,
SRelation
Info
*
pFrom
,
tSqlExpr
*
pWhere
,
SArray
*
pGroupby
,
SArray
*
pSortOrder
,
SIntervalVal
*
pInterval
,
SSessionWindowVal
*
ps
,
SArray
*
pGroupby
,
SArray
*
pSortOrder
,
SIntervalVal
*
pInterval
,
SSessionWindowVal
*
ps
,
SStrToken
*
pSliding
,
SArray
*
pFill
,
SLimitVal
*
pLimit
,
SLimitVal
*
pgLimit
);
SStrToken
*
pSliding
,
SArray
*
pFill
,
SLimitVal
*
pLimit
,
SLimitVal
*
pgLimit
);
SCreateTableSql
*
tSetCreateTableInfo
(
SArray
*
pCols
,
SArray
*
pTags
,
S
Query
SqlNode
*
pSelect
,
int32_t
type
);
SCreateTableSql
*
tSetCreateTableInfo
(
SArray
*
pCols
,
SArray
*
pTags
,
SSqlNode
*
pSelect
,
int32_t
type
);
SAlterTableInfo
*
tSetAlterTableInfo
(
SStrToken
*
pTableName
,
SArray
*
pCols
,
SArray
*
pVals
,
int32_t
type
,
int16_t
tableTable
);
SAlterTableInfo
*
tSetAlterTableInfo
(
SStrToken
*
pTableName
,
SArray
*
pCols
,
SArray
*
pVals
,
int32_t
type
,
int16_t
tableTable
);
SCreatedTableInfo
createNewChildTableInfo
(
SStrToken
*
pTableName
,
SArray
*
pTagNames
,
SArray
*
pTagVals
,
SStrToken
*
pToken
,
SStrToken
*
igExists
);
SCreatedTableInfo
createNewChildTableInfo
(
SStrToken
*
pTableName
,
SArray
*
pTagNames
,
SArray
*
pTagVals
,
SStrToken
*
pToken
,
SStrToken
*
igExists
);
void
destroyAllS
electClause
(
SSubclauseInfo
*
pSql
);
void
destroyAllS
qlNode
(
SArray
*
pSqlNode
);
void
destroy
QuerySqlNode
(
SQuery
SqlNode
*
pSql
);
void
destroy
SqlNode
(
S
SqlNode
*
pSql
);
void
freeCreateTableInfo
(
void
*
p
);
void
freeCreateTableInfo
(
void
*
p
);
SSqlInfo
*
setSqlInfo
(
SSqlInfo
*
pInfo
,
void
*
pSqlExprInfo
,
SStrToken
*
pTableName
,
int32_t
type
);
SSqlInfo
*
setSqlInfo
(
SSqlInfo
*
pInfo
,
void
*
pSqlExprInfo
,
SStrToken
*
pTableName
,
int32_t
type
);
SSubclauseInfo
*
setSubclause
(
SSubclauseInfo
*
pClause
,
void
*
pSqlExprInfo
);
SArray
*
setSubclause
(
SArray
*
pList
,
void
*
pSqlNode
);
SArray
*
appendSelectClause
(
SArray
*
pList
,
void
*
pSubclause
);
SSubclauseInfo
*
appendSelectClause
(
SSubclauseInfo
*
pInfo
,
void
*
pSubclause
);
void
setCreatedTableName
(
SSqlInfo
*
pInfo
,
SStrToken
*
pTableNameToken
,
SStrToken
*
pIfNotExists
);
void
setCreatedTableName
(
SSqlInfo
*
pInfo
,
SStrToken
*
pTableNameToken
,
SStrToken
*
pIfNotExists
);
...
...
src/query/inc/sql.y
浏览文件 @
70a02863
...
@@ -450,16 +450,16 @@ tagitem(A) ::= PLUS(X) FLOAT(Y). {
...
@@ -450,16 +450,16 @@ tagitem(A) ::= PLUS(X) FLOAT(Y). {
}
}
//////////////////////// The SELECT statement /////////////////////////////////
//////////////////////// The SELECT statement /////////////////////////////////
%type select {S
Query
SqlNode*}
%type select {SSqlNode*}
%destructor select {destroy
Query
SqlNode($$);}
%destructor select {destroySqlNode($$);}
select(A) ::= SELECT(T) selcollist(W) from(X) where_opt(Y) interval_opt(K) session_option(H) fill_opt(F) sliding_opt(S) groupby_opt(P) orderby_opt(Z) having_opt(N) slimit_opt(G) limit_opt(L). {
select(A) ::= SELECT(T) selcollist(W) from(X) where_opt(Y) interval_opt(K) session_option(H) fill_opt(F) sliding_opt(S) groupby_opt(P) orderby_opt(Z) having_opt(N) slimit_opt(G) limit_opt(L). {
A = tSetQuerySqlNode(&T, W, X, Y, P, Z, &K, &H, &S, F, &L, &G);
A = tSetQuerySqlNode(&T, W, X, Y, P, Z, &K, &H, &S, F, &L, &G);
}
}
select(A) ::= LP select(B) RP. {A = B;}
select(A) ::= LP select(B) RP. {A = B;}
%type union {S
SubclauseInfo
*}
%type union {S
Array
*}
%destructor union {destroyAllS
electClaus
e($$);}
%destructor union {destroyAllS
qlNod
e($$);}
union(Y) ::= select(X). { Y = setSubclause(NULL, X); }
union(Y) ::= select(X). { Y = setSubclause(NULL, X); }
union(Y) ::= union(Z) UNION ALL select(X). { Y = appendSelectClause(Z, X); }
union(Y) ::= union(Z) UNION ALL select(X). { Y = appendSelectClause(Z, X); }
...
@@ -505,11 +505,11 @@ distinct(X) ::= DISTINCT(Y). { X = Y; }
...
@@ -505,11 +505,11 @@ distinct(X) ::= DISTINCT(Y). { X = Y; }
distinct(X) ::= . { X.n = 0;}
distinct(X) ::= . { X.n = 0;}
// A complete FROM clause.
// A complete FROM clause.
%type from {S
From
Info*}
%type from {S
Relation
Info*}
from(A) ::= FROM tablelist(X). {A = X;}
from(A) ::= FROM tablelist(X). {A = X;}
from(A) ::= FROM LP union(Y) RP. {A = setSubquery(NULL, Y);}
from(A) ::= FROM LP union(Y) RP. {A = setSubquery(NULL, Y);}
%type tablelist {S
From
Info*}
%type tablelist {S
Relation
Info*}
tablelist(A) ::= ids(X) cpxName(Y). {
tablelist(A) ::= ids(X) cpxName(Y). {
X.n += Y.n;
X.n += Y.n;
A = setTableNameList(NULL, &X, NULL);
A = setTableNameList(NULL, &X, NULL);
...
...
src/query/src/qExecutor.c
浏览文件 @
70a02863
...
@@ -201,7 +201,7 @@ SSDataBlock* createOutputBuf(SExprInfo* pExpr, int32_t numOfOutput, int32_t numO
...
@@ -201,7 +201,7 @@ SSDataBlock* createOutputBuf(SExprInfo* pExpr, int32_t numOfOutput, int32_t numO
return
res
;
return
res
;
}
}
static
void
*
destroyOutputBuf
(
SSDataBlock
*
pBlock
)
{
void
*
destroyOutputBuf
(
SSDataBlock
*
pBlock
)
{
if
(
pBlock
==
NULL
)
{
if
(
pBlock
==
NULL
)
{
return
NULL
;
return
NULL
;
}
}
...
...
src/query/src/qSqlParser.c
浏览文件 @
70a02863
...
@@ -452,13 +452,13 @@ SArray *tVariantListInsert(SArray *pList, tVariant *pVar, uint8_t sortOrder, int
...
@@ -452,13 +452,13 @@ SArray *tVariantListInsert(SArray *pList, tVariant *pVar, uint8_t sortOrder, int
return
pList
;
return
pList
;
}
}
S
FromInfo
*
setTableNameList
(
SFromInfo
*
pFrom
Info
,
SStrToken
*
pName
,
SStrToken
*
pAlias
)
{
S
RelationInfo
*
setTableNameList
(
SRelationInfo
*
pRelation
Info
,
SStrToken
*
pName
,
SStrToken
*
pAlias
)
{
if
(
p
From
Info
==
NULL
)
{
if
(
p
Relation
Info
==
NULL
)
{
p
FromInfo
=
calloc
(
1
,
sizeof
(
SFrom
Info
));
p
RelationInfo
=
calloc
(
1
,
sizeof
(
SRelation
Info
));
p
FromInfo
->
tableL
ist
=
taosArrayInit
(
4
,
sizeof
(
STableNamePair
));
p
RelationInfo
->
l
ist
=
taosArrayInit
(
4
,
sizeof
(
STableNamePair
));
}
}
p
FromInfo
->
type
=
SQL_NODE_FROM_NAM
ELIST
;
p
RelationInfo
->
type
=
SQL_NODE_FROM_TABL
ELIST
;
STableNamePair
p
=
{.
name
=
*
pName
};
STableNamePair
p
=
{.
name
=
*
pName
};
if
(
pAlias
!=
NULL
)
{
if
(
pAlias
!=
NULL
)
{
p
.
aliasName
=
*
pAlias
;
p
.
aliasName
=
*
pAlias
;
...
@@ -466,34 +466,39 @@ SFromInfo *setTableNameList(SFromInfo* pFromInfo, SStrToken *pName, SStrToken* p
...
@@ -466,34 +466,39 @@ SFromInfo *setTableNameList(SFromInfo* pFromInfo, SStrToken *pName, SStrToken* p
TPARSER_SET_NONE_TOKEN
(
p
.
aliasName
);
TPARSER_SET_NONE_TOKEN
(
p
.
aliasName
);
}
}
taosArrayPush
(
pFromInfo
->
tableList
,
&
p
);
taosArrayPush
(
pRelationInfo
->
list
,
&
p
);
return
pRelationInfo
;
return
pFromInfo
;
}
}
SFromInfo
*
setSubquery
(
SFromInfo
*
pFromInfo
,
SSubclauseInfo
*
pSqlNode
)
{
SRelationInfo
*
setSubquery
(
SRelationInfo
*
pRelationInfo
,
SArray
*
pList
)
{
if
(
pFromInfo
==
NULL
)
{
if
(
pRelationInfo
==
NULL
)
{
pFromInfo
=
calloc
(
1
,
sizeof
(
SFromInfo
));
pRelationInfo
=
calloc
(
1
,
sizeof
(
SRelationInfo
));
pRelationInfo
->
list
=
taosArrayInit
(
4
,
POINTER_BYTES
);
}
}
p
From
Info
->
type
=
SQL_NODE_FROM_SUBQUERY
;
p
Relation
Info
->
type
=
SQL_NODE_FROM_SUBQUERY
;
pFromInfo
->
pNode
=
*
pSqlNode
;
taosArrayPush
(
pRelationInfo
->
list
,
&
pList
)
;
return
p
From
Info
;
return
p
Relation
Info
;
}
}
void
*
destroyFromInfo
(
S
FromInfo
*
pFrom
Info
)
{
void
*
destroyFromInfo
(
S
RelationInfo
*
pRelation
Info
)
{
if
(
p
From
Info
==
NULL
)
{
if
(
p
Relation
Info
==
NULL
)
{
return
NULL
;
return
NULL
;
}
}
if
(
p
FromInfo
->
type
==
SQL_NODE_FROM_NAM
ELIST
)
{
if
(
p
RelationInfo
->
type
==
SQL_NODE_FROM_TABL
ELIST
)
{
taosArrayDestroy
(
p
FromInfo
->
tableL
ist
);
taosArrayDestroy
(
p
RelationInfo
->
l
ist
);
}
else
{
}
else
{
destroyAllSelectClause
(
&
pFromInfo
->
pNode
);
size_t
size
=
taosArrayGetSize
(
pRelationInfo
->
list
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
SArray
*
pa
=
taosArrayGetP
(
pRelationInfo
->
list
,
0
);
destroyAllSqlNode
(
pa
);
}
taosArrayDestroy
(
pRelationInfo
->
list
);
}
}
tfree
(
p
From
Info
);
tfree
(
p
Relation
Info
);
return
NULL
;
return
NULL
;
}
}
...
@@ -637,13 +642,13 @@ void tSetColumnType(TAOS_FIELD *pField, SStrToken *type) {
...
@@ -637,13 +642,13 @@ void tSetColumnType(TAOS_FIELD *pField, SStrToken *type) {
/*
/*
* extract the select info out of sql string
* extract the select info out of sql string
*/
*/
S
QuerySqlNode
*
tSetQuerySqlNode
(
SStrToken
*
pSelectToken
,
SArray
*
pSelNodeList
,
SFrom
Info
*
pFrom
,
tSqlExpr
*
pWhere
,
S
SqlNode
*
tSetQuerySqlNode
(
SStrToken
*
pSelectToken
,
SArray
*
pSelNodeList
,
SRelation
Info
*
pFrom
,
tSqlExpr
*
pWhere
,
SArray
*
pGroupby
,
SArray
*
pSortOrder
,
SIntervalVal
*
pInterval
,
SArray
*
pGroupby
,
SArray
*
pSortOrder
,
SIntervalVal
*
pInterval
,
SSessionWindowVal
*
pSession
,
SStrToken
*
pSliding
,
SArray
*
pFill
,
SLimitVal
*
pLimit
,
SSessionWindowVal
*
pSession
,
SStrToken
*
pSliding
,
SArray
*
pFill
,
SLimitVal
*
pLimit
,
SLimitVal
*
psLimit
)
{
SLimitVal
*
psLimit
)
{
assert
(
pSelNodeList
!=
NULL
);
assert
(
pSelNodeList
!=
NULL
);
S
QuerySqlNode
*
pSqlNode
=
calloc
(
1
,
sizeof
(
SQuery
SqlNode
));
S
SqlNode
*
pSqlNode
=
calloc
(
1
,
sizeof
(
S
SqlNode
));
// all later sql string are belonged to the stream sql
// all later sql string are belonged to the stream sql
pSqlNode
->
sqlstr
=
*
pSelectToken
;
pSqlNode
->
sqlstr
=
*
pSelectToken
;
...
@@ -706,46 +711,47 @@ void freeCreateTableInfo(void* p) {
...
@@ -706,46 +711,47 @@ void freeCreateTableInfo(void* p) {
tfree
(
pInfo
->
tagdata
.
data
);
tfree
(
pInfo
->
tagdata
.
data
);
}
}
void
destroy
QuerySqlNode
(
SQuerySqlNode
*
pQuerySql
)
{
void
destroy
SqlNode
(
SSqlNode
*
pSqlNode
)
{
if
(
p
QuerySql
==
NULL
)
{
if
(
p
SqlNode
==
NULL
)
{
return
;
return
;
}
}
tSqlExprListDestroy
(
p
QuerySql
->
pSelNodeList
);
tSqlExprListDestroy
(
p
SqlNode
->
pSelNodeList
);
p
QuerySql
->
pSelNodeList
=
NULL
;
p
SqlNode
->
pSelNodeList
=
NULL
;
tSqlExprDestroy
(
p
QuerySql
->
pWhere
);
tSqlExprDestroy
(
p
SqlNode
->
pWhere
);
p
QuerySql
->
pWhere
=
NULL
;
p
SqlNode
->
pWhere
=
NULL
;
taosArrayDestroyEx
(
p
QuerySql
->
pSortOrder
,
freeVariant
);
taosArrayDestroyEx
(
p
SqlNode
->
pSortOrder
,
freeVariant
);
p
QuerySql
->
pSortOrder
=
NULL
;
p
SqlNode
->
pSortOrder
=
NULL
;
taosArrayDestroyEx
(
p
QuerySql
->
pGroupby
,
freeVariant
);
taosArrayDestroyEx
(
p
SqlNode
->
pGroupby
,
freeVariant
);
p
QuerySql
->
pGroupby
=
NULL
;
p
SqlNode
->
pGroupby
=
NULL
;
p
QuerySql
->
from
=
destroyFromInfo
(
pQuerySql
->
from
);
p
SqlNode
->
from
=
destroyFromInfo
(
pSqlNode
->
from
);
taosArrayDestroyEx
(
p
QuerySql
->
fillType
,
freeVariant
);
taosArrayDestroyEx
(
p
SqlNode
->
fillType
,
freeVariant
);
p
QuerySql
->
fillType
=
NULL
;
p
SqlNode
->
fillType
=
NULL
;
free
(
p
QuerySql
);
free
(
p
SqlNode
);
}
}
void
destroyAllS
electClause
(
SSubclauseInfo
*
pClause
)
{
void
destroyAllS
qlNode
(
SArray
*
pList
)
{
if
(
p
Clause
==
NULL
||
pClause
->
numOfClause
==
0
)
{
if
(
p
List
==
NULL
)
{
return
;
return
;
}
}
for
(
int32_t
i
=
0
;
i
<
pClause
->
numOfClause
;
++
i
)
{
size_t
size
=
taosArrayGetSize
(
pList
);
SQuerySqlNode
*
pQuerySql
=
pClause
->
pClause
[
i
];
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
destroyQuerySqlNode
(
pQuerySql
);
SSqlNode
*
pNode
=
taosArrayGetP
(
pList
,
0
);
destroySqlNode
(
pNode
);
}
}
t
free
(
pClause
->
pClause
);
t
aosArrayDestroy
(
pList
);
}
}
SCreateTableSql
*
tSetCreateTableInfo
(
SArray
*
pCols
,
SArray
*
pTags
,
S
Query
SqlNode
*
pSelect
,
int32_t
type
)
{
SCreateTableSql
*
tSetCreateTableInfo
(
SArray
*
pCols
,
SArray
*
pTags
,
SSqlNode
*
pSelect
,
int32_t
type
)
{
SCreateTableSql
*
pCreate
=
calloc
(
1
,
sizeof
(
SCreateTableSql
));
SCreateTableSql
*
pCreate
=
calloc
(
1
,
sizeof
(
SCreateTableSql
));
switch
(
type
)
{
switch
(
type
)
{
...
@@ -813,7 +819,7 @@ SAlterTableInfo *tSetAlterTableInfo(SStrToken *pTableName, SArray *pCols, SArray
...
@@ -813,7 +819,7 @@ SAlterTableInfo *tSetAlterTableInfo(SStrToken *pTableName, SArray *pCols, SArray
}
}
void
*
destroyCreateTableSql
(
SCreateTableSql
*
pCreate
)
{
void
*
destroyCreateTableSql
(
SCreateTableSql
*
pCreate
)
{
destroy
Query
SqlNode
(
pCreate
->
pSelect
);
destroySqlNode
(
pCreate
->
pSelect
);
taosArrayDestroy
(
pCreate
->
colInfo
.
pColumns
);
taosArrayDestroy
(
pCreate
->
colInfo
.
pColumns
);
taosArrayDestroy
(
pCreate
->
colInfo
.
pTagColumns
);
taosArrayDestroy
(
pCreate
->
colInfo
.
pTagColumns
);
...
@@ -828,7 +834,7 @@ void SqlInfoDestroy(SSqlInfo *pInfo) {
...
@@ -828,7 +834,7 @@ void SqlInfoDestroy(SSqlInfo *pInfo) {
if
(
pInfo
==
NULL
)
return
;
if
(
pInfo
==
NULL
)
return
;
if
(
pInfo
->
type
==
TSDB_SQL_SELECT
)
{
if
(
pInfo
->
type
==
TSDB_SQL_SELECT
)
{
destroyAllS
electClause
(
&
pInfo
->
subclauseInfo
);
destroyAllS
qlNode
(
pInfo
->
list
);
}
else
if
(
pInfo
->
type
==
TSDB_SQL_CREATE_TABLE
)
{
}
else
if
(
pInfo
->
type
==
TSDB_SQL_CREATE_TABLE
)
{
pInfo
->
pCreateTableInfo
=
destroyCreateTableSql
(
pInfo
->
pCreateTableInfo
);
pInfo
->
pCreateTableInfo
=
destroyCreateTableSql
(
pInfo
->
pCreateTableInfo
);
}
else
if
(
pInfo
->
type
==
TSDB_SQL_ALTER_TABLE
)
{
}
else
if
(
pInfo
->
type
==
TSDB_SQL_ALTER_TABLE
)
{
...
@@ -849,31 +855,20 @@ void SqlInfoDestroy(SSqlInfo *pInfo) {
...
@@ -849,31 +855,20 @@ void SqlInfoDestroy(SSqlInfo *pInfo) {
}
}
}
}
SSubclauseInfo
*
setSubclause
(
SSubclauseInfo
*
pSubclause
,
void
*
pSqlExprInfo
)
{
SArray
*
setSubclause
(
SArray
*
pList
,
void
*
pSqlNode
)
{
if
(
pSubclause
==
NULL
)
{
if
(
pList
==
NULL
)
{
pSubclause
=
calloc
(
1
,
sizeof
(
SSubclauseInfo
));
pList
=
taosArrayInit
(
1
,
POINTER_BYTES
);
}
int32_t
newSize
=
pSubclause
->
numOfClause
+
1
;
char
*
tmp
=
realloc
(
pSubclause
->
pClause
,
newSize
*
POINTER_BYTES
);
if
(
tmp
==
NULL
)
{
return
pSubclause
;
}
}
pSubclause
->
pClause
=
(
SQuerySqlNode
**
)
tmp
;
taosArrayPush
(
pList
,
&
pSqlNode
);
return
pList
;
pSubclause
->
pClause
[
newSize
-
1
]
=
pSqlExprInfo
;
pSubclause
->
numOfClause
++
;
return
pSubclause
;
}
}
SSqlInfo
*
setSqlInfo
(
SSqlInfo
*
pInfo
,
void
*
pSqlExprInfo
,
SStrToken
*
pTableName
,
int32_t
type
)
{
SSqlInfo
*
setSqlInfo
(
SSqlInfo
*
pInfo
,
void
*
pSqlExprInfo
,
SStrToken
*
pTableName
,
int32_t
type
)
{
pInfo
->
type
=
type
;
pInfo
->
type
=
type
;
if
(
type
==
TSDB_SQL_SELECT
)
{
if
(
type
==
TSDB_SQL_SELECT
)
{
pInfo
->
subclauseInfo
=
*
(
SSubclauseInfo
*
)
pSqlExprInfo
;
pInfo
->
list
=
(
SArray
*
)
pSqlExprInfo
;
free
(
pSqlExprInfo
);
}
else
{
}
else
{
pInfo
->
pCreateTableInfo
=
pSqlExprInfo
;
pInfo
->
pCreateTableInfo
=
pSqlExprInfo
;
}
}
...
@@ -885,16 +880,9 @@ SSqlInfo* setSqlInfo(SSqlInfo *pInfo, void *pSqlExprInfo, SStrToken *pTableName,
...
@@ -885,16 +880,9 @@ SSqlInfo* setSqlInfo(SSqlInfo *pInfo, void *pSqlExprInfo, SStrToken *pTableName,
return
pInfo
;
return
pInfo
;
}
}
SSubclauseInfo
*
appendSelectClause
(
SSubclauseInfo
*
pQueryInfo
,
void
*
pSubclause
)
{
SArray
*
appendSelectClause
(
SArray
*
pList
,
void
*
pSubclause
)
{
char
*
tmp
=
realloc
(
pQueryInfo
->
pClause
,
(
pQueryInfo
->
numOfClause
+
1
)
*
POINTER_BYTES
);
taosArrayPush
(
pList
,
&
pSubclause
);
if
(
tmp
==
NULL
)
{
// out of memory
return
pList
;
return
pQueryInfo
;
}
pQueryInfo
->
pClause
=
(
SQuerySqlNode
**
)
tmp
;
pQueryInfo
->
pClause
[
pQueryInfo
->
numOfClause
++
]
=
pSubclause
;
return
pQueryInfo
;
}
}
void
setCreatedTableName
(
SSqlInfo
*
pInfo
,
SStrToken
*
pTableNameToken
,
SStrToken
*
pIfNotExists
)
{
void
setCreatedTableName
(
SSqlInfo
*
pInfo
,
SStrToken
*
pTableNameToken
,
SStrToken
*
pIfNotExists
)
{
...
...
src/query/src/sql.c
浏览文件 @
70a02863
...
@@ -105,20 +105,19 @@ typedef union {
...
@@ -105,20 +105,19 @@ typedef union {
ParseTOKENTYPE
yy0
;
ParseTOKENTYPE
yy0
;
SCreateTableSql
*
yy14
;
SCreateTableSql
*
yy14
;
int
yy20
;
int
yy20
;
SSqlNode
*
yy116
;
tSqlExpr
*
yy118
;
tSqlExpr
*
yy118
;
SArray
*
yy159
;
SArray
*
yy159
;
SIntervalVal
yy184
;
SIntervalVal
yy184
;
SCreatedTableInfo
yy206
;
SCreatedTableInfo
yy206
;
SRelationInfo
*
yy236
;
SSessionWindowVal
yy249
;
SSessionWindowVal
yy249
;
SQuerySqlNode
*
yy272
;
int64_t
yy317
;
int64_t
yy317
;
SCreateDbInfo
yy322
;
SCreateDbInfo
yy322
;
SCreateAcctInfo
yy351
;
SCreateAcctInfo
yy351
;
SSubclauseInfo
*
yy391
;
TAOS_FIELD
yy407
;
TAOS_FIELD
yy407
;
SLimitVal
yy440
;
SLimitVal
yy440
;
tVariant
yy488
;
tVariant
yy488
;
SFromInfo
*
yy514
;
}
YYMINORTYPE
;
}
YYMINORTYPE
;
#ifndef YYSTACKDEPTH
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
#define YYSTACKDEPTH 100
...
@@ -1426,7 +1425,7 @@ destroyCreateTableSql((yypminor->yy14));
...
@@ -1426,7 +1425,7 @@ destroyCreateTableSql((yypminor->yy14));
break
;
break
;
case
234
:
/* select */
case
234
:
/* select */
{
{
destroy
QuerySqlNode
((
yypminor
->
yy272
));
destroy
SqlNode
((
yypminor
->
yy116
));
}
}
break
;
break
;
case
237
:
/* selcollist */
case
237
:
/* selcollist */
...
@@ -1446,7 +1445,7 @@ tSqlExprDestroy((yypminor->yy118));
...
@@ -1446,7 +1445,7 @@ tSqlExprDestroy((yypminor->yy118));
break
;
break
;
case
249
:
/* union */
case
249
:
/* union */
{
{
destroyAllS
electClause
((
yypminor
->
yy391
));
destroyAllS
qlNode
((
yypminor
->
yy159
));
}
}
break
;
break
;
case
257
:
/* sortitem */
case
257
:
/* sortitem */
...
@@ -2540,7 +2539,7 @@ static void yy_reduce(
...
@@ -2540,7 +2539,7 @@ static void yy_reduce(
break
;
break
;
case
141
:
/* create_table_args ::= ifnotexists ids cpxName AS select */
case
141
:
/* create_table_args ::= ifnotexists ids cpxName AS select */
{
{
yylhsminor
.
yy14
=
tSetCreateTableInfo
(
NULL
,
NULL
,
yymsp
[
0
].
minor
.
yy
272
,
TSQL_CREATE_STREAM
);
yylhsminor
.
yy14
=
tSetCreateTableInfo
(
NULL
,
NULL
,
yymsp
[
0
].
minor
.
yy
116
,
TSQL_CREATE_STREAM
);
setSqlInfo
(
pInfo
,
yylhsminor
.
yy14
,
NULL
,
TSDB_SQL_CREATE_TABLE
);
setSqlInfo
(
pInfo
,
yylhsminor
.
yy14
,
NULL
,
TSDB_SQL_CREATE_TABLE
);
yymsp
[
-
3
].
minor
.
yy0
.
n
+=
yymsp
[
-
2
].
minor
.
yy0
.
n
;
yymsp
[
-
3
].
minor
.
yy0
.
n
+=
yymsp
[
-
2
].
minor
.
yy0
.
n
;
...
@@ -2595,29 +2594,29 @@ static void yy_reduce(
...
@@ -2595,29 +2594,29 @@ static void yy_reduce(
break
;
break
;
case
156
:
/* select ::= SELECT selcollist from where_opt interval_opt session_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */
case
156
:
/* select ::= SELECT selcollist from where_opt interval_opt session_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */
{
{
yylhsminor
.
yy
272
=
tSetQuerySqlNode
(
&
yymsp
[
-
12
].
minor
.
yy0
,
yymsp
[
-
11
].
minor
.
yy159
,
yymsp
[
-
10
].
minor
.
yy514
,
yymsp
[
-
9
].
minor
.
yy118
,
yymsp
[
-
4
].
minor
.
yy159
,
yymsp
[
-
3
].
minor
.
yy159
,
&
yymsp
[
-
8
].
minor
.
yy184
,
&
yymsp
[
-
7
].
minor
.
yy249
,
&
yymsp
[
-
5
].
minor
.
yy0
,
yymsp
[
-
6
].
minor
.
yy159
,
&
yymsp
[
0
].
minor
.
yy440
,
&
yymsp
[
-
1
].
minor
.
yy440
);
yylhsminor
.
yy
116
=
tSetQuerySqlNode
(
&
yymsp
[
-
12
].
minor
.
yy0
,
yymsp
[
-
11
].
minor
.
yy159
,
yymsp
[
-
10
].
minor
.
yy236
,
yymsp
[
-
9
].
minor
.
yy118
,
yymsp
[
-
4
].
minor
.
yy159
,
yymsp
[
-
3
].
minor
.
yy159
,
&
yymsp
[
-
8
].
minor
.
yy184
,
&
yymsp
[
-
7
].
minor
.
yy249
,
&
yymsp
[
-
5
].
minor
.
yy0
,
yymsp
[
-
6
].
minor
.
yy159
,
&
yymsp
[
0
].
minor
.
yy440
,
&
yymsp
[
-
1
].
minor
.
yy440
);
}
}
yymsp
[
-
12
].
minor
.
yy
272
=
yylhsminor
.
yy272
;
yymsp
[
-
12
].
minor
.
yy
116
=
yylhsminor
.
yy116
;
break
;
break
;
case
157
:
/* select ::= LP select RP */
case
157
:
/* select ::= LP select RP */
{
yymsp
[
-
2
].
minor
.
yy
272
=
yymsp
[
-
1
].
minor
.
yy272
;}
{
yymsp
[
-
2
].
minor
.
yy
116
=
yymsp
[
-
1
].
minor
.
yy116
;}
break
;
break
;
case
158
:
/* union ::= select */
case
158
:
/* union ::= select */
{
yylhsminor
.
yy
391
=
setSubclause
(
NULL
,
yymsp
[
0
].
minor
.
yy272
);
}
{
yylhsminor
.
yy
159
=
setSubclause
(
NULL
,
yymsp
[
0
].
minor
.
yy116
);
}
yymsp
[
0
].
minor
.
yy
391
=
yylhsminor
.
yy391
;
yymsp
[
0
].
minor
.
yy
159
=
yylhsminor
.
yy159
;
break
;
break
;
case
159
:
/* union ::= union UNION ALL select */
case
159
:
/* union ::= union UNION ALL select */
{
yylhsminor
.
yy
391
=
appendSelectClause
(
yymsp
[
-
3
].
minor
.
yy391
,
yymsp
[
0
].
minor
.
yy272
);
}
{
yylhsminor
.
yy
159
=
appendSelectClause
(
yymsp
[
-
3
].
minor
.
yy159
,
yymsp
[
0
].
minor
.
yy116
);
}
yymsp
[
-
3
].
minor
.
yy
391
=
yylhsminor
.
yy391
;
yymsp
[
-
3
].
minor
.
yy
159
=
yylhsminor
.
yy159
;
break
;
break
;
case
160
:
/* cmd ::= union */
case
160
:
/* cmd ::= union */
{
setSqlInfo
(
pInfo
,
yymsp
[
0
].
minor
.
yy
391
,
NULL
,
TSDB_SQL_SELECT
);
}
{
setSqlInfo
(
pInfo
,
yymsp
[
0
].
minor
.
yy
159
,
NULL
,
TSDB_SQL_SELECT
);
}
break
;
break
;
case
161
:
/* select ::= SELECT selcollist */
case
161
:
/* select ::= SELECT selcollist */
{
{
yylhsminor
.
yy
272
=
tSetQuerySqlNode
(
&
yymsp
[
-
1
].
minor
.
yy0
,
yymsp
[
0
].
minor
.
yy159
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
yylhsminor
.
yy
116
=
tSetQuerySqlNode
(
&
yymsp
[
-
1
].
minor
.
yy0
,
yymsp
[
0
].
minor
.
yy159
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
}
}
yymsp
[
-
1
].
minor
.
yy
272
=
yylhsminor
.
yy272
;
yymsp
[
-
1
].
minor
.
yy
116
=
yylhsminor
.
yy116
;
break
;
break
;
case
162
:
/* sclp ::= selcollist COMMA */
case
162
:
/* sclp ::= selcollist COMMA */
{
yylhsminor
.
yy159
=
yymsp
[
-
1
].
minor
.
yy159
;}
{
yylhsminor
.
yy159
=
yymsp
[
-
1
].
minor
.
yy159
;}
...
@@ -2655,38 +2654,38 @@ static void yy_reduce(
...
@@ -2655,38 +2654,38 @@ static void yy_reduce(
yymsp
[
0
].
minor
.
yy0
=
yylhsminor
.
yy0
;
yymsp
[
0
].
minor
.
yy0
=
yylhsminor
.
yy0
;
break
;
break
;
case
171
:
/* from ::= FROM tablelist */
case
171
:
/* from ::= FROM tablelist */
{
yymsp
[
-
1
].
minor
.
yy
514
=
yymsp
[
0
].
minor
.
yy514
;}
{
yymsp
[
-
1
].
minor
.
yy
236
=
yymsp
[
0
].
minor
.
yy236
;}
break
;
break
;
case
172
:
/* from ::= FROM LP union RP */
case
172
:
/* from ::= FROM LP union RP */
{
yymsp
[
-
3
].
minor
.
yy
514
=
setSubquery
(
NULL
,
yymsp
[
-
1
].
minor
.
yy391
);}
{
yymsp
[
-
3
].
minor
.
yy
236
=
setSubquery
(
NULL
,
yymsp
[
-
1
].
minor
.
yy159
);}
break
;
break
;
case
173
:
/* tablelist ::= ids cpxName */
case
173
:
/* tablelist ::= ids cpxName */
{
{
yymsp
[
-
1
].
minor
.
yy0
.
n
+=
yymsp
[
0
].
minor
.
yy0
.
n
;
yymsp
[
-
1
].
minor
.
yy0
.
n
+=
yymsp
[
0
].
minor
.
yy0
.
n
;
yylhsminor
.
yy
514
=
setTableNameList
(
NULL
,
&
yymsp
[
-
1
].
minor
.
yy0
,
NULL
);
yylhsminor
.
yy
236
=
setTableNameList
(
NULL
,
&
yymsp
[
-
1
].
minor
.
yy0
,
NULL
);
}
}
yymsp
[
-
1
].
minor
.
yy
514
=
yylhsminor
.
yy514
;
yymsp
[
-
1
].
minor
.
yy
236
=
yylhsminor
.
yy236
;
break
;
break
;
case
174
:
/* tablelist ::= ids cpxName ids */
case
174
:
/* tablelist ::= ids cpxName ids */
{
{
yymsp
[
-
2
].
minor
.
yy0
.
n
+=
yymsp
[
-
1
].
minor
.
yy0
.
n
;
yymsp
[
-
2
].
minor
.
yy0
.
n
+=
yymsp
[
-
1
].
minor
.
yy0
.
n
;
yylhsminor
.
yy
514
=
setTableNameList
(
NULL
,
&
yymsp
[
-
2
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
);
yylhsminor
.
yy
236
=
setTableNameList
(
NULL
,
&
yymsp
[
-
2
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
);
}
}
yymsp
[
-
2
].
minor
.
yy
514
=
yylhsminor
.
yy514
;
yymsp
[
-
2
].
minor
.
yy
236
=
yylhsminor
.
yy236
;
break
;
break
;
case
175
:
/* tablelist ::= tablelist COMMA ids cpxName */
case
175
:
/* tablelist ::= tablelist COMMA ids cpxName */
{
{
yymsp
[
-
1
].
minor
.
yy0
.
n
+=
yymsp
[
0
].
minor
.
yy0
.
n
;
yymsp
[
-
1
].
minor
.
yy0
.
n
+=
yymsp
[
0
].
minor
.
yy0
.
n
;
yylhsminor
.
yy
514
=
setTableNameList
(
yymsp
[
-
3
].
minor
.
yy514
,
&
yymsp
[
-
1
].
minor
.
yy0
,
NULL
);
yylhsminor
.
yy
236
=
setTableNameList
(
yymsp
[
-
3
].
minor
.
yy236
,
&
yymsp
[
-
1
].
minor
.
yy0
,
NULL
);
}
}
yymsp
[
-
3
].
minor
.
yy
514
=
yylhsminor
.
yy514
;
yymsp
[
-
3
].
minor
.
yy
236
=
yylhsminor
.
yy236
;
break
;
break
;
case
176
:
/* tablelist ::= tablelist COMMA ids cpxName ids */
case
176
:
/* tablelist ::= tablelist COMMA ids cpxName ids */
{
{
yymsp
[
-
2
].
minor
.
yy0
.
n
+=
yymsp
[
-
1
].
minor
.
yy0
.
n
;
yymsp
[
-
2
].
minor
.
yy0
.
n
+=
yymsp
[
-
1
].
minor
.
yy0
.
n
;
yylhsminor
.
yy
514
=
setTableNameList
(
yymsp
[
-
4
].
minor
.
yy514
,
&
yymsp
[
-
2
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
);
yylhsminor
.
yy
236
=
setTableNameList
(
yymsp
[
-
4
].
minor
.
yy236
,
&
yymsp
[
-
2
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
);
}
}
yymsp
[
-
4
].
minor
.
yy
514
=
yylhsminor
.
yy514
;
yymsp
[
-
4
].
minor
.
yy
236
=
yylhsminor
.
yy236
;
break
;
break
;
case
177
:
/* tmvar ::= VARIABLE */
case
177
:
/* tmvar ::= VARIABLE */
{
yylhsminor
.
yy0
=
yymsp
[
0
].
minor
.
yy0
;}
{
yylhsminor
.
yy0
=
yymsp
[
0
].
minor
.
yy0
;}
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
70a02863
...
@@ -3414,14 +3414,16 @@ void tsdbDestroyTableGroup(STableGroupInfo *pGroupList) {
...
@@ -3414,14 +3414,16 @@ void tsdbDestroyTableGroup(STableGroupInfo *pGroupList) {
size_t
numOfTables
=
taosArrayGetSize
(
p
);
size_t
numOfTables
=
taosArrayGetSize
(
p
);
for
(
int32_t
j
=
0
;
j
<
numOfTables
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
numOfTables
;
++
j
)
{
STable
*
pTable
=
taosArrayGetP
(
p
,
j
);
STable
*
pTable
=
taosArrayGetP
(
p
,
j
);
assert
(
pTable
!=
NULL
);
if
(
pTable
!=
NULL
)
{
// in case of handling retrieve data from tsdb
tsdbUnRefTable
(
pTable
);
tsdbUnRefTable
(
pTable
);
}
//assert(pTable != NULL);
}
}
taosArrayDestroy
(
p
);
taosArrayDestroy
(
p
);
}
}
taosHashCleanup
(
pGroupList
->
map
);
taosArrayDestroy
(
pGroupList
->
pGroupList
);
taosArrayDestroy
(
pGroupList
->
pGroupList
);
pGroupList
->
numOfTables
=
0
;
pGroupList
->
numOfTables
=
0
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录