Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
c16ab5b3
M
milvus
项目概览
milvus
/
milvus
接近 1 年 前同步成功
通知
261
Star
22476
Fork
2472
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
c16ab5b3
编写于
9月 15, 2021
作者:
C
Cai Yudong
提交者:
GitHub
9月 15, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use better segcoe variable name (#7869)
Signed-off-by:
N
yudong.cai
<
yudong.cai@zilliz.com
>
上级
c72cff2d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
13 deletion
+13
-13
internal/core/src/segcore/InsertRecord.h
internal/core/src/segcore/InsertRecord.h
+4
-4
internal/core/src/segcore/SegmentSealedImpl.cpp
internal/core/src/segcore/SegmentSealedImpl.cpp
+8
-8
internal/core/src/segcore/SegmentSealedImpl.h
internal/core/src/segcore/SegmentSealedImpl.h
+1
-1
未找到文件。
internal/core/src/segcore/InsertRecord.h
浏览文件 @
c16ab5b3
...
@@ -29,7 +29,7 @@ struct InsertRecord {
...
@@ -29,7 +29,7 @@ struct InsertRecord {
// get field data without knowing the type
// get field data without knowing the type
VectorBase
*
VectorBase
*
get_field_data_base
(
FieldOffset
field_offset
)
const
{
get_field_data_base
(
FieldOffset
field_offset
)
const
{
auto
ptr
=
field
_datas
_
[
field_offset
.
get
()].
get
();
auto
ptr
=
field
s_data
_
[
field_offset
.
get
()].
get
();
return
ptr
;
return
ptr
;
}
}
...
@@ -58,7 +58,7 @@ struct InsertRecord {
...
@@ -58,7 +58,7 @@ struct InsertRecord {
void
void
append_field_data
(
int64_t
size_per_chunk
)
{
append_field_data
(
int64_t
size_per_chunk
)
{
static_assert
(
std
::
is_fundamental_v
<
Type
>
);
static_assert
(
std
::
is_fundamental_v
<
Type
>
);
field
_datas
_
.
emplace_back
(
std
::
make_unique
<
ConcurrentVector
<
Type
>>
(
size_per_chunk
));
field
s_data
_
.
emplace_back
(
std
::
make_unique
<
ConcurrentVector
<
Type
>>
(
size_per_chunk
));
}
}
// append a column of vector type
// append a column of vector type
...
@@ -66,10 +66,10 @@ struct InsertRecord {
...
@@ -66,10 +66,10 @@ struct InsertRecord {
void
void
append_field_data
(
int64_t
dim
,
int64_t
size_per_chunk
)
{
append_field_data
(
int64_t
dim
,
int64_t
size_per_chunk
)
{
static_assert
(
std
::
is_base_of_v
<
VectorTrait
,
VectorType
>
);
static_assert
(
std
::
is_base_of_v
<
VectorTrait
,
VectorType
>
);
field
_datas
_
.
emplace_back
(
std
::
make_unique
<
ConcurrentVector
<
VectorType
>>
(
dim
,
size_per_chunk
));
field
s_data
_
.
emplace_back
(
std
::
make_unique
<
ConcurrentVector
<
VectorType
>>
(
dim
,
size_per_chunk
));
}
}
private:
private:
std
::
vector
<
std
::
unique_ptr
<
VectorBase
>>
field
_datas
_
;
std
::
vector
<
std
::
unique_ptr
<
VectorBase
>>
field
s_data
_
;
};
};
}
// namespace milvus::segcore
}
// namespace milvus::segcore
internal/core/src/segcore/SegmentSealedImpl.cpp
浏览文件 @
c16ab5b3
...
@@ -139,14 +139,14 @@ SegmentSealedImpl::LoadFieldData(const LoadFieldDataInfo& info) {
...
@@ -139,14 +139,14 @@ SegmentSealedImpl::LoadFieldData(const LoadFieldDataInfo& info) {
// write data under lock
// write data under lock
std
::
unique_lock
lck
(
mutex_
);
std
::
unique_lock
lck
(
mutex_
);
update_row_count
(
info
.
row_count
);
update_row_count
(
info
.
row_count
);
AssertInfo
(
field
_datas
_
[
field_offset
.
get
()].
empty
(),
"field data already exists"
);
AssertInfo
(
field
s_data
_
[
field_offset
.
get
()].
empty
(),
"field data already exists"
);
if
(
field_meta
.
is_vector
())
{
if
(
field_meta
.
is_vector
())
{
AssertInfo
(
!
vecindexs_
.
is_ready
(
field_offset
),
"field data can't be loaded when indexing exists"
);
AssertInfo
(
!
vecindexs_
.
is_ready
(
field_offset
),
"field data can't be loaded when indexing exists"
);
field
_datas
_
[
field_offset
.
get
()]
=
std
::
move
(
vec_data
);
field
s_data
_
[
field_offset
.
get
()]
=
std
::
move
(
vec_data
);
}
else
{
}
else
{
AssertInfo
(
!
scalar_indexings_
[
field_offset
.
get
()],
"scalar indexing not cleared"
);
AssertInfo
(
!
scalar_indexings_
[
field_offset
.
get
()],
"scalar indexing not cleared"
);
field
_datas
_
[
field_offset
.
get
()]
=
std
::
move
(
vec_data
);
field
s_data
_
[
field_offset
.
get
()]
=
std
::
move
(
vec_data
);
scalar_indexings_
[
field_offset
.
get
()]
=
std
::
move
(
index
);
scalar_indexings_
[
field_offset
.
get
()]
=
std
::
move
(
index
);
}
}
...
@@ -180,7 +180,7 @@ SegmentSealedImpl::chunk_data_impl(FieldOffset field_offset, int64_t chunk_id) c
...
@@ -180,7 +180,7 @@ SegmentSealedImpl::chunk_data_impl(FieldOffset field_offset, int64_t chunk_id) c
"Can't get bitset element at "
+
std
::
to_string
(
field_offset
.
get
()));
"Can't get bitset element at "
+
std
::
to_string
(
field_offset
.
get
()));
auto
&
field_meta
=
schema_
->
operator
[](
field_offset
);
auto
&
field_meta
=
schema_
->
operator
[](
field_offset
);
auto
element_sizeof
=
field_meta
.
get_sizeof
();
auto
element_sizeof
=
field_meta
.
get_sizeof
();
SpanBase
base
(
field
_datas
_
[
field_offset
.
get
()].
data
(),
row_count_opt_
.
value
(),
element_sizeof
);
SpanBase
base
(
field
s_data
_
[
field_offset
.
get
()].
data
(),
row_count_opt_
.
value
(),
element_sizeof
);
return
base
;
return
base
;
}
}
...
@@ -245,7 +245,7 @@ SegmentSealedImpl::vector_search(int64_t vec_count,
...
@@ -245,7 +245,7 @@ SegmentSealedImpl::vector_search(int64_t vec_count,
"Can't get bitset element at "
+
std
::
to_string
(
field_offset
.
get
()));
"Can't get bitset element at "
+
std
::
to_string
(
field_offset
.
get
()));
AssertInfo
(
row_count_opt_
.
has_value
(),
"Can't get row count value"
);
AssertInfo
(
row_count_opt_
.
has_value
(),
"Can't get row count value"
);
auto
row_count
=
row_count_opt_
.
value
();
auto
row_count
=
row_count_opt_
.
value
();
auto
chunk_data
=
field
_datas
_
[
field_offset
.
get
()].
data
();
auto
chunk_data
=
field
s_data
_
[
field_offset
.
get
()].
data
();
auto
sub_qr
=
[
&
]
{
auto
sub_qr
=
[
&
]
{
if
(
field_meta
.
get_data_type
()
==
DataType
::
VECTOR_FLOAT
)
{
if
(
field_meta
.
get_data_type
()
==
DataType
::
VECTOR_FLOAT
)
{
...
@@ -283,7 +283,7 @@ SegmentSealedImpl::DropFieldData(const FieldId field_id) {
...
@@ -283,7 +283,7 @@ SegmentSealedImpl::DropFieldData(const FieldId field_id) {
std
::
unique_lock
lck
(
mutex_
);
std
::
unique_lock
lck
(
mutex_
);
set_bit
(
field_data_ready_bitset_
,
field_offset
,
false
);
set_bit
(
field_data_ready_bitset_
,
field_offset
,
false
);
auto
vec
=
std
::
move
(
field
_datas
_
[
field_offset
.
get
()]);
auto
vec
=
std
::
move
(
field
s_data
_
[
field_offset
.
get
()]);
lck
.
unlock
();
lck
.
unlock
();
vec
.
clear
();
vec
.
clear
();
...
@@ -328,7 +328,7 @@ SegmentSealedImpl::check_search(const query::Plan* plan) const {
...
@@ -328,7 +328,7 @@ SegmentSealedImpl::check_search(const query::Plan* plan) const {
SegmentSealedImpl
::
SegmentSealedImpl
(
SchemaPtr
schema
)
SegmentSealedImpl
::
SegmentSealedImpl
(
SchemaPtr
schema
)
:
schema_
(
schema
),
:
schema_
(
schema
),
field
_datas
_
(
schema
->
size
()),
field
s_data
_
(
schema
->
size
()),
field_data_ready_bitset_
(
schema
->
size
()),
field_data_ready_bitset_
(
schema
->
size
()),
vecindex_ready_bitset_
(
schema
->
size
()),
vecindex_ready_bitset_
(
schema
->
size
()),
scalar_indexings_
(
schema
->
size
())
{
scalar_indexings_
(
schema
->
size
())
{
...
@@ -384,7 +384,7 @@ SegmentSealedImpl::bulk_subscript(FieldOffset field_offset,
...
@@ -384,7 +384,7 @@ SegmentSealedImpl::bulk_subscript(FieldOffset field_offset,
return
;
return
;
}
}
auto
&
field_meta
=
schema_
->
operator
[](
field_offset
);
auto
&
field_meta
=
schema_
->
operator
[](
field_offset
);
auto
src_vec
=
field
_datas
_
[
field_offset
.
get
()].
data
();
auto
src_vec
=
field
s_data
_
[
field_offset
.
get
()].
data
();
switch
(
field_meta
.
get_data_type
())
{
switch
(
field_meta
.
get_data_type
())
{
case
DataType
::
BOOL
:
{
case
DataType
::
BOOL
:
{
bulk_subscript_impl
<
bool
>
(
src_vec
,
seg_offsets
,
count
,
output
);
bulk_subscript_impl
<
bool
>
(
src_vec
,
seg_offsets
,
count
,
output
);
...
...
internal/core/src/segcore/SegmentSealedImpl.h
浏览文件 @
c16ab5b3
...
@@ -147,7 +147,7 @@ class SegmentSealedImpl : public SegmentSealed {
...
@@ -147,7 +147,7 @@ class SegmentSealedImpl : public SegmentSealed {
std
::
vector
<
std
::
unique_ptr
<
knowhere
::
Index
>>
scalar_indexings_
;
std
::
vector
<
std
::
unique_ptr
<
knowhere
::
Index
>>
scalar_indexings_
;
std
::
unique_ptr
<
ScalarIndexBase
>
primary_key_index_
;
std
::
unique_ptr
<
ScalarIndexBase
>
primary_key_index_
;
std
::
vector
<
aligned_vector
<
char
>>
field
_datas
_
;
std
::
vector
<
aligned_vector
<
char
>>
field
s_data
_
;
SealedIndexingRecord
vecindexs_
;
SealedIndexingRecord
vecindexs_
;
aligned_vector
<
idx_t
>
row_ids_
;
aligned_vector
<
idx_t
>
row_ids_
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录