Improve segcore code readability (#7868)

Signed-off-by: yudong.cai <yudong.cai@zilliz.com>
This commit is contained in:
Cai Yudong 2021-09-14 16:07:48 +08:00 committed by GitHub
parent a589572e2d
commit 4dc9a64f01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,8 +27,7 @@ struct InsertRecord {
explicit InsertRecord(const Schema& schema, int64_t size_per_chunk);
// get field data without knowing the type
// return VectorBase type
auto
VectorBase*
get_field_data_base(FieldOffset field_offset) const {
auto ptr = field_datas_[field_offset.get()].get();
return ptr;
@ -36,7 +35,7 @@ struct InsertRecord {
// get field data in given type, const version
template <typename Type>
auto
const ConcurrentVector<Type>*
get_field_data(FieldOffset field_offset) const {
auto base_ptr = get_field_data_base(field_offset);
auto ptr = dynamic_cast<const ConcurrentVector<Type>*>(base_ptr);
@ -44,9 +43,9 @@ struct InsertRecord {
return ptr;
}
// get field data in given type, nonconst version
// get field data in given type, non-const version
template <typename Type>
auto
ConcurrentVector<Type>*
get_field_data(FieldOffset field_offset) {
auto base_ptr = get_field_data_base(field_offset);
auto ptr = dynamic_cast<ConcurrentVector<Type>*>(base_ptr);