Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yiicenne
TDengine
提交
e02653fb
TDengine
项目概览
yiicenne
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e02653fb
编写于
6月 01, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-255] fix bug found by regression test.
上级
86b00102
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
60 addition
and
21 deletion
+60
-21
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+8
-1
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+51
-17
src/query/src/qAggMain.c
src/query/src/qAggMain.c
+1
-3
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
e02653fb
...
...
@@ -7493,6 +7493,13 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf
}
}
}
// set order by info
STableMeta
*
pTableMeta
=
tscGetMetaInfo
(
pQueryInfo
,
0
)
->
pTableMeta
;
if
(
validateOrderbyNode
(
pCmd
,
pQueryInfo
,
pSqlNode
,
tscGetTableSchema
(
pTableMeta
))
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
}
else
{
pQueryInfo
->
command
=
TSDB_SQL_SELECT
;
...
...
@@ -7642,8 +7649,8 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf
SExprInfo
**
p
=
NULL
;
int32_t
numOfExpr
=
0
;
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
code
=
createProjectionExpr
(
pQueryInfo
,
pTableMetaInfo
,
&
p
,
&
numOfExpr
);
if
(
pQueryInfo
->
exprList1
==
NULL
)
{
pQueryInfo
->
exprList1
=
taosArrayInit
(
4
,
POINTER_BYTES
);
}
...
...
src/client/src/tscUtil.c
浏览文件 @
e02653fb
...
...
@@ -777,7 +777,9 @@ SSDataBlock* doGetDataBlock(void* param, bool* newgroup) {
SSqlRes
*
pRes
=
&
pSql
->
res
;
SSDataBlock
*
pBlock
=
pInput
->
block
;
if
(
pOperator
->
pRuntimeEnv
!=
NULL
)
{
pOperator
->
pRuntimeEnv
->
current
=
pInput
->
pTableQueryInfo
;
}
pBlock
->
info
.
rows
=
pRes
->
numOfRows
;
if
(
pRes
->
numOfRows
!=
0
)
{
...
...
@@ -801,18 +803,9 @@ SSDataBlock* doGetDataBlock(void* param, bool* newgroup) {
return
pBlock
;
}
SSDataBlock
*
doDataBlockJoin
(
void
*
param
,
bool
*
newgroup
)
{
SOperatorInfo
*
pOperator
=
(
SOperatorInfo
*
)
param
;
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
return
NULL
;
}
assert
(
pOperator
->
numOfUpstream
>
1
);
static
void
fetchNextBlockIfCompleted
(
SOperatorInfo
*
pOperator
,
bool
*
newgroup
)
{
SJoinOperatorInfo
*
pJoinInfo
=
pOperator
->
info
;
pJoinInfo
->
pRes
->
info
.
rows
=
0
;
while
(
1
)
{
for
(
int32_t
i
=
0
;
i
<
pOperator
->
numOfUpstream
;
++
i
)
{
SJoinStatus
*
pStatus
=
&
pJoinInfo
->
status
[
i
];
if
(
pStatus
->
pBlock
==
NULL
||
pStatus
->
index
>=
pStatus
->
pBlock
->
info
.
rows
)
{
...
...
@@ -821,12 +814,29 @@ SSDataBlock* doDataBlockJoin(void* param, bool* newgroup) {
if
(
pStatus
->
pBlock
==
NULL
)
{
pOperator
->
status
=
OP_EXEC_DONE
;
pJoinInfo
->
resultInfo
.
total
+=
pJoinInfo
->
pRes
->
info
.
rows
;
return
pJoinInfo
->
pRes
;
break
;
}
}
}
}
SSDataBlock
*
doDataBlockJoin
(
void
*
param
,
bool
*
newgroup
)
{
SOperatorInfo
*
pOperator
=
(
SOperatorInfo
*
)
param
;
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
return
NULL
;
}
assert
(
pOperator
->
numOfUpstream
>
1
);
SJoinOperatorInfo
*
pJoinInfo
=
pOperator
->
info
;
pJoinInfo
->
pRes
->
info
.
rows
=
0
;
while
(
1
)
{
fetchNextBlockIfCompleted
(
pOperator
,
newgroup
);
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
return
pJoinInfo
->
pRes
;
}
SJoinStatus
*
st0
=
&
pJoinInfo
->
status
[
0
];
SColumnInfoData
*
p0
=
taosArrayGet
(
st0
->
pBlock
->
pDataBlock
,
0
);
...
...
@@ -844,8 +854,12 @@ SSDataBlock* doDataBlockJoin(void* param, bool* newgroup) {
if
(
ts
[
st
->
index
]
<
ts0
[
st0
->
index
])
{
// less than the first
prefixEqual
=
false
;
if
((
++
(
st
->
index
))
>=
st
->
pBlock
->
info
.
rows
)
{
break
;
fetchNextBlockIfCompleted
(
pOperator
,
newgroup
);
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
return
pJoinInfo
->
pRes
;
}
}
}
else
if
(
ts
[
st
->
index
]
>
ts0
[
st0
->
index
])
{
// greater than the first;
if
(
prefixEqual
==
true
)
{
...
...
@@ -853,12 +867,19 @@ SSDataBlock* doDataBlockJoin(void* param, bool* newgroup) {
for
(
int32_t
j
=
0
;
j
<
i
;
++
j
)
{
SJoinStatus
*
stx
=
&
pJoinInfo
->
status
[
j
];
if
((
++
(
stx
->
index
))
>=
stx
->
pBlock
->
info
.
rows
)
{
break
;
fetchNextBlockIfCompleted
(
pOperator
,
newgroup
);
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
return
pJoinInfo
->
pRes
;
}
}
}
}
else
{
if
((
++
(
st0
->
index
))
>=
st0
->
pBlock
->
info
.
rows
)
{
break
;
fetchNextBlockIfCompleted
(
pOperator
,
newgroup
);
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
return
pJoinInfo
->
pRes
;
}
}
}
}
...
...
@@ -1129,6 +1150,19 @@ void handleDownstreamOperator(SSqlObj** pSqlObjList, int32_t numOfUpstream, SQue
memcpy
(
schema
,
pSchema
,
numOfCol1
*
sizeof
(
SSchema
));
}
// update the exprinfo
int32_t
numOfOutput
=
(
int32_t
)
tscNumOfExprs
(
px
);
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
SExprInfo
*
pex
=
taosArrayGetP
(
px
->
exprList
,
i
);
int32_t
colId
=
pex
->
base
.
colInfo
.
colId
;
for
(
int32_t
j
=
0
;
j
<
pSourceOperator
->
numOfOutput
;
++
j
)
{
if
(
colId
==
schema
[
j
].
colId
)
{
pex
->
base
.
colInfo
.
colIndex
=
j
;
break
;
}
}
}
px
->
pQInfo
=
createQInfoFromQueryNode
(
px
,
&
tableGroupInfo
,
pSourceOperator
,
NULL
,
NULL
,
MASTER_SCAN
);
tfree
(
pColumnInfo
);
tfree
(
schema
);
...
...
src/query/src/qAggMain.c
浏览文件 @
e02653fb
...
...
@@ -2489,7 +2489,6 @@ static void buildTopBotStruct(STopBotInfo *pTopBotInfo, SQLFunctionCtx *pCtx) {
tmp
+=
POINTER_BYTES
*
pCtx
->
param
[
0
].
i64
;
size_t
size
=
sizeof
(
tValuePair
)
+
pCtx
->
tagInfo
.
tagsLen
;
// assert(pCtx->param[0].i64 > 0);
for
(
int32_t
i
=
0
;
i
<
pCtx
->
param
[
0
].
i64
;
++
i
)
{
pTopBotInfo
->
res
[
i
]
=
(
tValuePair
*
)
tmp
;
...
...
@@ -2498,7 +2497,6 @@ static void buildTopBotStruct(STopBotInfo *pTopBotInfo, SQLFunctionCtx *pCtx) {
}
}
bool
topbot_datablock_filter
(
SQLFunctionCtx
*
pCtx
,
const
char
*
minval
,
const
char
*
maxval
)
{
SResultRowCellInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
if
(
pResInfo
==
NULL
)
{
...
...
@@ -2742,7 +2740,7 @@ static void top_bottom_func_finalizer(SQLFunctionCtx *pCtx) {
if
(
pCtx
->
param
[
1
].
i64
==
PRIMARYKEY_TIMESTAMP_COL_INDEX
)
{
__compar_fn_t
comparator
=
(
pCtx
->
param
[
2
].
i64
==
TSDB_ORDER_ASC
)
?
resAscComparFn
:
resDescComparFn
;
qsort
(
tvp
,
(
size_t
)
pResInfo
->
numOfRes
,
POINTER_BYTES
,
comparator
);
}
else
if
(
pCtx
->
param
[
1
].
i64
>
PRIMARYKEY_TIMESTAMP_COL_INDEX
)
{
}
else
/*if (pCtx->param[1].i64 > PRIMARYKEY_TIMESTAMP_COL_INDEX)*/
{
__compar_fn_t
comparator
=
(
pCtx
->
param
[
2
].
i64
==
TSDB_ORDER_ASC
)
?
resDataAscComparFn
:
resDataDescComparFn
;
qsort
(
tvp
,
(
size_t
)
pResInfo
->
numOfRes
,
POINTER_BYTES
,
comparator
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录