Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
00c2d382
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
00c2d382
编写于
1月 03, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): opt filter perf.
上级
5c0fd801
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
100 addition
and
84 deletion
+100
-84
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+1
-1
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+99
-83
未找到文件。
source/common/src/tdatablock.c
浏览文件 @
00c2d382
...
...
@@ -111,7 +111,7 @@ int32_t colDataAppend(SColumnInfoData* pColumnInfoData, uint32_t currentRow, con
uint32_t
len
=
pColumnInfoData
->
varmeta
.
length
;
pColumnInfoData
->
varmeta
.
offset
[
currentRow
]
=
len
;
mem
cpy
(
pColumnInfoData
->
pData
+
len
,
pData
,
dataLen
);
mem
move
(
pColumnInfoData
->
pData
+
len
,
pData
,
dataLen
);
pColumnInfoData
->
varmeta
.
length
+=
dataLen
;
}
else
{
memcpy
(
pColumnInfoData
->
pData
+
pColumnInfoData
->
info
.
bytes
*
currentRow
,
pData
,
pColumnInfoData
->
info
.
bytes
);
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
00c2d382
...
...
@@ -847,7 +847,7 @@ void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const SColumnInfoD
return
;
}
int8_t
*
pIndicator
=
p
->
pData
;
int8_t
*
pIndicator
=
(
int8_t
*
)
p
->
pData
;
int32_t
totalRows
=
pBlock
->
info
.
rows
;
if
(
status
==
FILTER_RESULT_ALL_QUALIFIED
)
{
...
...
@@ -856,7 +856,8 @@ void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const SColumnInfoD
pBlock
->
info
.
rows
=
0
;
}
else
{
int32_t
bmLen
=
BitmapLen
(
totalRows
);
char
*
pBitmap
=
NULL
;
char
*
pBitmap
=
NULL
;
int32_t
maxRows
=
0
;
size_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
...
...
@@ -868,100 +869,115 @@ void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const SColumnInfoD
int32_t
numOfRows
=
0
;
switch
(
pDst
->
info
.
type
)
{
case
TSDB_DATA_TYPE_VARCHAR
:
case
TSDB_DATA_TYPE_NCHAR
:
break
;
default:
if
(
pBitmap
==
NULL
)
{
pBitmap
=
taosMemoryCalloc
(
1
,
bmLen
);
if
(
IS_VAR_DATA_TYPE
(
pDst
->
info
.
type
))
{
int32_t
j
=
0
;
while
(
j
<
totalRows
)
{
if
(
pIndicator
[
j
]
==
0
)
{
continue
;
}
if
(
colDataIsNull_var
(
pDst
,
j
))
{
colDataSetNull_var
(
pDst
,
numOfRows
);
}
else
{
char
*
p1
=
colDataGetVarData
(
pDst
,
j
);
colDataAppend
(
pDst
,
numOfRows
,
p1
,
false
);
}
memcpy
(
pBitmap
,
pDst
->
nullbitmap
,
bmLen
);
memset
(
pDst
->
nullbitmap
,
0
,
bmLen
);
int32_t
j
=
0
;
switch
(
pDst
->
info
.
type
)
{
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_UBIGINT
:
case
TSDB_DATA_TYPE_DOUBLE
:
case
TSDB_DATA_TYPE_TIMESTAMP
:
while
(
j
<
totalRows
)
{
if
(
pIndicator
[
j
]
==
0
)
{
j
+=
1
;
continue
;
}
if
(
colDataIsNull_f
(
pBitmap
,
j
))
{
colDataAppendNULL
(
pDst
,
numOfRows
);
}
else
{
((
int64_t
*
)
pDst
->
pData
)[
numOfRows
]
=
((
int64_t
*
)
pDst
->
pData
)[
j
];
}
numOfRows
+=
1
;
numOfRows
+=
1
;
j
+=
1
;
}
if
(
maxRows
<
numOfRows
)
{
maxRows
=
numOfRows
;
}
}
else
{
if
(
pBitmap
==
NULL
)
{
pBitmap
=
taosMemoryCalloc
(
1
,
bmLen
);
}
memcpy
(
pBitmap
,
pDst
->
nullbitmap
,
bmLen
);
memset
(
pDst
->
nullbitmap
,
0
,
bmLen
);
int32_t
j
=
0
;
switch
(
pDst
->
info
.
type
)
{
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_UBIGINT
:
case
TSDB_DATA_TYPE_DOUBLE
:
case
TSDB_DATA_TYPE_TIMESTAMP
:
while
(
j
<
totalRows
)
{
if
(
pIndicator
[
j
]
==
0
)
{
j
+=
1
;
continue
;
}
if
(
colDataIsNull_f
(
pBitmap
,
j
))
{
colDataSetNull_f
(
pDst
->
nullbitmap
,
numOfRows
);
}
else
{
((
int64_t
*
)
pDst
->
pData
)[
numOfRows
]
=
((
int64_t
*
)
pDst
->
pData
)[
j
];
}
break
;
case
TSDB_DATA_TYPE_FLOAT
:
case
TSDB_DATA_TYPE_INT
:
case
TSDB_DATA_TYPE_UINT
:
while
(
j
<
totalRows
)
{
if
(
pIndicator
[
j
]
==
0
)
{
j
+=
1
;
continue
;
}
if
(
colDataIsNull_f
(
pBitmap
,
j
))
{
colDataAppendNULL
(
pDst
,
numOfRows
);
}
else
{
((
int32_t
*
)
pDst
->
pData
)[
numOfRows
++
]
=
((
int32_t
*
)
pDst
->
pData
)[
j
];
}
numOfRows
+=
1
;
numOfRows
+=
1
;
j
+=
1
;
}
break
;
case
TSDB_DATA_TYPE_FLOAT
:
case
TSDB_DATA_TYPE_INT
:
case
TSDB_DATA_TYPE_UINT
:
while
(
j
<
totalRows
)
{
if
(
pIndicator
[
j
]
==
0
)
{
j
+=
1
;
continue
;
}
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
case
TSDB_DATA_TYPE_USMALLINT
:
while
(
j
<
totalRows
)
{
if
(
pIndicator
[
j
]
==
0
)
{
j
+=
1
;
continue
;
}
if
(
colDataIsNull_f
(
pBitmap
,
j
))
{
colDataAppendNULL
(
pDst
,
numOfRows
);
}
else
{
((
int16_t
*
)
pDst
->
pData
)[
numOfRows
++
]
=
((
int16_t
*
)
pDst
->
pData
)[
j
];
}
numOfRows
+=
1
;
if
(
colDataIsNull_f
(
pBitmap
,
j
))
{
colDataSetNull_f
(
pDst
->
nullbitmap
,
numOfRows
);
}
else
{
((
int32_t
*
)
pDst
->
pData
)[
numOfRows
++
]
=
((
int32_t
*
)
pDst
->
pData
)[
j
];
}
numOfRows
+=
1
;
j
+=
1
;
}
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
case
TSDB_DATA_TYPE_USMALLINT
:
while
(
j
<
totalRows
)
{
if
(
pIndicator
[
j
]
==
0
)
{
j
+=
1
;
continue
;
}
if
(
colDataIsNull_f
(
pBitmap
,
j
))
{
colDataSetNull_f
(
pDst
->
nullbitmap
,
numOfRows
);
}
else
{
((
int16_t
*
)
pDst
->
pData
)[
numOfRows
++
]
=
((
int16_t
*
)
pDst
->
pData
)[
j
];
}
break
;
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_UTINYINT
:
while
(
j
<
totalRows
)
{
if
(
pIndicator
[
j
]
==
0
)
{
j
+=
1
;
continue
;
}
if
(
colDataIsNull_f
(
pBitmap
,
j
))
{
colDataAppendNULL
(
pDst
,
numOfRows
);
}
else
{
((
int8_t
*
)
pDst
->
pData
)[
numOfRows
]
=
((
int8_t
*
)
pDst
->
pData
)[
j
];
}
numOfRows
+=
1
;
numOfRows
+=
1
;
j
+=
1
;
}
break
;
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_UTINYINT
:
while
(
j
<
totalRows
)
{
if
(
pIndicator
[
j
]
==
0
)
{
j
+=
1
;
continue
;
}
break
;
}
};
if
(
colDataIsNull_f
(
pBitmap
,
j
))
{
colDataSetNull_f
(
pDst
->
nullbitmap
,
numOfRows
);
}
else
{
((
int8_t
*
)
pDst
->
pData
)[
numOfRows
]
=
((
int8_t
*
)
pDst
->
pData
)[
j
];
}
numOfRows
+=
1
;
j
+=
1
;
}
break
;
}
}
// todo this value can be assigned directly
if
(
pBlock
->
info
.
rows
==
totalRows
)
{
pBlock
->
info
.
rows
=
numOfRows
;
}
else
{
ASSERT
(
pBlock
->
info
.
rows
==
numOfRows
);
if
(
maxRows
<
numOfRows
)
{
maxRows
=
numOfRows
;
}
}
pBlock
->
info
.
rows
=
maxRows
;
if
(
pBitmap
!=
NULL
)
{
taosMemoryFree
(
pBitmap
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录