Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0fbf30ce
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看板
提交
0fbf30ce
编写于
6月 11, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: do some internal refactor, and add some check before create exchange operator.
上级
514e86ff
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
38 addition
and
22 deletion
+38
-22
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+1
-2
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+2
-2
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+0
-1
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+1
-1
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+11
-8
source/libs/executor/src/groupoperator.c
source/libs/executor/src/groupoperator.c
+1
-1
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+3
-3
source/libs/executor/src/sortoperator.c
source/libs/executor/src/sortoperator.c
+7
-2
source/libs/executor/src/tsort.c
source/libs/executor/src/tsort.c
+12
-2
未找到文件。
source/client/src/clientImpl.c
浏览文件 @
0fbf30ce
...
...
@@ -689,16 +689,15 @@ void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery) {
.
msgLen
=
ERROR_MSG_BUF_DEFAULT_SIZE
};
SAppInstInfo
*
pAppInfo
=
getAppInfo
(
pRequest
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
qCreateQueryPlan
(
&
cxt
,
&
pRequest
->
body
.
pDag
,
pNodeList
);
tscError
(
"0x%"
PRIx64
" failed to create query plan, code:%s 0x%"
PRIx64
,
pRequest
->
self
,
tstrerror
(
code
),
pRequest
->
requestId
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
schedulerAsyncExecJob
(
pAppInfo
->
pTransporter
,
pNodeList
,
pRequest
->
body
.
pDag
,
&
pRequest
->
body
.
queryJob
,
pRequest
->
sqlstr
,
pRequest
->
metric
.
start
,
schedulerExecCb
,
pRequest
);
}
else
{
tscError
(
"0x%"
PRIx64
" failed to create query plan, code:%s 0x%"
PRIx64
,
pRequest
->
self
,
tstrerror
(
code
),
pRequest
->
requestId
);
pRequest
->
body
.
queryFp
(
pRequest
->
body
.
param
,
pRequest
,
code
);
}
...
...
source/client/test/clientTests.cpp
浏览文件 @
0fbf30ce
...
...
@@ -778,9 +778,9 @@ TEST(testCase, async_api_test) {
TAOS
*
pConn
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
ASSERT_NE
(
pConn
,
nullptr
);
taos_query
(
pConn
,
"use
t
est"
);
taos_query
(
pConn
,
"use
n
est"
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"
desc abc1.tu
"
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"
select NOW() from (select * from regular_table_2 where tbname in ('regular_table_2_1') and q_bigint <= 9223372036854775807 and q_tinyint <= 127 and q_bool in ( true , false) ) order by ts;
"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed, reason:%s
\n
"
,
taos_errstr
(
pRes
));
}
...
...
source/common/src/tdatablock.c
浏览文件 @
0fbf30ce
...
...
@@ -322,7 +322,6 @@ int32_t colDataAssign(SColumnInfoData* pColumnInfoData, const SColumnInfoData* p
pColumnInfoData
->
varmeta
.
length
=
pSource
->
varmeta
.
length
;
}
else
{
char
*
tmp
=
taosMemoryRealloc
(
pColumnInfoData
->
nullbitmap
,
BitmapLen
(
numOfRows
));
printf
(
"----------------%d
\n
"
,
BitmapLen
(
numOfRows
));
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
0fbf30ce
...
...
@@ -760,7 +760,7 @@ int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t *order, int32_t* scan
int32_t
getBufferPgSize
(
int32_t
rowSize
,
uint32_t
*
defaultPgsz
,
uint32_t
*
defaultBufsz
);
void
doSetOperatorCompleted
(
SOperatorInfo
*
pOperator
);
void
doFilter
(
const
SNode
*
pFilterNode
,
SSDataBlock
*
pBlock
,
bool
needFree
);
void
doFilter
(
const
SNode
*
pFilterNode
,
SSDataBlock
*
pBlock
);
SqlFunctionCtx
*
createSqlFunctionCtx
(
SExprInfo
*
pExprInfo
,
int32_t
numOfOutput
,
int32_t
**
rowCellInfoOffset
);
void
relocateColumnData
(
SSDataBlock
*
pBlock
,
const
SArray
*
pColMatchInfo
,
SArray
*
pCols
);
void
initExecTimeWindowInfo
(
SColumnInfoData
*
pColData
,
STimeWindow
*
pQueryWindow
);
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
0fbf30ce
...
...
@@ -1821,7 +1821,7 @@ void setResultRowInitCtx(SResultRow* pResult, SqlFunctionCtx* pCtx, int32_t numO
static
void
extractQualifiedTupleByFilterResult
(
SSDataBlock
*
pBlock
,
const
int8_t
*
rowRes
,
bool
keep
);
void
doFilter
(
const
SNode
*
pFilterNode
,
SSDataBlock
*
pBlock
,
bool
needFree
)
{
void
doFilter
(
const
SNode
*
pFilterNode
,
SSDataBlock
*
pBlock
)
{
if
(
pFilterNode
==
NULL
)
{
return
;
}
...
...
@@ -2829,7 +2829,6 @@ static SSDataBlock* doLoadRemoteData(SOperatorInfo* pOperator) {
return
seqLoadRemoteData
(
pOperator
);
}
else
{
return
concurrentlyLoadRemoteDataImpl
(
pOperator
,
pExchangeInfo
,
pTaskInfo
);
// return concurrentlyLoadRemoteData(pOperator);
}
}
...
...
@@ -2855,9 +2854,14 @@ static int32_t initDataSource(int32_t numOfSources, SExchangeInfo* pInfo) {
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
initExchangeOperator
(
SExchangePhysiNode
*
pExNode
,
SExchangeInfo
*
pInfo
)
{
static
int32_t
initExchangeOperator
(
SExchangePhysiNode
*
pExNode
,
SExchangeInfo
*
pInfo
,
const
char
*
id
)
{
size_t
numOfSources
=
LIST_LENGTH
(
pExNode
->
pSrcEndPoints
);
if
(
numOfSources
==
0
)
{
qError
(
"%s invalid number: %d of sources in exchange operator"
,
id
,
(
int32_t
)
numOfSources
);
return
TSDB_CODE_INVALID_PARA
;
}
pInfo
->
pSources
=
taosArrayInit
(
numOfSources
,
sizeof
(
SDownstreamSourceNode
));
pInfo
->
pSourceDataInfo
=
taosArrayInit
(
numOfSources
,
sizeof
(
SSourceDataInfo
));
if
(
pInfo
->
pSourceDataInfo
==
NULL
||
pInfo
->
pSources
==
NULL
)
{
...
...
@@ -2879,7 +2883,7 @@ SOperatorInfo* createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode
goto
_error
;
}
int32_t
code
=
initExchangeOperator
(
pExNode
,
pInfo
);
int32_t
code
=
initExchangeOperator
(
pExNode
,
pInfo
,
GET_TASKID
(
pTaskInfo
)
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -2908,7 +2912,7 @@ _error:
taosMemoryFreeClear
(
pInfo
);
taosMemoryFreeClear
(
pOperator
);
pTaskInfo
->
code
=
TSDB_CODE_OUT_OF_MEMORY
;
pTaskInfo
->
code
=
code
;
return
NULL
;
}
...
...
@@ -3677,7 +3681,7 @@ static SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
longjmp
(
pTaskInfo
->
env
,
code
);
}
doFilter
(
pProjectInfo
->
pFilterNode
,
pBlock
,
true
);
doFilter
(
pProjectInfo
->
pFilterNode
,
pBlock
);
setInputDataBlock
(
pOperator
,
pInfo
->
pCtx
,
pBlock
,
order
,
scanFlag
,
false
);
blockDataEnsureCapacity
(
pInfo
->
pRes
,
pInfo
->
pRes
->
info
.
rows
+
pBlock
->
info
.
rows
);
...
...
@@ -5189,7 +5193,7 @@ int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SRead
(
*
pTaskInfo
)
->
pRoot
=
createOperatorTree
(
pPlan
->
pNode
,
*
pTaskInfo
,
pHandle
,
queryId
,
taskId
,
&
(
*
pTaskInfo
)
->
tableqinfoList
,
pPlan
->
pTagCond
);
if
(
NULL
==
(
*
pTaskInfo
)
->
pRoot
)
{
code
=
terrno
;
code
=
(
*
pTaskInfo
)
->
code
;
goto
_complete
;
}
...
...
@@ -5202,7 +5206,6 @@ int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SRead
_complete:
taosMemoryFreeClear
(
*
pTaskInfo
);
terrno
=
code
;
return
code
;
}
...
...
source/libs/executor/src/groupoperator.c
浏览文件 @
0fbf30ce
...
...
@@ -359,7 +359,7 @@ static SSDataBlock* hashGroupbyAggregate(SOperatorInfo* pOperator) {
while
(
1
)
{
doBuildResultDatablock
(
pOperator
,
&
pInfo
->
binfo
,
&
pInfo
->
groupResInfo
,
pInfo
->
aggSup
.
pResultBuf
);
doFilter
(
pInfo
->
pCondition
,
pRes
,
true
);
doFilter
(
pInfo
->
pCondition
,
pRes
);
bool
hasRemain
=
hashRemainDataInGroupInfo
(
&
pInfo
->
groupResInfo
);
if
(
!
hasRemain
)
{
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
0fbf30ce
...
...
@@ -267,7 +267,7 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca
}
int64_t
st
=
taosGetTimestampMs
();
doFilter
(
pTableScanInfo
->
pFilterNode
,
pBlock
,
false
);
doFilter
(
pTableScanInfo
->
pFilterNode
,
pBlock
);
int64_t
et
=
taosGetTimestampMs
();
pTableScanInfo
->
readRecorder
.
filterTime
+=
(
et
-
st
);
...
...
@@ -939,7 +939,7 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
addTagPseudoColumnData
(
&
pInfo
->
readHandle
,
pInfo
->
pPseudoExpr
,
pInfo
->
numOfPseudoExpr
,
pInfo
->
pRes
);
}
doFilter
(
pInfo
->
pCondition
,
pInfo
->
pRes
,
false
);
doFilter
(
pInfo
->
pCondition
,
pInfo
->
pRes
);
blockDataUpdateTsWindow
(
pInfo
->
pRes
,
0
);
break
;
}
...
...
@@ -1711,7 +1711,7 @@ static SSDataBlock* doTagScan(SOperatorInfo* pOperator) {
}
pRes
->
info
.
rows
=
count
;
doFilter
(
pInfo
->
pFilterNode
,
pRes
,
true
);
doFilter
(
pInfo
->
pFilterNode
,
pRes
);
pOperator
->
resultInfo
.
totalRows
+=
pRes
->
info
.
rows
;
...
...
source/libs/executor/src/sortoperator.c
浏览文件 @
0fbf30ce
...
...
@@ -296,7 +296,10 @@ int32_t doOpenMultiwaySortMergeOperator(SOperatorInfo* pOperator) {
}
SSDataBlock
*
getMultiwaySortedBlockData
(
SSortHandle
*
pHandle
,
SSDataBlock
*
pDataBlock
,
int32_t
capacity
,
SArray
*
pColMatchInfo
,
SMultiwaySortMergeOperatorInfo
*
pInfo
)
{
SArray
*
pColMatchInfo
,
SOperatorInfo
*
pOperator
)
{
SMultiwaySortMergeOperatorInfo
*
pInfo
=
pOperator
->
info
;
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
blockDataCleanup
(
pDataBlock
);
SSDataBlock
*
p
=
tsortGetSortedDataBlock
(
pHandle
);
...
...
@@ -354,6 +357,8 @@ SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pData
}
blockDataDestroy
(
p
);
qDebug
(
"%s get sorted row blocks, rows:%d"
,
GET_TASKID
(
pTaskInfo
),
pDataBlock
->
info
.
rows
);
return
(
pDataBlock
->
info
.
rows
>
0
)
?
pDataBlock
:
NULL
;
}
...
...
@@ -371,7 +376,7 @@ SSDataBlock* doMultiwaySortMerge(SOperatorInfo* pOperator) {
}
SSDataBlock
*
pBlock
=
getMultiwaySortedBlockData
(
pInfo
->
pSortHandle
,
pInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
,
pInfo
->
pColMatchInfo
,
p
Info
);
pOperator
->
resultInfo
.
capacity
,
pInfo
->
pColMatchInfo
,
p
Operator
);
if
(
pBlock
!=
NULL
)
{
pOperator
->
resultInfo
.
totalRows
+=
pBlock
->
info
.
rows
;
...
...
source/libs/executor/src/tsort.c
浏览文件 @
0fbf30ce
...
...
@@ -227,6 +227,8 @@ static int32_t sortComparInit(SMsortComparParam* cmpParam, SArray* pSources, int
for
(
int32_t
i
=
0
;
i
<
cmpParam
->
numOfSources
;
++
i
)
{
SSortSource
*
pSource
=
cmpParam
->
pSources
[
i
];
pSource
->
src
.
pBlock
=
pHandle
->
fetchfp
(
pSource
->
param
);
// set current source id done
if
(
pSource
->
src
.
pBlock
==
NULL
)
{
pSource
->
src
.
rowIndex
=
-
1
;
++
pHandle
->
numOfCompletedSources
;
...
...
@@ -426,8 +428,16 @@ static int32_t doInternalMergeSort(SSortHandle* pHandle) {
double
sortPass
=
floorl
(
log2
(
numOfSources
)
/
log2
(
pHandle
->
numOfPages
));
pHandle
->
totalElapsed
=
taosGetTimestampUs
()
-
pHandle
->
startTs
;
qDebug
(
"%s %d rounds mergesort required to complete the sort, first-round sorted data size:%"
PRIzu
", sort elapsed:%"
PRId64
", total elapsed:%"
PRId64
,
pHandle
->
idStr
,
(
int32_t
)
(
sortPass
+
1
),
pHandle
->
pBuf
?
getTotalBufSize
(
pHandle
->
pBuf
)
:
0
,
pHandle
->
sortElapsed
,
pHandle
->
totalElapsed
);
if
(
sortPass
>
0
)
{
size_t
s
=
pHandle
->
pBuf
?
getTotalBufSize
(
pHandle
->
pBuf
)
:
0
;
qDebug
(
"%s %d rounds mergesort required to complete the sort, first-round sorted data size:%"
PRIzu
", sort elapsed:%"
PRId64
", total elapsed:%"
PRId64
,
pHandle
->
idStr
,
(
int32_t
)(
sortPass
+
1
),
s
,
pHandle
->
sortElapsed
,
pHandle
->
totalElapsed
);
}
else
{
qDebug
(
"%s ordered source:%"
PRIzu
", available buf:%d, no need internal sort"
,
pHandle
->
idStr
,
numOfSources
,
pHandle
->
numOfPages
);
}
int32_t
numOfRows
=
blockDataGetCapacityInRow
(
pHandle
->
pDataBlock
,
pHandle
->
pageSize
);
blockDataEnsureCapacity
(
pHandle
->
pDataBlock
,
numOfRows
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录