Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8213315f
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看板
未验证
提交
8213315f
编写于
4月 20, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
4月 20, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11643 from taosdata/feature/3.0_liaohj
fix(query): fix the crash caused by the complex having clause
上级
d73010fd
f25a72e5
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
19 addition
and
13 deletion
+19
-13
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+1
-0
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+14
-6
source/libs/executor/src/groupoperator.c
source/libs/executor/src/groupoperator.c
+1
-1
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+2
-2
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+1
-4
未找到文件。
source/libs/executor/inc/executorimpl.h
浏览文件 @
8213315f
...
...
@@ -490,6 +490,7 @@ typedef struct SGroupbyOperatorInfo {
SExprInfo
*
pScalarExprInfo
;
int32_t
numOfScalarExpr
;
// the number of scalar expression in group operator
SqlFunctionCtx
*
pScalarFuncCtx
;
int32_t
*
rowCellInfoOffset
;
// offset value for each row result cell info
}
SGroupbyOperatorInfo
;
typedef
struct
SDataGroupInfo
{
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
8213315f
...
...
@@ -1173,6 +1173,9 @@ void projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBlock*
setPseudoOutputColInfo
(
pResult
,
pCtx
,
pPseudoList
);
pResult
->
info
.
groupId
=
pSrcBlock
->
info
.
groupId
;
// if the source equals to the destination, it is to create a new column as the result of scalar function or some operators.
bool
createNewColModel
=
(
pResult
==
pSrcBlock
);
int32_t
numOfRows
=
0
;
for
(
int32_t
k
=
0
;
k
<
numOfOutput
;
++
k
)
{
...
...
@@ -1181,7 +1184,7 @@ void projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBlock*
if
(
pExpr
[
k
].
pExpr
->
nodeType
==
QUERY_NODE_COLUMN
)
{
// it is a project query
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pResult
->
pDataBlock
,
outputSlotId
);
if
(
pResult
->
info
.
rows
>
0
)
{
if
(
pResult
->
info
.
rows
>
0
&&
!
createNewColModel
)
{
colDataMergeCol
(
pColInfoData
,
pResult
->
info
.
rows
,
pfCtx
->
input
.
pData
[
0
],
pfCtx
->
input
.
numOfRows
);
}
else
{
colDataAssign
(
pColInfoData
,
pfCtx
->
input
.
pData
[
0
],
pfCtx
->
input
.
numOfRows
);
...
...
@@ -1191,7 +1194,7 @@ void projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBlock*
}
else
if
(
pExpr
[
k
].
pExpr
->
nodeType
==
QUERY_NODE_VALUE
)
{
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pResult
->
pDataBlock
,
outputSlotId
);
int32_t
offset
=
pResult
->
info
.
rows
;
int32_t
offset
=
createNewColModel
?
0
:
pResult
->
info
.
rows
;
for
(
int32_t
i
=
0
;
i
<
pSrcBlock
->
info
.
rows
;
++
i
)
{
colDataAppend
(
pColInfoData
,
i
+
offset
,
taosVariantGet
(
&
pExpr
[
k
].
base
.
pParam
[
0
].
param
,
pExpr
[
k
].
base
.
pParam
[
0
].
param
.
nType
),
TSDB_DATA_TYPE_NULL
==
pExpr
[
k
].
base
.
pParam
[
0
].
param
.
nType
);
}
...
...
@@ -1207,7 +1210,8 @@ void projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBlock*
SScalarParam
dest
=
{.
columnData
=
&
idata
};
scalarCalculate
(
pExpr
[
k
].
pExpr
->
_optrRoot
.
pRootNode
,
pBlockList
,
&
dest
);
colDataMergeCol
(
pResColData
,
pResult
->
info
.
rows
,
&
idata
,
dest
.
numOfRows
);
int32_t
startOffset
=
createNewColModel
?
0
:
pResult
->
info
.
rows
;
colDataMergeCol
(
pResColData
,
startOffset
,
&
idata
,
dest
.
numOfRows
);
numOfRows
=
dest
.
numOfRows
;
taosArrayDestroy
(
pBlockList
);
...
...
@@ -1224,7 +1228,7 @@ void projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBlock*
pfCtx
->
fpSet
.
init
(
&
pCtx
[
k
],
pResInfo
);
pfCtx
->
pOutput
=
taosArrayGet
(
pResult
->
pDataBlock
,
outputSlotId
);
pfCtx
->
offset
=
pResult
->
info
.
rows
;
// set the start offset
pfCtx
->
offset
=
createNewColModel
?
0
:
pResult
->
info
.
rows
;
// set the start offset
// set the timestamp(_rowts) output buffer
if
(
taosArrayGetSize
(
pPseudoList
)
>
0
)
{
...
...
@@ -1242,7 +1246,9 @@ void projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBlock*
SScalarParam
dest
=
{.
columnData
=
&
idata
};
scalarCalculate
((
SNode
*
)
pExpr
[
k
].
pExpr
->
_function
.
pFunctNode
,
pBlockList
,
&
dest
);
colDataMergeCol
(
pResColData
,
pResult
->
info
.
rows
,
&
idata
,
dest
.
numOfRows
);
int32_t
startOffset
=
createNewColModel
?
0
:
pResult
->
info
.
rows
;
colDataMergeCol
(
pResColData
,
startOffset
,
&
idata
,
dest
.
numOfRows
);
numOfRows
=
dest
.
numOfRows
;
taosArrayDestroy
(
pBlockList
);
...
...
@@ -1252,7 +1258,9 @@ void projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBlock*
}
}
pResult
->
info
.
rows
+=
numOfRows
;
if
(
!
createNewColModel
)
{
pResult
->
info
.
rows
+=
numOfRows
;
}
}
void
doTimeWindowInterpolation
(
SOperatorInfo
*
pOperator
,
SOptrBasicInfo
*
pInfo
,
SArray
*
pDataBlock
,
TSKEY
prevTs
,
...
...
source/libs/executor/src/groupoperator.c
浏览文件 @
8213315f
...
...
@@ -341,7 +341,7 @@ SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SExprInfo* pEx
pInfo
->
pScalarExprInfo
=
pScalarExprInfo
;
pInfo
->
numOfScalarExpr
=
numOfScalarExpr
;
pInfo
->
pScalarFuncCtx
=
createSqlFunctionCtx
(
pExprInfo
,
numOfCols
,
&
pInfo
->
binfo
.
rowCellInfoOffset
);
pInfo
->
pScalarFuncCtx
=
createSqlFunctionCtx
(
pScalarExprInfo
,
numOfScalarExpr
,
&
pInfo
->
rowCellInfoOffset
);
int32_t
code
=
initGroupOptrInfo
(
&
pInfo
->
pGroupColVals
,
&
pInfo
->
groupKeyLen
,
&
pInfo
->
keyBuf
,
pGroupColList
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
8213315f
...
...
@@ -901,7 +901,7 @@ int32_t lastFunction(SqlFunctionCtx *pCtx) {
char
*
data
=
colDataGetData
(
pInputCol
,
i
);
TSKEY
cts
=
getRowPTs
(
pInput
->
pPTS
,
i
);
if
(
pResInfo
->
numOfRes
==
0
||
*
(
TSKEY
*
)(
buf
+
bytes
)
>
cts
)
{
if
(
pResInfo
->
numOfRes
==
0
||
*
(
TSKEY
*
)(
buf
+
bytes
)
<
cts
)
{
memcpy
(
buf
,
data
,
bytes
);
*
(
TSKEY
*
)(
buf
+
bytes
)
=
cts
;
// DO_UPDATE_TAG_COLUMNS(pCtx, ts);
...
...
@@ -919,7 +919,7 @@ int32_t lastFunction(SqlFunctionCtx *pCtx) {
char
*
data
=
colDataGetData
(
pInputCol
,
i
);
TSKEY
cts
=
getRowPTs
(
pInput
->
pPTS
,
i
);
if
(
pResInfo
->
numOfRes
==
0
||
*
(
TSKEY
*
)(
buf
+
bytes
)
>
cts
)
{
if
(
pResInfo
->
numOfRes
==
0
||
*
(
TSKEY
*
)(
buf
+
bytes
)
<
cts
)
{
memcpy
(
buf
,
data
,
bytes
);
*
(
TSKEY
*
)(
buf
+
bytes
)
=
cts
;
pResInfo
->
numOfRes
=
1
;
...
...
source/libs/parser/src/parInsert.c
浏览文件 @
8213315f
...
...
@@ -888,10 +888,7 @@ static int parseOneRow(SInsertParseContext* pCxt, STableDataBlocks* pDataBlocks,
if
(
PRIMARYKEY_TIMESTAMP_COL_ID
==
pSchema
->
colId
)
{
TSKEY
tsKey
=
TD_ROW_KEY
(
row
);
if
(
checkTimestamp
(
pDataBlocks
,
(
const
char
*
)
&
tsKey
)
!=
TSDB_CODE_SUCCESS
)
{
buildSyntaxErrMsg
(
&
pCxt
->
msg
,
"client time/server time can not be mixed up"
,
sToken
.
z
);
return
TSDB_CODE_TSC_INVALID_TIME_STAMP
;
}
checkTimestamp
(
pDataBlocks
,
(
const
char
*
)
&
tsKey
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录