Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a54d3a2b
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看板
提交
a54d3a2b
编写于
7月 22, 2021
作者:
Y
yihaoDeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-5438
上级
0388ffa7
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
37 addition
and
14 deletion
+37
-14
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+1
-1
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+1
-1
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+2
-1
src/query/inc/qTableMeta.h
src/query/inc/qTableMeta.h
+2
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+19
-5
src/query/src/qPlan.c
src/query/src/qPlan.c
+12
-5
未找到文件。
src/client/src/tscSubquery.c
浏览文件 @
a54d3a2b
...
...
@@ -2892,7 +2892,7 @@ static void tscRetrieveFromDnodeCallBack(void *param, TAOS_RES *tres, int numOfR
tscDebug
(
"0x%"
PRIx64
" sub:0x%"
PRIx64
" retrieve numOfRows:%d totalNumOfRows:%"
PRIu64
" from ep:%s, orderOfSub:%d"
,
pParentSql
->
self
,
pSql
->
self
,
pRes
->
numOfRows
,
pState
->
numOfRetrievedRows
,
pSql
->
epSet
.
fqdn
[
pSql
->
epSet
.
inUse
],
idx
);
if
(
num
>
tsMaxNumOfOrderedResults
&&
tscIsProjectionQueryOnSTable
(
pQueryInfo
,
0
)
&&
!
(
tscGetQueryInfo
(
&
pParentSql
->
cmd
)
->
distinctTag
))
{
if
(
num
>
tsMaxNumOfOrderedResults
&&
/*tscIsProjectionQueryOnSTable(pQueryInfo, 0) &&*/
!
(
tscGetQueryInfo
(
&
pParentSql
->
cmd
)
->
distinct
))
{
tscError
(
"0x%"
PRIx64
" sub:0x%"
PRIx64
" num of OrderedRes is too many, max allowed:%"
PRId32
" , current:%"
PRId64
,
pParentSql
->
self
,
pSql
->
self
,
tsMaxNumOfOrderedResults
,
num
);
tscAbortFurtherRetryRetrieval
(
trsupport
,
tres
,
TSDB_CODE_TSC_SORTED_RES_TOO_MANY
);
...
...
src/client/src/tscUtil.c
浏览文件 @
a54d3a2b
...
...
@@ -4597,7 +4597,7 @@ int32_t tscCreateQueryFromQueryInfo(SQueryInfo* pQueryInfo, SQueryAttr* pQueryAt
pQueryAttr
->
queryBlockDist
=
isBlockDistQuery
(
pQueryInfo
);
pQueryAttr
->
pointInterpQuery
=
tscIsPointInterpQuery
(
pQueryInfo
);
pQueryAttr
->
timeWindowInterpo
=
timeWindowInterpoRequired
(
pQueryInfo
);
pQueryAttr
->
distinct
Tag
=
pQueryInfo
->
distinctTag
;
pQueryAttr
->
distinct
=
pQueryInfo
->
distinct
;
pQueryAttr
->
sw
=
pQueryInfo
->
sessionWindow
;
pQueryAttr
->
stateWindow
=
pQueryInfo
->
stateWindow
;
...
...
src/query/inc/qExecutor.h
浏览文件 @
a54d3a2b
...
...
@@ -216,7 +216,7 @@ typedef struct SQueryAttr {
bool
simpleAgg
;
bool
pointInterpQuery
;
// point interpolation query
bool
needReverseScan
;
// need reverse scan
bool
distinct
Tag
;
// distinct tag query
bool
distinct
;
// distinct query or not
bool
stateWindow
;
// window State on sub/normal table
bool
createFilterOperator
;
// if filter operator is needed
int32_t
interBufSize
;
// intermediate buffer sizse
...
...
@@ -514,6 +514,7 @@ typedef struct SDistinctOperatorInfo {
bool
recordNullVal
;
//has already record the null value, no need to try again
int64_t
threshold
;
int64_t
outputCapacity
;
int32_t
colIndex
;
}
SDistinctOperatorInfo
;
struct
SGlobalMerger
;
...
...
src/query/inc/qTableMeta.h
浏览文件 @
a54d3a2b
...
...
@@ -121,7 +121,8 @@ typedef struct SQueryInfo {
int64_t
vgroupLimit
;
// table limit in case of super table projection query + global order + limit
int32_t
udColumnId
;
// current user-defined constant output field column id, monotonically decreases from TSDB_UD_COLUMN_INDEX
bool
distinctTag
;
// distinct tag or not
bool
distinct
;
// distinct tag or not
bool
onlyHasTagCond
;
int32_t
round
;
// 0/1/....
int32_t
bufLen
;
char
*
buf
;
...
...
src/query/src/qExecutor.c
浏览文件 @
a54d3a2b
...
...
@@ -6479,7 +6479,7 @@ static SSDataBlock* doTagScan(void* param, bool* newgroup) {
pOperator
->
status
=
OP_EXEC_DONE
;
qDebug
(
"QInfo:0x%"
PRIx64
" create count(tbname) query, res:%d rows:1"
,
GET_QID
(
pRuntimeEnv
),
count
);
}
else
{
// return only the tags|table name etc.
SExprInfo
*
pExprInfo
=
pOperator
->
pExpr
;
// todo use the column list instead of exprinfo
SExprInfo
*
pExprInfo
=
&
pOperator
->
pExpr
[
0
]
;
// todo use the column list instead of exprinfo
count
=
0
;
while
(
pInfo
->
curPos
<
pInfo
->
totalTables
&&
count
<
maxNumOfTables
)
{
...
...
@@ -6565,13 +6565,25 @@ static SSDataBlock* hashDistinct(void* param, bool* newgroup) {
publishOperatorProfEvent
(
pOperator
->
upstream
[
0
],
QUERY_PROF_AFTER_OPERATOR_EXEC
);
if
(
pBlock
==
NULL
)
{
setQueryStatus
(
pOperator
->
pRuntimeEnv
,
QUERY_COMPLETED
);
pOperator
->
status
=
OP_EXEC_DONE
;
break
;
}
if
(
pInfo
->
colIndex
==
-
1
)
{
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
pBlock
->
pDataBlock
);
i
++
)
{
SColumnInfoData
*
pColDataInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
if
(
pColDataInfo
->
info
.
colId
==
pOperator
->
pExpr
[
0
].
base
.
resColId
)
{
pInfo
->
colIndex
=
i
;
break
;
}
}
}
if
(
pInfo
->
colIndex
==
-
1
)
{
setQueryStatus
(
pOperator
->
pRuntimeEnv
,
QUERY_COMPLETED
);
pOperator
->
status
=
OP_EXEC_DONE
;
return
NULL
;
}
assert
(
pBlock
->
info
.
numOfCols
==
1
);
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
0
);
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
pInfo
->
colIndex
);
int16_t
bytes
=
pColInfoData
->
info
.
bytes
;
int16_t
type
=
pColInfoData
->
info
.
type
;
...
...
@@ -6614,7 +6626,8 @@ static SSDataBlock* hashDistinct(void* param, bool* newgroup) {
SOperatorInfo
*
createDistinctOperatorInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
)
{
SDistinctOperatorInfo
*
pInfo
=
calloc
(
1
,
sizeof
(
SDistinctOperatorInfo
));
pInfo
->
colIndex
=
-
1
;
pInfo
->
threshold
=
10000000
;
// distinct result threshold
pInfo
->
outputCapacity
=
4096
;
pInfo
->
pSet
=
taosHashInit
(
64
,
taosGetDefaultHashFunction
(
pExpr
->
base
.
colType
),
false
,
HASH_NO_LOCK
);
pInfo
->
pRes
=
createOutputBuf
(
pExpr
,
numOfOutput
,
(
int32_t
)
pInfo
->
outputCapacity
);
...
...
@@ -6628,6 +6641,7 @@ SOperatorInfo* createDistinctOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperat
pOperator
->
info
=
pInfo
;
pOperator
->
pRuntimeEnv
=
pRuntimeEnv
;
pOperator
->
exec
=
hashDistinct
;
pOperator
->
pExpr
=
pExpr
;
pOperator
->
cleanup
=
destroyDistinctOperatorInfo
;
appendUpstream
(
pOperator
,
upstream
);
...
...
src/query/src/qPlan.c
浏览文件 @
a54d3a2b
...
...
@@ -104,7 +104,7 @@ static SQueryNode* doAddTableColumnNode(SQueryInfo* pQueryInfo, STableMetaInfo*
int32_t
num
=
(
int32_t
)
taosArrayGetSize
(
pExprs
);
SQueryNode
*
pNode
=
createQueryNode
(
QNODE_TAGSCAN
,
"TableTagScan"
,
NULL
,
0
,
pExprs
->
pData
,
num
,
info
,
NULL
);
if
(
pQueryInfo
->
distinct
Tag
)
{
if
(
pQueryInfo
->
distinct
)
{
pNode
=
createQueryNode
(
QNODE_DISTINCT
,
"Distinct"
,
&
pNode
,
1
,
pExprs
->
pData
,
num
,
info
,
NULL
);
}
...
...
@@ -551,9 +551,11 @@ SArray* createExecOperatorPlan(SQueryAttr* pQueryAttr) {
int32_t
op
=
0
;
if
(
onlyQueryTags
(
pQueryAttr
))
{
// do nothing for tags query
op
=
OP_TagScan
;
taosArrayPush
(
plan
,
&
op
);
if
(
pQueryAttr
->
distinctTag
)
{
if
(
onlyQueryTags
(
pQueryAttr
))
{
op
=
OP_TagScan
;
taosArrayPush
(
plan
,
&
op
);
}
if
(
pQueryAttr
->
distinct
)
{
op
=
OP_Distinct
;
taosArrayPush
(
plan
,
&
op
);
}
...
...
@@ -630,8 +632,13 @@ SArray* createExecOperatorPlan(SQueryAttr* pQueryAttr) {
}
else
{
op
=
OP_Project
;
taosArrayPush
(
plan
,
&
op
);
if
(
pQueryAttr
->
distinct
)
{
op
=
OP_Distinct
;
taosArrayPush
(
plan
,
&
op
);
}
}
}
if
(
pQueryAttr
->
limit
.
limit
>
0
||
pQueryAttr
->
limit
.
offset
>
0
)
{
op
=
OP_Limit
;
...
...
@@ -651,7 +658,7 @@ SArray* createGlobalMergePlan(SQueryAttr* pQueryAttr) {
int32_t
op
=
OP_MultiwayMergeSort
;
taosArrayPush
(
plan
,
&
op
);
if
(
pQueryAttr
->
distinct
Tag
)
{
if
(
pQueryAttr
->
distinct
)
{
op
=
OP_Distinct
;
taosArrayPush
(
plan
,
&
op
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录