Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
26a6e1b9
M
milvus
项目概览
milvus
/
milvus
9 个月 前同步成功
通知
260
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
26a6e1b9
编写于
6月 16, 2023
作者:
J
Jiquan Long
提交者:
GitHub
6月 16, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix BinaryRange expression on integer overflow case (#24920)
Signed-off-by:
N
longjiquan
<
jiquan.long@zilliz.com
>
上级
d186f358
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
15 deletion
+30
-15
internal/core/src/query/PlanProto.cpp
internal/core/src/query/PlanProto.cpp
+6
-12
internal/core/src/query/visitors/ExecExprVisitor.cpp
internal/core/src/query/visitors/ExecExprVisitor.cpp
+23
-2
internal/core/unittest/test_query.cpp
internal/core/unittest/test_query.cpp
+1
-1
未找到文件。
internal/core/src/query/PlanProto.cpp
浏览文件 @
26a6e1b9
...
...
@@ -342,22 +342,16 @@ ProtoParser::ParseBinaryRangeExpr(const proto::plan::BinaryRangeExpr& expr_pb) {
return
ExtractBinaryRangeExprImpl
<
bool
>
(
field_id
,
data_type
,
expr_pb
);
}
case
DataType
::
INT8
:
{
return
ExtractBinaryRangeExprImpl
<
int8_t
>
(
field_id
,
data_type
,
expr_pb
);
}
case
DataType
::
INT16
:
{
return
ExtractBinaryRangeExprImpl
<
int16_t
>
(
field_id
,
data_type
,
expr_pb
);
}
case
DataType
::
INT32
:
{
return
ExtractBinaryRangeExprImpl
<
int32_t
>
(
field_id
,
data_type
,
expr_pb
);
}
// see also: https://github.com/milvus-io/milvus/issues/23646.
case
DataType
::
INT8
:
case
DataType
::
INT16
:
case
DataType
::
INT32
:
case
DataType
::
INT64
:
{
return
ExtractBinaryRangeExprImpl
<
int64_t
>
(
field_id
,
data_type
,
expr_pb
);
}
case
DataType
::
FLOAT
:
{
return
ExtractBinaryRangeExprImpl
<
float
>
(
field_id
,
data_type
,
expr_pb
);
...
...
internal/core/src/query/visitors/ExecExprVisitor.cpp
浏览文件 @
26a6e1b9
...
...
@@ -939,12 +939,33 @@ ExecExprVisitor::ExecBinaryRangeVisitorDispatcher(BinaryRangeExpr& expr_raw)
bool
lower_inclusive
=
expr
.
lower_inclusive_
;
bool
upper_inclusive
=
expr
.
upper_inclusive_
;
IndexInnerType
val1
=
expr
.
lower_value_
;
IndexInnerType
val2
=
expr
.
upper_value_
;
// see also: https://github.com/milvus-io/milvus/issues/23646.
typedef
std
::
conditional_t
<
std
::
is_integral_v
<
IndexInnerType
>
,
int64_t
,
IndexInnerType
>
HighPrecisionType
;
auto
val1
=
static_cast
<
HighPrecisionType
>
(
expr
.
lower_value_
);
auto
val2
=
static_cast
<
HighPrecisionType
>
(
expr
.
upper_value_
);
auto
index_func
=
[
&
](
Index
*
index
)
{
if
constexpr
(
std
::
is_integral_v
<
T
>
)
{
if
(
gt_ub
<
T
>
(
val1
))
{
return
TargetBitmap
(
index
->
Size
(),
false
);
}
else
if
(
lt_lb
<
T
>
(
val1
))
{
val1
=
std
::
numeric_limits
<
T
>::
min
();
}
if
(
gt_ub
<
T
>
(
val2
))
{
val2
=
std
::
numeric_limits
<
T
>::
max
();
}
else
if
(
lt_lb
<
T
>
(
val2
))
{
return
TargetBitmap
(
index
->
Size
(),
false
);
}
}
return
index
->
Range
(
val1
,
lower_inclusive
,
val2
,
upper_inclusive
);
};
if
(
lower_inclusive
&&
upper_inclusive
)
{
auto
elem_func
=
[
val1
,
val2
](
MayConstRef
<
T
>
x
)
{
return
(
val1
<=
x
&&
x
<=
val2
);
...
...
internal/core/unittest/test_query.cpp
浏览文件 @
26a6e1b9
...
...
@@ -701,7 +701,7 @@ TEST(Query, FillSegment) {
auto
dataset
=
DataGen
(
schema
,
N
);
const
auto
std_vec
=
dataset
.
get_col
<
int64_t
>
(
FieldId
(
101
));
// ids field
const
auto
std_vfloat_vec
=
dataset
.
get_col
<
float
>
(
FieldId
(
100
));
// vector field
dataset
.
get_col
<
float
>
(
FieldId
(
100
));
// vector field
const
auto
std_i32_vec
=
dataset
.
get_col
<
int32_t
>
(
FieldId
(
102
));
// scalar field
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录