Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
556ab494
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看板
未验证
提交
556ab494
编写于
11月 17, 2021
作者:
X
xiao-yu-wang
提交者:
GitHub
11月 17, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #8626 from taosdata/fix/TD-10776-dev
[TD-10776]<fix>: fixed FILL and GROUP BY ORDER BY bug.
上级
afa34a55
aab09d31
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
19 deletion
+36
-19
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+1
-1
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+20
-13
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+15
-5
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
556ab494
...
...
@@ -5421,7 +5421,7 @@ int32_t validateWhereNode(SQueryInfo* pQueryInfo, tSqlExpr** pExpr, SSqlObj* pSq
if
(
taosArrayGetSize
(
pQueryInfo
->
pUpstream
)
>
0
&&
condExpr
.
pTimewindow
!=
NULL
)
{
setNormalExprToCond
(
&
condExpr
.
pColumnCond
,
condExpr
.
pTimewindow
,
TK_AND
);
condExpr
.
pTimewindow
=
NULL
;
condExpr
.
pTimewindow
=
tSqlExprClone
(
condExpr
.
pTimewindow
)
;
}
tSqlExprCompact
(
pExpr
);
...
...
src/client/src/tscUtil.c
浏览文件 @
556ab494
...
...
@@ -942,23 +942,30 @@ SSDataBlock* doGetDataBlock(void* param, bool* newgroup) {
pBlock
->
info
.
rows
=
pRes
->
numOfRows
;
if
(
pRes
->
numOfRows
!=
0
)
{
doSetupSDataBlock
(
pRes
,
pBlock
,
pInput
->
pFilterInfo
);
*
newgroup
=
false
;
return
pBlock
;
if
(
pBlock
->
info
.
rows
>
0
)
{
*
newgroup
=
false
;
return
pBlock
;
}
}
// No data block exists. So retrieve and transfer it into to SSDataBlock
TAOS_ROW
pRow
=
NULL
;
taos_fetch_block
(
pSql
,
&
pRow
);
SSDataBlock
*
result
=
NULL
;
do
{
// No data block exists. So retrieve and transfer it into to SSDataBlock
TAOS_ROW
pRow
=
NULL
;
taos_fetch_block
(
pSql
,
&
pRow
);
if
(
pRes
->
numOfRows
==
0
)
{
pOperator
->
status
=
OP_EXEC_DONE
;
return
NULL
;
}
if
(
pRes
->
numOfRows
==
0
)
{
pOperator
->
status
=
OP_EXEC_DONE
;
result
=
NULL
;
break
;
}
pBlock
->
info
.
rows
=
pRes
->
numOfRows
;
doSetupSDataBlock
(
pRes
,
pBlock
,
pInput
->
pFilterInfo
);
*
newgroup
=
false
;
result
=
pBlock
;
}
while
(
result
->
info
.
rows
==
0
);
pBlock
->
info
.
rows
=
pRes
->
numOfRows
;
doSetupSDataBlock
(
pRes
,
pBlock
,
pInput
->
pFilterInfo
);
*
newgroup
=
false
;
return
pBlock
;
return
result
;
}
static
void
fetchNextBlockIfCompleted
(
SOperatorInfo
*
pOperator
,
bool
*
newgroup
)
{
...
...
src/query/src/qExecutor.c
浏览文件 @
556ab494
...
...
@@ -277,7 +277,7 @@ static int compareRowData(const void *a, const void *b, const void *userData) {
return
(
in1
!=
NULL
&&
in2
!=
NULL
)
?
supporter
->
comFunc
(
in1
,
in2
)
:
0
;
}
static
void
sortGroupResByOrderList
(
SGroupResInfo
*
pGroupResInfo
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
SSDataBlock
*
pDataBlock
)
{
static
void
sortGroupResByOrderList
(
SGroupResInfo
*
pGroupResInfo
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
SSDataBlock
*
pDataBlock
,
SQLFunctionCtx
*
pCtx
)
{
SArray
*
columnOrderList
=
getOrderCheckColumns
(
pRuntimeEnv
->
pQueryAttr
);
size_t
size
=
taosArrayGetSize
(
columnOrderList
);
taosArrayDestroy
(
columnOrderList
);
...
...
@@ -291,12 +291,23 @@ static void sortGroupResByOrderList(SGroupResInfo *pGroupResInfo, SQueryRuntimeE
return
;
}
int32_t
orderIndex
=
-
1
;
for
(
int32_t
j
=
0
;
j
<
pDataBlock
->
info
.
numOfCols
;
++
j
)
{
if
(
pCtx
[
j
].
colId
==
orderId
)
{
orderIndex
=
j
;
break
;
}
}
if
(
orderIndex
<
0
)
{
return
;
}
bool
found
=
false
;
int16_t
dataOffset
=
0
;
for
(
int32_t
j
=
0
;
j
<
pDataBlock
->
info
.
numOfCols
;
++
j
)
{
SColumnInfoData
*
pColInfoData
=
(
SColumnInfoData
*
)
taosArrayGet
(
pDataBlock
->
pDataBlock
,
j
);
if
(
orderI
d
==
j
)
{
if
(
orderI
ndex
==
j
)
{
found
=
true
;
break
;
}
...
...
@@ -308,8 +319,7 @@ static void sortGroupResByOrderList(SGroupResInfo *pGroupResInfo, SQueryRuntimeE
return
;
}
int16_t
type
=
pRuntimeEnv
->
pQueryAttr
->
pExpr1
[
orderId
].
base
.
resType
;
int16_t
type
=
pRuntimeEnv
->
pQueryAttr
->
pExpr1
[
orderIndex
].
base
.
resType
;
SRowCompSupporter
support
=
{.
pRuntimeEnv
=
pRuntimeEnv
,
.
dataOffset
=
dataOffset
,
.
comFunc
=
getComparFunc
(
type
,
0
)};
taosArraySortPWithExt
(
pGroupResInfo
->
pRows
,
compareRowData
,
&
support
);
}
...
...
@@ -6474,7 +6484,7 @@ static SSDataBlock* hashGroupbyAggregate(void* param, bool* newgroup) {
initGroupResInfo
(
&
pRuntimeEnv
->
groupResInfo
,
&
pInfo
->
binfo
.
resultRowInfo
);
if
(
!
pRuntimeEnv
->
pQueryAttr
->
stableQuery
)
{
sortGroupResByOrderList
(
&
pRuntimeEnv
->
groupResInfo
,
pRuntimeEnv
,
pInfo
->
binfo
.
pRes
);
sortGroupResByOrderList
(
&
pRuntimeEnv
->
groupResInfo
,
pRuntimeEnv
,
pInfo
->
binfo
.
pRes
,
pInfo
->
binfo
.
pCtx
);
}
toSSDataBlock
(
&
pRuntimeEnv
->
groupResInfo
,
pRuntimeEnv
,
pInfo
->
binfo
.
pRes
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录