Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0030c4b5
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看板
提交
0030c4b5
编写于
2月 03, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(query): opt perf by remove some functions.
上级
645c45a2
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
18 addition
and
13 deletion
+18
-13
include/libs/function/function.h
include/libs/function/function.h
+1
-0
include/util/tsimplehash.h
include/util/tsimplehash.h
+0
-0
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+1
-0
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+1
-1
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+8
-5
source/util/src/tpagedbuf.c
source/util/src/tpagedbuf.c
+7
-7
source/util/src/tsimplehash.c
source/util/src/tsimplehash.c
+0
-0
未找到文件。
include/libs/function/function.h
浏览文件 @
0030c4b5
...
...
@@ -133,6 +133,7 @@ typedef struct SqlFunctionCtx {
SResultDataInfo
resDataInfo
;
uint32_t
order
;
// data block scanner order: asc|desc
uint8_t
isPseudoFunc
;
// denote current function is pseudo function or not [added for perf reason]
uint8_t
isNotNullFunc
;
// not return null value.
uint8_t
scanFlag
;
// record current running step, default: 0
int16_t
functionId
;
// function id
char
*
pOutput
;
// final result output buffer, point to sdata->data
...
...
source/libs/executor/inc
/tsimplehash.h
→
include/util
/tsimplehash.h
浏览文件 @
0030c4b5
文件已移动
source/libs/executor/src/executil.c
浏览文件 @
0030c4b5
...
...
@@ -1543,6 +1543,7 @@ SqlFunctionCtx* createSqlFunctionCtx(SExprInfo* pExprInfo, int32_t numOfOutput,
SFuncExecEnv
env
=
{
0
};
pCtx
->
functionId
=
pExpr
->
pExpr
->
_function
.
pFunctNode
->
funcId
;
pCtx
->
isPseudoFunc
=
fmIsWindowPseudoColumnFunc
(
pCtx
->
functionId
);
pCtx
->
isNotNullFunc
=
fmIsNotNullOutputFunc
(
pCtx
->
functionId
);
if
(
fmIsAggFunc
(
pCtx
->
functionId
)
||
fmIsIndefiniteRowsFunc
(
pCtx
->
functionId
))
{
bool
isUdaf
=
fmIsUserDefinedFunc
(
pCtx
->
functionId
);
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
0030c4b5
...
...
@@ -1065,7 +1065,7 @@ static void doUpdateNumOfRows(SqlFunctionCtx* pCtx, SResultRow* pRow, int32_t nu
pRow
->
numOfRows
=
pResInfo
->
numOfRes
;
}
if
(
fmIsNotNullOutputFunc
(
pCtx
[
j
].
functionId
)
)
{
if
(
pCtx
[
j
].
isNotNullFunc
)
{
returnNotNull
=
true
;
}
}
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
0030c4b5
...
...
@@ -794,7 +794,8 @@ int32_t minmaxFunctionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
switch
(
pCol
->
info
.
type
)
{
case
TSDB_DATA_TYPE_UBIGINT
:
case
TSDB_DATA_TYPE_BIGINT
:
colDataAppendInt64
(
pCol
,
currentRow
,
&
pRes
->
v
);
((
int64_t
*
)
pCol
->
pData
)[
currentRow
]
=
pRes
->
v
;
// colDataAppendInt64(pCol, currentRow, &pRes->v);
break
;
case
TSDB_DATA_TYPE_UINT
:
case
TSDB_DATA_TYPE_INT
:
...
...
@@ -822,10 +823,12 @@ int32_t minmaxFunctionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
colDataAppendNULL
(
pCol
,
currentRow
);
}
if
(
pEntryInfo
->
numOfRes
>
0
)
{
code
=
setSelectivityValue
(
pCtx
,
pBlock
,
&
pRes
->
tuplePos
,
currentRow
);
}
else
{
code
=
setSelectivityValue
(
pCtx
,
pBlock
,
&
pRes
->
nullTuplePos
,
currentRow
);
if
(
pCtx
->
subsidiaries
.
num
>
0
)
{
if
(
pEntryInfo
->
numOfRes
>
0
)
{
code
=
setSelectivityValue
(
pCtx
,
pBlock
,
&
pRes
->
tuplePos
,
currentRow
);
}
else
{
code
=
setSelectivityValue
(
pCtx
,
pBlock
,
&
pRes
->
nullTuplePos
,
currentRow
);
}
}
return
code
;
...
...
source/util/src/tpagedbuf.c
浏览文件 @
0030c4b5
...
...
@@ -2,7 +2,7 @@
#include "tpagedbuf.h"
#include "taoserror.h"
#include "tcompression.h"
#include "thash.h"
#include "t
simple
hash.h"
#include "tlog.h"
#define GET_PAYLOAD_DATA(_p) ((char*)(_p)->pData + POINTER_BYTES)
...
...
@@ -38,7 +38,7 @@ struct SDiskbasedBuf {
int32_t
inMemPages
;
// numOfPages that are allocated in memory
SList
*
freePgList
;
// free page list
SArray
*
pIdList
;
// page id list
S
HashObj
*
all
;
S
SHashObj
*
all
;
SList
*
lruList
;
void
*
emptyDummyIdList
;
// dummy id list
void
*
assistBuf
;
// assistant buffer for compress/decompress data
...
...
@@ -377,7 +377,7 @@ int32_t createDiskbasedBuf(SDiskbasedBuf** pBuf, int32_t pagesize, int32_t inMem
goto
_error
;
}
pPBuf
->
all
=
t
aosHashInit
(
10
,
fn
,
true
,
false
);
pPBuf
->
all
=
t
SimpleHashInit
(
20
,
fn
);
if
(
pPBuf
->
all
==
NULL
)
{
goto
_error
;
}
...
...
@@ -438,7 +438,7 @@ void* getNewBufPage(SDiskbasedBuf* pBuf, int32_t* pageId) {
}
// add to hash map
t
aos
HashPut
(
pBuf
->
all
,
pageId
,
sizeof
(
int32_t
),
&
pi
,
POINTER_BYTES
);
t
Simple
HashPut
(
pBuf
->
all
,
pageId
,
sizeof
(
int32_t
),
&
pi
,
POINTER_BYTES
);
pBuf
->
totalBufSize
+=
pBuf
->
pageSize
;
}
...
...
@@ -463,7 +463,7 @@ void* getBufPage(SDiskbasedBuf* pBuf, int32_t id) {
pBuf
->
statis
.
getPages
+=
1
;
SPageInfo
**
pi
=
t
aos
HashGet
(
pBuf
->
all
,
&
id
,
sizeof
(
int32_t
));
SPageInfo
**
pi
=
t
Simple
HashGet
(
pBuf
->
all
,
&
id
,
sizeof
(
int32_t
));
if
(
pi
==
NULL
||
*
pi
==
NULL
)
{
uError
(
"failed to locate the buffer page:%d, %s"
,
id
,
pBuf
->
id
);
terrno
=
TSDB_CODE_INVALID_PARA
;
...
...
@@ -615,7 +615,7 @@ void destroyDiskbasedBuf(SDiskbasedBuf* pBuf) {
taosArrayDestroy
(
pBuf
->
emptyDummyIdList
);
taosArrayDestroy
(
pBuf
->
pFree
);
t
aos
HashCleanup
(
pBuf
->
all
);
t
Simple
HashCleanup
(
pBuf
->
all
);
taosMemoryFreeClear
(
pBuf
->
id
);
taosMemoryFreeClear
(
pBuf
->
assistBuf
);
...
...
@@ -711,7 +711,7 @@ void clearDiskbasedBuf(SDiskbasedBuf* pBuf) {
taosArrayClear
(
pBuf
->
emptyDummyIdList
);
taosArrayClear
(
pBuf
->
pFree
);
t
aos
HashClear
(
pBuf
->
all
);
t
Simple
HashClear
(
pBuf
->
all
);
pBuf
->
numOfPages
=
0
;
// all pages are in buffer in the first place
pBuf
->
totalBufSize
=
0
;
...
...
source/
libs/executor
/src/tsimplehash.c
→
source/
util
/src/tsimplehash.c
浏览文件 @
0030c4b5
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录