Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
24218752
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看板
提交
24218752
编写于
8月 01, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: optimize tablescan perf.
上级
2531ee90
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
56 addition
and
18 deletion
+56
-18
include/common/tdatablock.h
include/common/tdatablock.h
+1
-1
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+48
-0
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+5
-10
source/libs/scalar/src/sclfunc.c
source/libs/scalar/src/sclfunc.c
+1
-7
source/os/src/osMath.c
source/os/src/osMath.c
+1
-0
未找到文件。
include/common/tdatablock.h
浏览文件 @
24218752
...
...
@@ -184,7 +184,7 @@ static FORCE_INLINE void colDataAppendDouble(SColumnInfoData* pColumnInfoData, u
int32_t
getJsonValueLen
(
const
char
*
data
);
int32_t
colDataAppend
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
const
char
*
pData
,
bool
isNull
);
int32_t
colData
Reserve
(
SColumnInfoData
*
pColumnInfoData
,
size_t
newSize
);
int32_t
colData
AppendNItems
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
const
char
*
pData
,
uint32_t
numOfRows
);
int32_t
colDataMergeCol
(
SColumnInfoData
*
pColumnInfoData
,
int32_t
numOfRow1
,
int32_t
*
capacity
,
const
SColumnInfoData
*
pSource
,
int32_t
numOfRow2
);
int32_t
colDataAssign
(
SColumnInfoData
*
pColumnInfoData
,
const
SColumnInfoData
*
pSource
,
int32_t
numOfRows
,
...
...
source/common/src/tdatablock.c
浏览文件 @
24218752
...
...
@@ -140,6 +140,54 @@ int32_t colDataReserve(SColumnInfoData* pColumnInfoData, size_t newSize) {
return
TSDB_CODE_SUCCESS
;
}
static
void
doCopyNItems
(
struct
SColumnInfoData
*
pColumnInfoData
,
int32_t
currentRow
,
const
char
*
pData
,
int32_t
itemLen
,
int32_t
numOfRows
)
{
ASSERT
(
pColumnInfoData
->
info
.
bytes
>=
itemLen
);
size_t
start
=
1
;
// the first item
memcpy
(
pColumnInfoData
->
pData
,
pData
,
itemLen
);
int32_t
t
=
0
;
int32_t
count
=
log
(
numOfRows
)
/
log
(
2
);
while
(
t
<
count
)
{
int32_t
xlen
=
1
<<
t
;
memcpy
(
pColumnInfoData
->
pData
+
start
*
itemLen
+
pColumnInfoData
->
varmeta
.
length
,
pColumnInfoData
->
pData
,
xlen
*
itemLen
);
t
+=
1
;
start
+=
xlen
;
}
// the tail part
if
(
numOfRows
>
start
)
{
memcpy
(
pColumnInfoData
->
pData
+
start
*
itemLen
+
currentRow
*
itemLen
,
pColumnInfoData
->
pData
,
(
numOfRows
-
start
)
*
itemLen
);
}
if
(
IS_VAR_DATA_TYPE
(
pColumnInfoData
->
info
.
type
))
{
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
pColumnInfoData
->
varmeta
.
offset
[
i
+
currentRow
]
=
pColumnInfoData
->
varmeta
.
length
+
i
*
itemLen
;
}
pColumnInfoData
->
varmeta
.
length
+=
numOfRows
*
itemLen
;
}
}
int32_t
colDataAppendNItems
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
const
char
*
pData
,
uint32_t
numOfRows
)
{
ASSERT
(
pData
!=
NULL
&&
pColumnInfoData
!=
NULL
);
int32_t
len
=
pColumnInfoData
->
info
.
bytes
;
if
(
IS_VAR_DATA_TYPE
(
pColumnInfoData
->
info
.
type
))
{
len
=
varDataTLen
(
pData
);
if
(
pColumnInfoData
->
varmeta
.
allocLen
<
(
numOfRows
+
currentRow
)
*
len
)
{
int32_t
code
=
colDataReserve
(
pColumnInfoData
,
(
numOfRows
+
currentRow
)
*
len
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
}
}
doCopyNItems
(
pColumnInfoData
,
currentRow
,
pData
,
len
,
numOfRows
);
return
TSDB_CODE_SUCCESS
;
}
static
void
doBitmapMerge
(
SColumnInfoData
*
pColumnInfoData
,
int32_t
numOfRow1
,
const
SColumnInfoData
*
pSource
,
int32_t
numOfRow2
)
{
if
(
numOfRow2
<=
0
)
return
;
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
24218752
...
...
@@ -399,22 +399,17 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, SExprInfo* pPseudoExpr, int
const
char
*
p
=
metaGetTableTagVal
(
&
mr
.
me
,
pColInfoData
->
info
.
type
,
&
tagVal
);
char
*
data
=
NULL
;
int32_t
len
=
0
;
if
(
pColInfoData
->
info
.
type
!=
TSDB_DATA_TYPE_JSON
&&
p
!=
NULL
)
{
data
=
tTagValToData
((
const
STagVal
*
)
p
,
false
);
len
=
varDataTLen
(
data
);
code
=
colDataReserve
(
pColInfoData
,
len
*
pBlock
->
info
.
rows
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
terrno
=
code
;
return
code
;
}
}
else
{
data
=
(
char
*
)
p
;
}
for
(
int32_t
i
=
0
;
i
<
pBlock
->
info
.
rows
;
++
i
)
{
colDataAppend
(
pColInfoData
,
i
,
data
,
(
data
==
NULL
)
||
(
pColInfoData
->
info
.
type
==
TSDB_DATA_TYPE_JSON
&&
tTagIsJsonNull
(
data
)));
bool
isNullVal
=
(
data
==
NULL
)
||
(
pColInfoData
->
info
.
type
==
TSDB_DATA_TYPE_JSON
&&
tTagIsJsonNull
(
data
));
if
(
isNullVal
)
{
colDataAppendNNULL
(
pColInfoData
,
0
,
pBlock
->
info
.
rows
);
}
else
{
colDataAppendNItems
(
pColInfoData
,
0
,
data
,
pBlock
->
info
.
rows
);
}
if
(
data
&&
(
pColInfoData
->
info
.
type
!=
TSDB_DATA_TYPE_JSON
)
&&
p
!=
NULL
&&
...
...
source/libs/scalar/src/sclfunc.c
浏览文件 @
24218752
...
...
@@ -1727,17 +1727,11 @@ int32_t qTbnameFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pO
char
str
[
TSDB_TABLE_FNAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
metaGetTableNameByUid
(
pInput
->
param
,
uid
,
str
);
colDataReserve
(
pOutput
->
columnData
,
varDataTLen
(
str
)
*
(
pInput
->
numOfRows
+
pOutput
->
numOfRows
));
for
(
int32_t
i
=
0
;
i
<
pInput
->
numOfRows
;
++
i
)
{
colDataAppend
(
pOutput
->
columnData
,
pOutput
->
numOfRows
+
i
,
str
,
false
);
}
colDataAppendNItems
(
pOutput
->
columnData
,
pOutput
->
numOfRows
,
str
,
pInput
->
numOfRows
);
pOutput
->
numOfRows
+=
pInput
->
numOfRows
;
return
TSDB_CODE_SUCCESS
;
}
/** Aggregation functions **/
int32_t
countScalarFunction
(
SScalarParam
*
pInput
,
int32_t
inputNum
,
SScalarParam
*
pOutput
)
{
SColumnInfoData
*
pInputData
=
pInput
->
columnData
;
...
...
source/os/src/osMath.c
浏览文件 @
24218752
...
...
@@ -31,6 +31,7 @@ void swapStr(char* j, char* J, int width) {
}
#endif
// todo refactor: 1) move away; 2) use merge sort instead; 3) qsort is not a stable sort actually.
void
taosSort
(
void
*
arr
,
int64_t
sz
,
int64_t
width
,
__compar_fn_t
compar
)
{
#ifdef WINDOWS
int64_t
i
,
j
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录