Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
035eb6c7
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看板
未验证
提交
035eb6c7
编写于
8月 08, 2022
作者:
S
shenglian-zhou
提交者:
GitHub
8月 08, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #15840 from taosdata/szhou/fix/leave
fix: ensure capacity before join left and right
上级
0a84910b
aa81107a
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
25 addition
and
16 deletion
+25
-16
include/common/ttypes.h
include/common/ttypes.h
+0
-2
include/libs/function/function.h
include/libs/function/function.h
+1
-1
source/libs/executor/src/joinoperator.c
source/libs/executor/src/joinoperator.c
+15
-9
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+8
-3
source/libs/qcom/src/queryUtil.c
source/libs/qcom/src/queryUtil.c
+1
-1
未找到文件。
include/common/ttypes.h
浏览文件 @
035eb6c7
...
...
@@ -354,8 +354,6 @@ void operateVal(void *dst, void *s1, void *s2, int32_t optr, int32_t type);
void
*
getDataMin
(
int32_t
type
);
void
*
getDataMax
(
int32_t
type
);
#define SET_DOUBLE_NULL(v) (*(uint64_t *)(v) = TSDB_DATA_DOUBLE_NULL)
#define SET_BIGINT_NULL(v) (*(uint64_t *)(v) = TSDB_DATA_BIGINT_NULL)
#ifdef __cplusplus
}
...
...
include/libs/function/function.h
浏览文件 @
035eb6c7
...
...
@@ -67,7 +67,7 @@ typedef struct SResultRowEntryInfo {
bool
initialized
:
1
;
// output buffer has been initialized
bool
complete
:
1
;
// query has completed
uint8_t
isNullRes
:
6
;
// the result is null
uint16_t
numOfRes
;
// num of output result in current buffer
uint16_t
numOfRes
;
// num of output result in current buffer
. NOT NULL RESULT
}
SResultRowEntryInfo
;
// determine the real data need to calculated the result
...
...
source/libs/executor/src/joinoperator.c
浏览文件 @
035eb6c7
...
...
@@ -256,7 +256,7 @@ static int32_t mergeJoinJoinDownstreamTsRanges(SOperatorInfo* pOperator, int64_t
SArray
*
rightRowLocations
=
taosArrayInit
(
8
,
sizeof
(
SRowLocation
));
SArray
*
rightCreatedBlocks
=
taosArrayInit
(
8
,
POINTER_BYTES
);
int32_t
code
=
TSDB_CODE_SUCCESS
;
mergeJoinGetDownStreamRowsEqualTimeStamp
(
pOperator
,
0
,
pJoinInfo
->
leftCol
.
slotId
,
pJoinInfo
->
pLeft
,
pJoinInfo
->
leftPos
,
timestamp
,
leftRowLocations
,
leftCreatedBlocks
);
mergeJoinGetDownStreamRowsEqualTimeStamp
(
pOperator
,
1
,
pJoinInfo
->
rightCol
.
slotId
,
pJoinInfo
->
pRight
,
...
...
@@ -264,15 +264,21 @@ static int32_t mergeJoinJoinDownstreamTsRanges(SOperatorInfo* pOperator, int64_t
size_t
leftNumJoin
=
taosArrayGetSize
(
leftRowLocations
);
size_t
rightNumJoin
=
taosArrayGetSize
(
rightRowLocations
);
code
=
blockDataEnsureCapacity
(
pRes
,
*
nRows
+
leftNumJoin
*
rightNumJoin
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"%s can not ensure block capacity for join. left: %zu, right: %zu"
,
GET_TASKID
(
pOperator
->
pTaskInfo
),
leftNumJoin
,
rightNumJoin
);
}
if
(
code
==
TSDB_CODE_SUCCESS
)
{
for
(
int32_t
i
=
0
;
i
<
leftNumJoin
;
++
i
)
{
for
(
int32_t
j
=
0
;
j
<
rightNumJoin
;
++
j
)
{
SRowLocation
*
leftRow
=
taosArrayGet
(
leftRowLocations
,
i
);
SRowLocation
*
rightRow
=
taosArrayGet
(
rightRowLocations
,
j
);
SRowLocation
*
leftRow
=
taosArrayGet
(
leftRowLocations
,
i
);
SRowLocation
*
rightRow
=
taosArrayGet
(
rightRowLocations
,
j
);
mergeJoinJoinLeftRight
(
pOperator
,
pRes
,
*
nRows
,
leftRow
->
pDataBlock
,
leftRow
->
pos
,
rightRow
->
pDataBlock
,
rightRow
->
pos
);
++*
nRows
;
}
}
}
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
rightCreatedBlocks
);
++
i
)
{
SSDataBlock
*
pBlock
=
taosArrayGetP
(
rightCreatedBlocks
,
i
);
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
035eb6c7
...
...
@@ -3845,14 +3845,17 @@ int32_t spreadFunctionMerge(SqlFunctionCtx* pCtx) {
SSpreadInfo
*
pInfo
=
GET_ROWCELL_INTERBUF
(
GET_RES_INFO
(
pCtx
));
int32_t
start
=
pInput
->
startRowIndex
;
for
(
int32_t
i
=
start
;
i
<
start
+
pInput
->
numOfRows
;
++
i
)
{
char
*
data
=
colDataGetData
(
pCol
,
i
);
SSpreadInfo
*
pInputInfo
=
(
SSpreadInfo
*
)
varDataVal
(
data
);
if
(
pInputInfo
->
hasResult
)
{
spreadTransferInfo
(
pInputInfo
,
pInfo
);
}
}
SET_VAL
(
GET_RES_INFO
(
pCtx
),
1
,
1
);
if
(
pInfo
->
hasResult
)
{
GET_RES_INFO
(
pCtx
)
->
numOfRes
=
1
;
}
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -3861,6 +3864,8 @@ int32_t spreadFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
SSpreadInfo
*
pInfo
=
GET_ROWCELL_INTERBUF
(
GET_RES_INFO
(
pCtx
));
if
(
pInfo
->
hasResult
==
true
)
{
SET_DOUBLE_VAL
(
&
pInfo
->
result
,
pInfo
->
max
-
pInfo
->
min
);
}
else
{
GET_RES_INFO
(
pCtx
)
->
isNullRes
=
1
;
}
return
functionFinalize
(
pCtx
,
pBlock
);
}
...
...
source/libs/qcom/src/queryUtil.c
浏览文件 @
035eb6c7
...
...
@@ -415,7 +415,7 @@ int32_t cloneTableMeta(STableMeta* pSrc, STableMeta** pDst) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
metaSize
=
(
pSrc
->
tableInfo
.
numOfColumns
+
pSrc
->
tableInfo
.
numOfTags
)
*
sizeof
(
SSchema
);
int32_t
metaSize
=
sizeof
(
STableMeta
)
+
(
pSrc
->
tableInfo
.
numOfColumns
+
pSrc
->
tableInfo
.
numOfTags
)
*
sizeof
(
SSchema
);
*
pDst
=
taosMemoryMalloc
(
metaSize
);
if
(
NULL
==
*
pDst
)
{
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录