Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
aa4276cf
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
提交
aa4276cf
编写于
5月 01, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/3.0' into feature/3.0_wxy
上级
3b4f9b91
7cecc341
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
41 addition
and
40 deletion
+41
-40
include/common/tcommon.h
include/common/tcommon.h
+1
-1
include/common/tdatablock.h
include/common/tdatablock.h
+1
-1
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+36
-34
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+3
-4
未找到文件。
include/common/tcommon.h
浏览文件 @
aa4276cf
...
...
@@ -70,7 +70,7 @@ typedef struct SDataBlockInfo {
uint64_t
groupId
;
// no need to serialize
int16_t
numOfCols
;
int16_t
hasVarCol
;
int
16
_t
capacity
;
int
32
_t
capacity
;
}
SDataBlockInfo
;
typedef
struct
SSDataBlock
{
...
...
include/common/tdatablock.h
浏览文件 @
aa4276cf
...
...
@@ -183,7 +183,7 @@ static FORCE_INLINE void colDataAppendDouble(SColumnInfoData* pColumnInfoData, u
}
int32_t
colDataAppend
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
const
char
*
pData
,
bool
isNull
);
int32_t
colDataMergeCol
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
numOfRow1
,
const
SColumnInfoData
*
pSource
,
int32_t
colDataMergeCol
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
numOfRow1
,
int32_t
*
capacity
,
const
SColumnInfoData
*
pSource
,
uint32_t
numOfRow2
);
int32_t
colDataAssign
(
SColumnInfoData
*
pColumnInfoData
,
const
SColumnInfoData
*
pSource
,
int32_t
numOfRows
);
int32_t
blockDataUpdateTsWindow
(
SSDataBlock
*
pDataBlock
);
...
...
source/common/src/tdatablock.c
浏览文件 @
aa4276cf
...
...
@@ -168,13 +168,6 @@ static void doBitmapMerge(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, c
uint32_t
total
=
numOfRow1
+
numOfRow2
;
if
(
BitmapLen
(
numOfRow1
)
<
BitmapLen
(
total
))
{
char
*
tmp
=
taosMemoryRealloc
(
pColumnInfoData
->
nullbitmap
,
BitmapLen
(
total
));
uint32_t
extend
=
BitmapLen
(
total
)
-
BitmapLen
(
numOfRow1
);
memset
(
tmp
+
BitmapLen
(
numOfRow1
),
0
,
extend
);
pColumnInfoData
->
nullbitmap
=
tmp
;
}
uint32_t
remindBits
=
BitPos
(
numOfRow1
);
uint32_t
shiftBits
=
8
-
remindBits
;
...
...
@@ -209,10 +202,9 @@ static void doBitmapMerge(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, c
}
}
int32_t
colDataMergeCol
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
numOfRow1
,
const
SColumnInfoData
*
pSource
,
uint32_t
numOfRow2
)
{
int32_t
colDataMergeCol
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
numOfRow1
,
int32_t
*
capacity
,
const
SColumnInfoData
*
pSource
,
uint32_t
numOfRow2
)
{
ASSERT
(
pColumnInfoData
!=
NULL
&&
pSource
!=
NULL
&&
pColumnInfoData
->
info
.
type
==
pSource
->
info
.
type
);
if
(
numOfRow2
==
0
)
{
return
numOfRow1
;
}
...
...
@@ -221,14 +213,19 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, uint32_t numOfRow1, co
pColumnInfoData
->
hasNull
=
pSource
->
hasNull
;
}
uint32_t
finalNumOfRows
=
numOfRow1
+
numOfRow2
;
if
(
IS_VAR_DATA_TYPE
(
pColumnInfoData
->
info
.
type
))
{
// Handle the bitmap
char
*
p
=
taosMemoryRealloc
(
pColumnInfoData
->
varmeta
.
offset
,
sizeof
(
int32_t
)
*
(
numOfRow1
+
numOfRow2
));
if
(
p
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
if
(
finalNumOfRows
>
*
capacity
)
{
char
*
p
=
taosMemoryRealloc
(
pColumnInfoData
->
varmeta
.
offset
,
sizeof
(
int32_t
)
*
(
numOfRow1
+
numOfRow2
));
if
(
p
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
*
capacity
=
finalNumOfRows
;
pColumnInfoData
->
varmeta
.
offset
=
(
int32_t
*
)
p
;
}
pColumnInfoData
->
varmeta
.
offset
=
(
int32_t
*
)
p
;
for
(
int32_t
i
=
0
;
i
<
numOfRow2
;
++
i
)
{
if
(
pSource
->
varmeta
.
offset
[
i
]
==
-
1
)
{
pColumnInfoData
->
varmeta
.
offset
[
i
+
numOfRow1
]
=
-
1
;
...
...
@@ -253,15 +250,27 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, uint32_t numOfRow1, co
memcpy
(
pColumnInfoData
->
pData
+
oldLen
,
pSource
->
pData
,
len
);
pColumnInfoData
->
varmeta
.
length
=
len
+
oldLen
;
}
else
{
doBitmapMerge
(
pColumnInfoData
,
numOfRow1
,
pSource
,
numOfRow2
);
if
(
finalNumOfRows
>
*
capacity
)
{
char
*
tmp
=
taosMemoryRealloc
(
pColumnInfoData
->
pData
,
finalNumOfRows
*
pColumnInfoData
->
info
.
bytes
);
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_VND_OUT_OF_MEMORY
;
}
int32_t
newSize
=
(
numOfRow1
+
numOfRow2
)
*
pColumnInfoData
->
info
.
bytes
;
char
*
tmp
=
taosMemoryRealloc
(
pColumnInfoData
->
pData
,
newSize
);
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_VND_OUT_OF_MEMORY
;
pColumnInfoData
->
pData
=
tmp
;
if
(
BitmapLen
(
numOfRow1
)
<
BitmapLen
(
finalNumOfRows
))
{
char
*
btmp
=
taosMemoryRealloc
(
pColumnInfoData
->
nullbitmap
,
BitmapLen
(
finalNumOfRows
));
uint32_t
extend
=
BitmapLen
(
finalNumOfRows
)
-
BitmapLen
(
numOfRow1
);
memset
(
btmp
+
BitmapLen
(
numOfRow1
),
0
,
extend
);
pColumnInfoData
->
nullbitmap
=
btmp
;
}
*
capacity
=
finalNumOfRows
;
}
pColumnInfoData
->
pData
=
tmp
;
doBitmapMerge
(
pColumnInfoData
,
numOfRow1
,
pSource
,
numOfRow2
);
int32_t
offset
=
pColumnInfoData
->
info
.
bytes
*
numOfRow1
;
memcpy
(
pColumnInfoData
->
pData
+
offset
,
pSource
->
pData
,
pSource
->
info
.
bytes
*
numOfRow2
);
}
...
...
@@ -350,29 +359,22 @@ int32_t blockDataUpdateTsWindow(SSDataBlock* pDataBlock) {
// if pIndexMap = NULL, merger one column by on column
int32_t
blockDataMerge
(
SSDataBlock
*
pDest
,
const
SSDataBlock
*
pSrc
,
SArray
*
pIndexMap
)
{
assert
(
pSrc
!=
NULL
&&
pDest
!=
NULL
);
int32_t
capacity
=
pDest
->
info
.
capacity
;
int32_t
numOfCols
=
pDest
->
info
.
numOfCols
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pDest
->
info
.
numOfCols
;
++
i
)
{
int32_t
mapIndex
=
i
;
if
(
pIndexMap
)
{
if
(
pIndexMap
)
{
mapIndex
=
*
(
int32_t
*
)
taosArrayGet
(
pIndexMap
,
i
);
}
SColumnInfoData
*
pCol2
=
taosArrayGet
(
pDest
->
pDataBlock
,
i
);
SColumnInfoData
*
pCol1
=
taosArrayGet
(
pSrc
->
pDataBlock
,
mapIndex
);
uint32_t
oldLen
=
colDataGetLength
(
pCol2
,
pDest
->
info
.
rows
);
uint32_t
newLen
=
colDataGetLength
(
pCol1
,
pSrc
->
info
.
rows
);
int32_t
newSize
=
oldLen
+
newLen
;
char
*
tmp
=
taosMemoryRealloc
(
pCol2
->
pData
,
newSize
);
if
(
tmp
!=
NULL
)
{
pCol2
->
pData
=
tmp
;
colDataMergeCol
(
pCol2
,
pDest
->
info
.
rows
,
pCol1
,
pSrc
->
info
.
rows
);
}
else
{
return
TSDB_CODE_VND_OUT_OF_MEMORY
;
}
capacity
=
pDest
->
info
.
capacity
;
colDataMergeCol
(
pCol2
,
pDest
->
info
.
rows
,
&
capacity
,
pCol1
,
pSrc
->
info
.
rows
);
}
pDest
->
info
.
capacity
=
capacity
;
pDest
->
info
.
rows
+=
pSrc
->
info
.
rows
;
return
TSDB_CODE_SUCCESS
;
}
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
aa4276cf
...
...
@@ -1197,7 +1197,7 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc
if
(
pExpr
[
k
].
pExpr
->
nodeType
==
QUERY_NODE_COLUMN
)
{
// it is a project query
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pResult
->
pDataBlock
,
outputSlotId
);
if
(
pResult
->
info
.
rows
>
0
&&
!
createNewColModel
)
{
colDataMergeCol
(
pColInfoData
,
pResult
->
info
.
rows
,
pfCtx
->
input
.
pData
[
0
],
pfCtx
->
input
.
numOfRows
);
colDataMergeCol
(
pColInfoData
,
pResult
->
info
.
rows
,
&
pResult
->
info
.
capacity
,
pfCtx
->
input
.
pData
[
0
],
pfCtx
->
input
.
numOfRows
);
}
else
{
colDataAssign
(
pColInfoData
,
pfCtx
->
input
.
pData
[
0
],
pfCtx
->
input
.
numOfRows
);
}
...
...
@@ -1225,7 +1225,7 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc
scalarCalculate
(
pExpr
[
k
].
pExpr
->
_optrRoot
.
pRootNode
,
pBlockList
,
&
dest
);
int32_t
startOffset
=
createNewColModel
?
0
:
pResult
->
info
.
rows
;
colDataMergeCol
(
pResColData
,
startOffset
,
&
idata
,
dest
.
numOfRows
);
colDataMergeCol
(
pResColData
,
startOffset
,
&
pResult
->
info
.
capacity
,
&
idata
,
dest
.
numOfRows
);
numOfRows
=
dest
.
numOfRows
;
taosArrayDestroy
(
pBlockList
);
...
...
@@ -1266,7 +1266,7 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc
}
int32_t
startOffset
=
createNewColModel
?
0
:
pResult
->
info
.
rows
;
colDataMergeCol
(
pResColData
,
startOffset
,
&
idata
,
dest
.
numOfRows
);
colDataMergeCol
(
pResColData
,
startOffset
,
&
pResult
->
info
.
capacity
,
&
idata
,
dest
.
numOfRows
);
numOfRows
=
dest
.
numOfRows
;
taosArrayDestroy
(
pBlockList
);
...
...
@@ -7168,7 +7168,6 @@ int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SExplainExecInfo
static
SSDataBlock
*
doMergeJoin
(
struct
SOperatorInfo
*
pOperator
,
bool
*
newgroup
)
{
SJoinOperatorInfo
*
pJoinInfo
=
pOperator
->
info
;
// SOptrBasicInfo* pInfo = &pJoinInfo->binfo;
SSDataBlock
*
pRes
=
pJoinInfo
->
pRes
;
blockDataCleanup
(
pRes
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录