Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5ec984c0
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看板
提交
5ec984c0
编写于
7月 01, 2021
作者:
Y
yihaoDeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-4947]<fix> handle mixed group by with top/bottom corrupt
上级
f7c6347c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
27 addition
and
4 deletion
+27
-4
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+13
-2
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+13
-2
tests/script/fullGeneralSuite.sim
tests/script/fullGeneralSuite.sim
+1
-0
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
5ec984c0
...
...
@@ -5283,12 +5283,23 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
assert
(
pExpr
->
base
.
functionId
==
TSDB_FUNC_TS
);
pExpr
=
tscExprGet
(
pQueryInfo
,
1
);
if
(
pExpr
->
base
.
colInfo
.
colIndex
!=
index
.
columnIndex
&&
index
.
columnIndex
!=
PRIMARYKEY_TIMESTAMP_COL_INDEX
)
{
//if (pExpr->base.colInfo.colIndex != index.columnIndex && index.columnIndex != PRIMARYKEY_TIMESTAMP_COL_INDEX) {
// return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
//}
bool
validOrder
=
false
;
SArray
*
columnInfo
=
pQueryInfo
->
groupbyExpr
.
columnInfo
;
if
(
columnInfo
!=
NULL
&&
taosArrayGetSize
(
columnInfo
)
>
0
)
{
SColIndex
*
pColIndex
=
taosArrayGet
(
columnInfo
,
0
);
validOrder
=
(
pColIndex
->
colIndex
==
index
.
columnIndex
);
}
if
(
!
validOrder
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
}
tVariantListItem
*
pItem
=
taosArrayGet
(
pSqlNode
->
pSortOrder
,
0
);
pQueryInfo
->
order
.
order
=
pItem
->
sortOrder
;
pQueryInfo
->
order
.
orderColId
=
pSchema
[
index
.
columnIndex
].
colId
;
return
TSDB_CODE_SUCCESS
;
}
...
...
src/query/src/qExecutor.c
浏览文件 @
5ec984c0
...
...
@@ -240,6 +240,8 @@ static void sortGroupResByOrderList(SGroupResInfo *pGroupResInfo, SQueryRuntimeE
if
(
taosArrayGetSize
(
columnOrderList
)
<=
0
)
{
return
;
}
taosArrayDestroy
(
columnOrderList
);
int32_t
orderId
=
pRuntimeEnv
->
pQueryAttr
->
order
.
orderColId
;
if
(
orderId
<=
0
)
{
return
;
...
...
@@ -1740,8 +1742,7 @@ static SQLFunctionCtx* createSQLFunctionCtx(SQueryRuntimeEnv* pRuntimeEnv, SExpr
}
for
(
int32_t
i
=
1
;
i
<
numOfOutput
;
++
i
)
{
(
*
rowCellInfoOffset
)[
i
]
=
(
int32_t
)((
*
rowCellInfoOffset
)[
i
-
1
]
+
sizeof
(
SResultRowCellInfo
)
+
pExpr
[
i
-
1
].
base
.
interBytes
*
GET_ROW_PARAM_FOR_MULTIOUTPUT
(
pQueryAttr
,
pQueryAttr
->
topBotQuery
,
pQueryAttr
->
stableQuery
));
(
*
rowCellInfoOffset
)[
i
]
=
(
int32_t
)((
*
rowCellInfoOffset
)[
i
-
1
]
+
sizeof
(
SResultRowCellInfo
)
+
pExpr
[
i
-
1
].
base
.
interBytes
);
}
setCtxTagColumnInfo
(
pFuncCtx
,
numOfOutput
);
...
...
@@ -3713,6 +3714,9 @@ static int32_t doCopyToSDataBlock(SQueryRuntimeEnv* pRuntimeEnv, SGroupResInfo*
}
int32_t
numOfRowsToCopy
=
pRow
->
numOfRows
;
if
(
numOfResult
+
numOfRowsToCopy
>=
pRuntimeEnv
->
resultInfo
.
capacity
)
{
break
;
}
pGroupResInfo
->
index
+=
1
;
...
...
@@ -6100,7 +6104,14 @@ SOperatorInfo* createGroupbyOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperato
SGroupbyOperatorInfo
*
pInfo
=
calloc
(
1
,
sizeof
(
SGroupbyOperatorInfo
));
pInfo
->
colIndex
=
-
1
;
// group by column index
pInfo
->
binfo
.
pCtx
=
createSQLFunctionCtx
(
pRuntimeEnv
,
pExpr
,
numOfOutput
,
&
pInfo
->
binfo
.
rowCellInfoOffset
);
SQueryAttr
*
pQueryAttr
=
pRuntimeEnv
->
pQueryAttr
;
pQueryAttr
->
resultRowSize
=
(
pQueryAttr
->
resultRowSize
*
GET_ROW_PARAM_FOR_MULTIOUTPUT
(
pQueryAttr
,
pQueryAttr
->
topBotQuery
,
pQueryAttr
->
stableQuery
));
pInfo
->
binfo
.
pRes
=
createOutputBuf
(
pExpr
,
numOfOutput
,
pRuntimeEnv
->
resultInfo
.
capacity
);
initResultRowInfo
(
&
pInfo
->
binfo
.
resultRowInfo
,
8
,
TSDB_DATA_TYPE_INT
);
...
...
tests/script/fullGeneralSuite.sim
浏览文件 @
5ec984c0
...
...
@@ -131,6 +131,7 @@ run general/parser/join.sim
run general/parser/join_multivnode.sim
run general/parser/select_with_tags.sim
run general/parser/groupby.sim
run general/parser/top_groupby.sim
run general/parser/tags_dynamically_specifiy.sim
run general/parser/set_tag_vals.sim
#unsupport run general/parser/repeatAlter.sim
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录