Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
6402c2b0
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6402c2b0
编写于
1月 17, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-225]refactor codes.
上级
795690cd
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
196 addition
and
202 deletion
+196
-202
src/client/inc/tscLocalMerge.h
src/client/inc/tscLocalMerge.h
+4
-4
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+2
-2
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+2
-2
src/client/src/tscLocalMerge.c
src/client/src/tscLocalMerge.c
+170
-175
src/client/src/tscServer.c
src/client/src/tscServer.c
+1
-1
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+3
-3
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+10
-11
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+2
-2
src/util/inc/tarray.h
src/util/inc/tarray.h
+1
-1
src/util/src/tarray.c
src/util/src/tarray.c
+1
-1
未找到文件。
src/client/inc/tscLocalMerge.h
浏览文件 @
6402c2b0
...
...
@@ -38,7 +38,7 @@ typedef struct SLocalDataSource {
tFilePage
filePage
;
}
SLocalDataSource
;
typedef
struct
SLocal
Reduc
er
{
typedef
struct
SLocal
Merg
er
{
SLocalDataSource
**
pLocalDataSrc
;
int32_t
numOfBuffer
;
int32_t
numOfCompleted
;
...
...
@@ -62,7 +62,7 @@ typedef struct SLocalReducer {
bool
discard
;
int32_t
offset
;
// limit offset value
bool
orderPrjOnSTable
;
// projection query on stable
}
SLocal
Reduc
er
;
}
SLocal
Merg
er
;
typedef
struct
SRetrieveSupport
{
tExtMemBuffer
**
pExtMemBuffer
;
// for build loser tree
...
...
@@ -89,10 +89,10 @@ int32_t tscFlushTmpBuffer(tExtMemBuffer *pMemoryBuf, tOrderDescriptor *pDesc, tF
/*
* create local reducer to launch the second-stage reduce process at client site
*/
void
tscCreateLocal
Reduc
er
(
tExtMemBuffer
**
pMemBuffer
,
int32_t
numOfBuffer
,
tOrderDescriptor
*
pDesc
,
void
tscCreateLocal
Merg
er
(
tExtMemBuffer
**
pMemBuffer
,
int32_t
numOfBuffer
,
tOrderDescriptor
*
pDesc
,
SColumnModel
*
finalModel
,
SColumnModel
*
pFFModel
,
SSqlObj
*
pSql
);
void
tscDestroyLocal
Reduc
er
(
SSqlObj
*
pSql
);
void
tscDestroyLocal
Merg
er
(
SSqlObj
*
pSql
);
int32_t
tscDoLocalMerge
(
SSqlObj
*
pSql
);
...
...
src/client/inc/tscUtil.h
浏览文件 @
6402c2b0
...
...
@@ -225,7 +225,7 @@ void tscInitQueryInfo(SQueryInfo* pQueryInfo);
void
tscClearSubqueryInfo
(
SSqlCmd
*
pCmd
);
void
tscFreeVgroupTableInfo
(
SArray
*
pVgroupTables
);
SArray
*
tscVgroupTableInfo
Clone
(
SArray
*
pVgroupTables
);
SArray
*
tscVgroupTableInfo
Dup
(
SArray
*
pVgroupTables
);
void
tscRemoveVgroupTableGroup
(
SArray
*
pVgroupTable
,
int32_t
index
);
void
tscVgroupTableCopy
(
SVgroupTableInfo
*
info
,
SVgroupTableInfo
*
pInfo
);
...
...
@@ -292,7 +292,7 @@ uint32_t tscGetTableMetaSize(STableMeta* pTableMeta);
CChildTableMeta
*
tscCreateChildMeta
(
STableMeta
*
pTableMeta
);
uint32_t
tscGetTableMetaMaxSize
();
int32_t
tscCreateTableMetaFromCChildMeta
(
STableMeta
*
pChild
,
const
char
*
name
);
STableMeta
*
tscTableMeta
Clone
(
STableMeta
*
pTableMeta
);
STableMeta
*
tscTableMeta
Dup
(
STableMeta
*
pTableMeta
);
void
*
malloc_throw
(
size_t
size
);
...
...
src/client/inc/tsclient.h
浏览文件 @
6402c2b0
...
...
@@ -39,7 +39,7 @@ extern "C" {
// forward declaration
struct
SSqlInfo
;
struct
SLocal
Reduc
er
;
struct
SLocal
Merg
er
;
// data source from sql string or from file
enum
{
...
...
@@ -292,7 +292,7 @@ typedef struct {
SColumnIndex
*
pColumnIndex
;
SArithmeticSupport
*
pArithSup
;
// support the arithmetic expression calculation on agg functions
struct
SLocal
Reducer
*
pLocalReduc
er
;
struct
SLocal
Merger
*
pLocalMerg
er
;
}
SSqlRes
;
typedef
struct
STscObj
{
...
...
src/client/src/tscLocalMerge.c
浏览文件 @
6402c2b0
此差异已折叠。
点击以展开。
src/client/src/tscServer.c
浏览文件 @
6402c2b0
...
...
@@ -2444,7 +2444,7 @@ int tscGetSTableVgroupInfo(SSqlObj *pSql, int32_t clauseIndex) {
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
clauseIndex
);
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
STableMetaInfo
*
pMInfo
=
tscGetMetaInfo
(
pQueryInfo
,
i
);
STableMeta
*
pTableMeta
=
tscTableMeta
Clone
(
pMInfo
->
pTableMeta
);
STableMeta
*
pTableMeta
=
tscTableMeta
Dup
(
pMInfo
->
pTableMeta
);
tscAddTableMetaInfo
(
pNewQueryInfo
,
pMInfo
->
name
,
pTableMeta
,
NULL
,
pMInfo
->
tagColList
,
pMInfo
->
pVgroupTables
);
}
...
...
src/client/src/tscSubquery.c
浏览文件 @
6402c2b0
...
...
@@ -885,10 +885,10 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
tscBuildVgroupTableInfo
(
pParentSql
,
pTableMetaInfo2
,
s2
);
SSqlObj
*
psub1
=
pParentSql
->
pSubs
[
0
];
((
SJoinSupporter
*
)
psub1
->
param
)
->
pVgroupTables
=
tscVgroupTableInfo
Clone
(
pTableMetaInfo1
->
pVgroupTables
);
((
SJoinSupporter
*
)
psub1
->
param
)
->
pVgroupTables
=
tscVgroupTableInfo
Dup
(
pTableMetaInfo1
->
pVgroupTables
);
SSqlObj
*
psub2
=
pParentSql
->
pSubs
[
1
];
((
SJoinSupporter
*
)
psub2
->
param
)
->
pVgroupTables
=
tscVgroupTableInfo
Clone
(
pTableMetaInfo2
->
pVgroupTables
);
((
SJoinSupporter
*
)
psub2
->
param
)
->
pVgroupTables
=
tscVgroupTableInfo
Dup
(
pTableMetaInfo2
->
pVgroupTables
);
pParentSql
->
subState
.
numOfSub
=
2
;
pParentSql
->
subState
.
numOfRemain
=
pParentSql
->
subState
.
numOfSub
;
...
...
@@ -1998,7 +1998,7 @@ static void tscAllDataRetrievedFromDnode(SRetrieveSupport *trsupport, SSqlObj* p
SQueryInfo
*
pPQueryInfo
=
tscGetQueryInfoDetail
(
&
pParentSql
->
cmd
,
0
);
tscClearInterpInfo
(
pPQueryInfo
);
tscCreateLocal
Reduc
er
(
trsupport
->
pExtMemBuffer
,
pState
->
numOfSub
,
pDesc
,
trsupport
->
pFinalColModel
,
trsupport
->
pFFColModel
,
pParentSql
);
tscCreateLocal
Merg
er
(
trsupport
->
pExtMemBuffer
,
pState
->
numOfSub
,
pDesc
,
trsupport
->
pFinalColModel
,
trsupport
->
pFFColModel
,
pParentSql
);
tscDebug
(
"%p build loser tree completed"
,
pParentSql
);
pParentSql
->
res
.
precision
=
pSql
->
res
.
precision
;
...
...
src/client/src/tscUtil.c
浏览文件 @
6402c2b0
...
...
@@ -420,7 +420,7 @@ void tscResetSqlCmdObj(SSqlCmd* pCmd) {
}
void
tscFreeSqlResult
(
SSqlObj
*
pSql
)
{
tscDestroyLocal
Reduc
er
(
pSql
);
tscDestroyLocal
Merg
er
(
pSql
);
SSqlRes
*
pRes
=
&
pSql
->
res
;
tscDestroyResPointerInfo
(
pRes
);
...
...
@@ -612,7 +612,7 @@ int32_t tscCopyDataBlockToPayload(SSqlObj* pSql, STableDataBlocks* pDataBlock) {
tfree
(
pTableMetaInfo
->
pTableMeta
);
}
pTableMetaInfo
->
pTableMeta
=
tscTableMeta
Clone
(
pDataBlock
->
pTableMeta
);
pTableMetaInfo
->
pTableMeta
=
tscTableMeta
Dup
(
pDataBlock
->
pTableMeta
);
}
else
{
assert
(
strncmp
(
pTableMetaInfo
->
name
,
pDataBlock
->
tableName
,
tListLen
(
pDataBlock
->
tableName
))
==
0
);
}
...
...
@@ -680,7 +680,7 @@ int32_t tscCreateDataBlock(size_t initialSize, int32_t rowSize, int32_t startOff
tstrncpy
(
dataBuf
->
tableName
,
name
,
sizeof
(
dataBuf
->
tableName
));
//Here we keep the tableMeta to avoid it to be remove by other threads.
dataBuf
->
pTableMeta
=
tscTableMeta
Clone
(
pTableMeta
);
dataBuf
->
pTableMeta
=
tscTableMeta
Dup
(
pTableMeta
);
assert
(
initialSize
>
0
&&
pTableMeta
!=
NULL
&&
dataBuf
->
pTableMeta
!=
NULL
);
*
dataBlocks
=
dataBuf
;
...
...
@@ -1810,10 +1810,10 @@ void tscVgroupTableCopy(SVgroupTableInfo* info, SVgroupTableInfo* pInfo) {
info
->
vgInfo
.
epAddr
[
j
].
fqdn
=
strdup
(
pInfo
->
vgInfo
.
epAddr
[
j
].
fqdn
);
}
info
->
itemList
=
taosArray
Clone
(
pInfo
->
itemList
);
info
->
itemList
=
taosArray
Dup
(
pInfo
->
itemList
);
}
SArray
*
tscVgroupTableInfo
Clone
(
SArray
*
pVgroupTables
)
{
SArray
*
tscVgroupTableInfo
Dup
(
SArray
*
pVgroupTables
)
{
if
(
pVgroupTables
==
NULL
)
{
return
NULL
;
}
...
...
@@ -1881,7 +1881,7 @@ STableMetaInfo* tscAddTableMetaInfo(SQueryInfo* pQueryInfo, const char* name, ST
tscColumnListCopy
(
pTableMetaInfo
->
tagColList
,
pTagCols
,
-
1
);
}
pTableMetaInfo
->
pVgroupTables
=
tscVgroupTableInfo
Clone
(
pVgroupTables
);
pTableMetaInfo
->
pVgroupTables
=
tscVgroupTableInfo
Dup
(
pVgroupTables
);
pQueryInfo
->
numOfTables
+=
1
;
return
pTableMetaInfo
;
...
...
@@ -2064,7 +2064,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t
pNewQueryInfo
->
groupbyExpr
=
pQueryInfo
->
groupbyExpr
;
if
(
pQueryInfo
->
groupbyExpr
.
columnInfo
!=
NULL
)
{
pNewQueryInfo
->
groupbyExpr
.
columnInfo
=
taosArray
Clone
(
pQueryInfo
->
groupbyExpr
.
columnInfo
);
pNewQueryInfo
->
groupbyExpr
.
columnInfo
=
taosArray
Dup
(
pQueryInfo
->
groupbyExpr
.
columnInfo
);
if
(
pNewQueryInfo
->
groupbyExpr
.
columnInfo
==
NULL
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
goto
_error
;
...
...
@@ -2119,7 +2119,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t
STableMetaInfo
*
pFinalInfo
=
NULL
;
if
(
pPrevSql
==
NULL
)
{
STableMeta
*
pTableMeta
=
tscTableMeta
Clone
(
pTableMetaInfo
->
pTableMeta
);
STableMeta
*
pTableMeta
=
tscTableMeta
Dup
(
pTableMetaInfo
->
pTableMeta
);
assert
(
pTableMeta
!=
NULL
);
pFinalInfo
=
tscAddTableMetaInfo
(
pNewQueryInfo
,
name
,
pTableMeta
,
pTableMetaInfo
->
vgroupList
,
...
...
@@ -2127,7 +2127,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t
}
else
{
// transfer the ownership of pTableMeta to the newly create sql object.
STableMetaInfo
*
pPrevInfo
=
tscGetTableMetaInfoFromCmd
(
&
pPrevSql
->
cmd
,
pPrevSql
->
cmd
.
clauseIndex
,
0
);
STableMeta
*
pPrevTableMeta
=
tscTableMeta
Clone
(
pPrevInfo
->
pTableMeta
);
STableMeta
*
pPrevTableMeta
=
tscTableMeta
Dup
(
pPrevInfo
->
pTableMeta
);
SVgroupsInfo
*
pVgroupsInfo
=
pPrevInfo
->
vgroupList
;
pFinalInfo
=
tscAddTableMetaInfo
(
pNewQueryInfo
,
name
,
pPrevTableMeta
,
pVgroupsInfo
,
pTableMetaInfo
->
tagColList
,
pTableMetaInfo
->
pVgroupTables
);
...
...
@@ -2297,7 +2297,6 @@ int32_t tscSQLSyntaxErrMsg(char* msg, const char* additionalInfo, const char* s
}
return
TSDB_CODE_TSC_SQL_SYNTAX_ERROR
;
}
int32_t
tscInvalidSQLErrMsg
(
char
*
msg
,
const
char
*
additionalInfo
,
const
char
*
sql
)
{
...
...
@@ -2695,7 +2694,7 @@ uint32_t tscGetTableMetaMaxSize() {
return
sizeof
(
STableMeta
)
+
TSDB_MAX_COLUMNS
*
sizeof
(
SSchema
);
}
STableMeta
*
tscTableMeta
Clone
(
STableMeta
*
pTableMeta
)
{
STableMeta
*
tscTableMeta
Dup
(
STableMeta
*
pTableMeta
)
{
assert
(
pTableMeta
!=
NULL
);
uint32_t
size
=
tscGetTableMetaSize
(
pTableMeta
);
STableMeta
*
p
=
calloc
(
1
,
size
);
...
...
src/query/src/qExecutor.c
浏览文件 @
6402c2b0
...
...
@@ -5043,7 +5043,7 @@ static void sequentialTableProcess(SQInfo *pQInfo) {
STsdbQueryCond
cond
=
createTsdbQueryCond
(
pQuery
,
&
pQuery
->
window
);
SArray
*
g1
=
taosArrayInit
(
1
,
POINTER_BYTES
);
SArray
*
tx
=
taosArray
Clone
(
group
);
SArray
*
tx
=
taosArray
Dup
(
group
);
taosArrayPush
(
g1
,
&
tx
);
STableGroupInfo
gp
=
{.
numOfTables
=
taosArrayGetSize
(
tx
),
.
pGroupList
=
g1
};
...
...
@@ -5103,7 +5103,7 @@ static void sequentialTableProcess(SQInfo *pQInfo) {
STsdbQueryCond
cond
=
createTsdbQueryCond
(
pQuery
,
&
pQuery
->
window
);
SArray
*
g1
=
taosArrayInit
(
1
,
POINTER_BYTES
);
SArray
*
tx
=
taosArray
Clone
(
group
);
SArray
*
tx
=
taosArray
Dup
(
group
);
taosArrayPush
(
g1
,
&
tx
);
STableGroupInfo
gp
=
{.
numOfTables
=
taosArrayGetSize
(
tx
),
.
pGroupList
=
g1
};
...
...
src/util/inc/tarray.h
浏览文件 @
6402c2b0
...
...
@@ -110,7 +110,7 @@ void taosArrayCopy(SArray* pDst, const SArray* pSrc);
* clone a new array
* @param pSrc
*/
SArray
*
taosArray
Clone
(
const
SArray
*
pSrc
);
SArray
*
taosArray
Dup
(
const
SArray
*
pSrc
);
/**
* clear the array (remove all element)
...
...
src/util/src/tarray.c
浏览文件 @
6402c2b0
...
...
@@ -165,7 +165,7 @@ void taosArrayCopy(SArray* pDst, const SArray* pSrc) {
pDst
->
size
=
pSrc
->
size
;
}
SArray
*
taosArray
Clone
(
const
SArray
*
pSrc
)
{
SArray
*
taosArray
Dup
(
const
SArray
*
pSrc
)
{
assert
(
pSrc
!=
NULL
);
if
(
pSrc
->
size
==
0
)
{
// empty array list
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录