Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
bcc4bbde
milvus
项目概览
BaiXuePrincess
/
milvus
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bcc4bbde
编写于
10月 18, 2019
作者:
S
starlord
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
format code
Former-commit-id: 993b88487da976f809fdb29ffb07cdb0188a16f7
上级
92a21ec3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
33 addition
and
25 deletion
+33
-25
core/src/server/grpc_impl/GrpcRequestTask.cpp
core/src/server/grpc_impl/GrpcRequestTask.cpp
+18
-10
core/src/utils/ValidationUtil.cpp
core/src/utils/ValidationUtil.cpp
+15
-15
未找到文件。
core/src/server/grpc_impl/GrpcRequestTask.cpp
浏览文件 @
bcc4bbde
...
...
@@ -114,9 +114,11 @@ ConvertTimeRangeToDBDates(const std::vector<::milvus::grpc::Range>& range_array,
return
Status
::
OK
();
}
std
::
string
TableNotExistMsg
(
const
std
::
string
&
table_name
)
{
return
"Table "
+
table_name
+
" not exist. Use milvus.has_table to verify whether the table exists. You also can check if the table name exists."
;
std
::
string
TableNotExistMsg
(
const
std
::
string
&
table_name
)
{
return
"Table "
+
table_name
+
" not exist. Use milvus.has_table to verify whether the table exists. You also can check if the table name "
"exists."
;
}
}
// namespace
...
...
@@ -426,12 +428,14 @@ InsertTask::OnExecute() {
return
status
;
}
if
(
insert_param_
->
row_record_array
().
empty
())
{
return
Status
(
SERVER_INVALID_ROWRECORD_ARRAY
,
"The vector array is empty. Make sure you have entered vector records."
);
return
Status
(
SERVER_INVALID_ROWRECORD_ARRAY
,
"The vector array is empty. Make sure you have entered vector records."
);
}
if
(
!
insert_param_
->
row_id_array
().
empty
())
{
if
(
insert_param_
->
row_id_array
().
size
()
!=
insert_param_
->
row_record_array_size
())
{
return
Status
(
SERVER_ILLEGAL_VECTOR_ID
,
"The size of vector ID array must be equal to the size of the vector."
);
return
Status
(
SERVER_ILLEGAL_VECTOR_ID
,
"The size of vector ID array must be equal to the size of the vector."
);
}
}
...
...
@@ -458,8 +462,9 @@ InsertTask::OnExecute() {
// user didn't provided id before, no need to provide user id
if
((
table_info
.
flag_
&
engine
::
meta
::
FLAG_MASK_NO_USERID
)
!=
0
&&
user_provide_ids
)
{
return
Status
(
SERVER_ILLEGAL_VECTOR_ID
,
"Table vector IDs are auto-generated. All vectors of this table must use auto-generated IDs."
);
return
Status
(
SERVER_ILLEGAL_VECTOR_ID
,
"Table vector IDs are auto-generated. All vectors of this table must use auto-generated IDs."
);
}
rc
.
RecordSection
(
"check validation"
);
...
...
@@ -476,7 +481,8 @@ InsertTask::OnExecute() {
// TODO(yk): change to one dimension array or use multiple-thread to copy the data
for
(
size_t
i
=
0
;
i
<
insert_param_
->
row_record_array_size
();
i
++
)
{
if
(
insert_param_
->
row_record_array
(
i
).
vector_data
().
empty
())
{
return
Status
(
SERVER_INVALID_ROWRECORD_ARRAY
,
"The vector dimension must be equal to the table dimension."
);
return
Status
(
SERVER_INVALID_ROWRECORD_ARRAY
,
"The vector dimension must be equal to the table dimension."
);
}
uint64_t
vec_dim
=
insert_param_
->
row_record_array
(
i
).
vector_data
().
size
();
if
(
vec_dim
!=
table_info
.
dimension_
)
{
...
...
@@ -592,7 +598,8 @@ SearchTask::OnExecute() {
}
if
(
search_param_
->
query_record_array
().
empty
())
{
return
Status
(
SERVER_INVALID_ROWRECORD_ARRAY
,
"The vector array is empty. Make sure you have entered vector records."
);
return
Status
(
SERVER_INVALID_ROWRECORD_ARRAY
,
"The vector array is empty. Make sure you have entered vector records."
);
}
// step 4: check date range, and convert to db dates
...
...
@@ -614,7 +621,8 @@ SearchTask::OnExecute() {
std
::
vector
<
float
>
vec_f
(
record_array_size
*
table_info
.
dimension_
,
0
);
for
(
size_t
i
=
0
;
i
<
record_array_size
;
i
++
)
{
if
(
search_param_
->
query_record_array
(
i
).
vector_data
().
empty
())
{
return
Status
(
SERVER_INVALID_ROWRECORD_ARRAY
,
"The vector dimension must be equal to the table dimension."
);
return
Status
(
SERVER_INVALID_ROWRECORD_ARRAY
,
"The vector dimension must be equal to the table dimension."
);
}
uint64_t
query_vec_dim
=
search_param_
->
query_record_array
(
i
).
vector_data
().
size
();
if
(
query_vec_dim
!=
table_info
.
dimension_
)
{
...
...
core/src/utils/ValidationUtil.cpp
浏览文件 @
bcc4bbde
...
...
@@ -74,8 +74,8 @@ ValidationUtil::ValidateTableName(const std::string& table_name) {
Status
ValidationUtil
::
ValidateTableDimension
(
int64_t
dimension
)
{
if
(
dimension
<=
0
||
dimension
>
TABLE_DIMENSION_LIMIT
)
{
std
::
string
msg
=
"Invalid table dimension: "
+
std
::
to_string
(
dimension
)
+
". "
+
"The table dimension must be within the range of 1 ~ 16384."
;
std
::
string
msg
=
"Invalid table dimension: "
+
std
::
to_string
(
dimension
)
+
". "
+
"The table dimension must be within the range of 1 ~ 16384."
;
SERVER_LOG_ERROR
<<
msg
;
return
Status
(
SERVER_INVALID_VECTOR_DIMENSION
,
msg
);
}
else
{
...
...
@@ -87,8 +87,8 @@ Status
ValidationUtil
::
ValidateTableIndexType
(
int32_t
index_type
)
{
int
engine_type
=
static_cast
<
int
>
(
engine
::
EngineType
(
index_type
));
if
(
engine_type
<=
0
||
engine_type
>
static_cast
<
int
>
(
engine
::
EngineType
::
MAX_VALUE
))
{
std
::
string
msg
=
"Invalid index type: "
+
std
::
to_string
(
index_type
)
+
". "
+
"Make sure the index type is in IndexType list."
;
std
::
string
msg
=
"Invalid index type: "
+
std
::
to_string
(
index_type
)
+
". "
+
"Make sure the index type is in IndexType list."
;
SERVER_LOG_ERROR
<<
msg
;
return
Status
(
SERVER_INVALID_INDEX_TYPE
,
msg
);
}
...
...
@@ -108,8 +108,8 @@ ValidationUtil::ValidateTableIndexType(int32_t index_type) {
Status
ValidationUtil
::
ValidateTableIndexNlist
(
int32_t
nlist
)
{
if
(
nlist
<=
0
)
{
std
::
string
msg
=
"Invalid index nlist: "
+
std
::
to_string
(
nlist
)
+
". "
+
"The index nlist must be greater than 0."
;
std
::
string
msg
=
"Invalid index nlist: "
+
std
::
to_string
(
nlist
)
+
". "
+
"The index nlist must be greater than 0."
;
SERVER_LOG_ERROR
<<
msg
;
return
Status
(
SERVER_INVALID_INDEX_NLIST
,
msg
);
}
...
...
@@ -120,9 +120,9 @@ ValidationUtil::ValidateTableIndexNlist(int32_t nlist) {
Status
ValidationUtil
::
ValidateTableIndexFileSize
(
int64_t
index_file_size
)
{
if
(
index_file_size
<=
0
||
index_file_size
>
INDEX_FILE_SIZE_LIMIT
)
{
std
::
string
msg
=
"Invalid index file size: "
+
std
::
to_string
(
index_file_size
)
+
". "
+
"The index file size must be within the range of 1 ~ "
+
std
::
to_string
(
INDEX_FILE_SIZE_LIMIT
)
+
"."
;
std
::
string
msg
=
"Invalid index file size: "
+
std
::
to_string
(
index_file_size
)
+
". "
+
"The index file size must be within the range of 1 ~ "
+
std
::
to_string
(
INDEX_FILE_SIZE_LIMIT
)
+
"."
;
SERVER_LOG_ERROR
<<
msg
;
return
Status
(
SERVER_INVALID_INDEX_FILE_SIZE
,
msg
);
}
...
...
@@ -134,8 +134,8 @@ Status
ValidationUtil
::
ValidateTableIndexMetricType
(
int32_t
metric_type
)
{
if
(
metric_type
!=
static_cast
<
int32_t
>
(
engine
::
MetricType
::
L2
)
&&
metric_type
!=
static_cast
<
int32_t
>
(
engine
::
MetricType
::
IP
))
{
std
::
string
msg
=
"Invalid index metric type: "
+
std
::
to_string
(
metric_type
)
+
". "
+
"Make sure the metric type is either MetricType.L2 or MetricType.IP."
;
std
::
string
msg
=
"Invalid index metric type: "
+
std
::
to_string
(
metric_type
)
+
". "
+
"Make sure the metric type is either MetricType.L2 or MetricType.IP."
;
SERVER_LOG_ERROR
<<
msg
;
return
Status
(
SERVER_INVALID_INDEX_METRIC_TYPE
,
msg
);
}
...
...
@@ -145,8 +145,8 @@ ValidationUtil::ValidateTableIndexMetricType(int32_t metric_type) {
Status
ValidationUtil
::
ValidateSearchTopk
(
int64_t
top_k
,
const
engine
::
meta
::
TableSchema
&
table_schema
)
{
if
(
top_k
<=
0
||
top_k
>
2048
)
{
std
::
string
msg
=
"Invalid topk: "
+
std
::
to_string
(
top_k
)
+
". "
+
"The topk must be within the range of 1 ~ 2048."
;
std
::
string
msg
=
"Invalid topk: "
+
std
::
to_string
(
top_k
)
+
". "
+
"The topk must be within the range of 1 ~ 2048."
;
SERVER_LOG_ERROR
<<
msg
;
return
Status
(
SERVER_INVALID_TOPK
,
msg
);
}
...
...
@@ -157,8 +157,8 @@ ValidationUtil::ValidateSearchTopk(int64_t top_k, const engine::meta::TableSchem
Status
ValidationUtil
::
ValidateSearchNprobe
(
int64_t
nprobe
,
const
engine
::
meta
::
TableSchema
&
table_schema
)
{
if
(
nprobe
<=
0
||
nprobe
>
table_schema
.
nlist_
)
{
std
::
string
msg
=
"Invalid nprobe: "
+
std
::
to_string
(
nprobe
)
+
". "
+
"The nprobe must be within the range of 1 ~ index nlist."
;
std
::
string
msg
=
"Invalid nprobe: "
+
std
::
to_string
(
nprobe
)
+
". "
+
"The nprobe must be within the range of 1 ~ index nlist."
;
SERVER_LOG_ERROR
<<
msg
;
return
Status
(
SERVER_INVALID_NPROBE
,
msg
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录