mirror of https://github.com/milvus-io/milvus.git
fix: Fix modulo for long type (#39722)
issue: #39640 Signed-off-by: Cai Zhang <cai.zhang@zilliz.com>pull/39807/head
parent
5cdd906d4b
commit
9e6e477c5d
|
@ -148,7 +148,7 @@ struct ArithCompareOperator {
|
||||||
} else if constexpr (AOp == ArithOpType::Div) {
|
} else if constexpr (AOp == ArithOpType::Div) {
|
||||||
return CompareOperator<CmpOp>::compare(left / right, value);
|
return CompareOperator<CmpOp>::compare(left / right, value);
|
||||||
} else if constexpr (AOp == ArithOpType::Mod) {
|
} else if constexpr (AOp == ArithOpType::Mod) {
|
||||||
return CompareOperator<CmpOp>::compare(fmod(left, right), value);
|
return CompareOperator<CmpOp>::compare(long(left) % long(right), value);
|
||||||
} else {
|
} else {
|
||||||
// unimplemented
|
// unimplemented
|
||||||
static_assert(always_false_v<T>, "unimplemented");
|
static_assert(always_false_v<T>, "unimplemented");
|
||||||
|
|
|
@ -122,7 +122,7 @@ struct ArithOpElementFunc {
|
||||||
res[i] = (src[offset] / right_operand) == val;
|
res[i] = (src[offset] / right_operand) == val;
|
||||||
} else if constexpr (arith_op ==
|
} else if constexpr (arith_op ==
|
||||||
proto::plan::ArithOpType::Mod) {
|
proto::plan::ArithOpType::Mod) {
|
||||||
res[i] = (fmod(src[offset], right_operand)) == val;
|
res[i] = (long(src[offset]) % long(right_operand)) == val;
|
||||||
} else {
|
} else {
|
||||||
PanicInfo(OpTypeInvalid,
|
PanicInfo(OpTypeInvalid,
|
||||||
fmt::format("unsupported arith type:{} for "
|
fmt::format("unsupported arith type:{} for "
|
||||||
|
@ -143,7 +143,7 @@ struct ArithOpElementFunc {
|
||||||
res[i] = (src[offset] / right_operand) != val;
|
res[i] = (src[offset] / right_operand) != val;
|
||||||
} else if constexpr (arith_op ==
|
} else if constexpr (arith_op ==
|
||||||
proto::plan::ArithOpType::Mod) {
|
proto::plan::ArithOpType::Mod) {
|
||||||
res[i] = (fmod(src[offset], right_operand)) != val;
|
res[i] = (long(src[offset]) % long(right_operand)) != val;
|
||||||
} else {
|
} else {
|
||||||
PanicInfo(OpTypeInvalid,
|
PanicInfo(OpTypeInvalid,
|
||||||
fmt::format("unsupported arith type:{} for "
|
fmt::format("unsupported arith type:{} for "
|
||||||
|
@ -165,7 +165,7 @@ struct ArithOpElementFunc {
|
||||||
res[i] = (src[offset] / right_operand) > val;
|
res[i] = (src[offset] / right_operand) > val;
|
||||||
} else if constexpr (arith_op ==
|
} else if constexpr (arith_op ==
|
||||||
proto::plan::ArithOpType::Mod) {
|
proto::plan::ArithOpType::Mod) {
|
||||||
res[i] = (fmod(src[offset], right_operand)) > val;
|
res[i] = (long(src[offset]) % long(right_operand)) > val;
|
||||||
} else {
|
} else {
|
||||||
PanicInfo(OpTypeInvalid,
|
PanicInfo(OpTypeInvalid,
|
||||||
fmt::format("unsupported arith type:{} for "
|
fmt::format("unsupported arith type:{} for "
|
||||||
|
@ -187,7 +187,7 @@ struct ArithOpElementFunc {
|
||||||
res[i] = (src[offset] / right_operand) >= val;
|
res[i] = (src[offset] / right_operand) >= val;
|
||||||
} else if constexpr (arith_op ==
|
} else if constexpr (arith_op ==
|
||||||
proto::plan::ArithOpType::Mod) {
|
proto::plan::ArithOpType::Mod) {
|
||||||
res[i] = (fmod(src[offset], right_operand)) >= val;
|
res[i] = (long(src[offset]) % long(right_operand)) >= val;
|
||||||
} else {
|
} else {
|
||||||
PanicInfo(OpTypeInvalid,
|
PanicInfo(OpTypeInvalid,
|
||||||
fmt::format("unsupported arith type:{} for "
|
fmt::format("unsupported arith type:{} for "
|
||||||
|
@ -208,7 +208,7 @@ struct ArithOpElementFunc {
|
||||||
res[i] = (src[offset] / right_operand) < val;
|
res[i] = (src[offset] / right_operand) < val;
|
||||||
} else if constexpr (arith_op ==
|
} else if constexpr (arith_op ==
|
||||||
proto::plan::ArithOpType::Mod) {
|
proto::plan::ArithOpType::Mod) {
|
||||||
res[i] = (fmod(src[offset], right_operand)) < val;
|
res[i] = (long(src[offset]) % long(right_operand)) < val;
|
||||||
} else {
|
} else {
|
||||||
PanicInfo(OpTypeInvalid,
|
PanicInfo(OpTypeInvalid,
|
||||||
fmt::format("unsupported arith type:{} for "
|
fmt::format("unsupported arith type:{} for "
|
||||||
|
@ -229,7 +229,7 @@ struct ArithOpElementFunc {
|
||||||
res[i] = (src[offset] / right_operand) <= val;
|
res[i] = (src[offset] / right_operand) <= val;
|
||||||
} else if constexpr (arith_op ==
|
} else if constexpr (arith_op ==
|
||||||
proto::plan::ArithOpType::Mod) {
|
proto::plan::ArithOpType::Mod) {
|
||||||
res[i] = (fmod(src[offset], right_operand)) <= val;
|
res[i] = (long(src[offset]) % long(right_operand)) <= val;
|
||||||
} else {
|
} else {
|
||||||
PanicInfo(OpTypeInvalid,
|
PanicInfo(OpTypeInvalid,
|
||||||
fmt::format("unsupported arith type:{} for "
|
fmt::format("unsupported arith type:{} for "
|
||||||
|
@ -309,7 +309,7 @@ struct ArithOpIndexFunc {
|
||||||
res[i] = (raw.value() / right_operand) == val;
|
res[i] = (raw.value() / right_operand) == val;
|
||||||
} else if constexpr (arith_op ==
|
} else if constexpr (arith_op ==
|
||||||
proto::plan::ArithOpType::Mod) {
|
proto::plan::ArithOpType::Mod) {
|
||||||
res[i] = (fmod(raw.value(), right_operand)) == val;
|
res[i] = (long(raw.value()) % long(right_operand)) == val;
|
||||||
} else {
|
} else {
|
||||||
PanicInfo(
|
PanicInfo(
|
||||||
OpTypeInvalid,
|
OpTypeInvalid,
|
||||||
|
@ -331,7 +331,7 @@ struct ArithOpIndexFunc {
|
||||||
res[i] = (raw.value() / right_operand) != val;
|
res[i] = (raw.value() / right_operand) != val;
|
||||||
} else if constexpr (arith_op ==
|
} else if constexpr (arith_op ==
|
||||||
proto::plan::ArithOpType::Mod) {
|
proto::plan::ArithOpType::Mod) {
|
||||||
res[i] = (fmod(raw.value(), right_operand)) != val;
|
res[i] = (long(raw.value()) % long(right_operand)) != val;
|
||||||
} else {
|
} else {
|
||||||
PanicInfo(
|
PanicInfo(
|
||||||
OpTypeInvalid,
|
OpTypeInvalid,
|
||||||
|
@ -353,7 +353,7 @@ struct ArithOpIndexFunc {
|
||||||
res[i] = (raw.value() / right_operand) > val;
|
res[i] = (raw.value() / right_operand) > val;
|
||||||
} else if constexpr (arith_op ==
|
} else if constexpr (arith_op ==
|
||||||
proto::plan::ArithOpType::Mod) {
|
proto::plan::ArithOpType::Mod) {
|
||||||
res[i] = (fmod(raw.value(), right_operand)) > val;
|
res[i] = (long(raw.value()) % long(right_operand)) > val;
|
||||||
} else {
|
} else {
|
||||||
PanicInfo(
|
PanicInfo(
|
||||||
OpTypeInvalid,
|
OpTypeInvalid,
|
||||||
|
@ -375,7 +375,7 @@ struct ArithOpIndexFunc {
|
||||||
res[i] = (raw.value() / right_operand) >= val;
|
res[i] = (raw.value() / right_operand) >= val;
|
||||||
} else if constexpr (arith_op ==
|
} else if constexpr (arith_op ==
|
||||||
proto::plan::ArithOpType::Mod) {
|
proto::plan::ArithOpType::Mod) {
|
||||||
res[i] = (fmod(raw.value(), right_operand)) >= val;
|
res[i] = (long(raw.value()) % long(right_operand)) >= val;
|
||||||
} else {
|
} else {
|
||||||
PanicInfo(
|
PanicInfo(
|
||||||
OpTypeInvalid,
|
OpTypeInvalid,
|
||||||
|
@ -397,7 +397,7 @@ struct ArithOpIndexFunc {
|
||||||
res[i] = (raw.value() / right_operand) < val;
|
res[i] = (raw.value() / right_operand) < val;
|
||||||
} else if constexpr (arith_op ==
|
} else if constexpr (arith_op ==
|
||||||
proto::plan::ArithOpType::Mod) {
|
proto::plan::ArithOpType::Mod) {
|
||||||
res[i] = (fmod(raw.value(), right_operand)) < val;
|
res[i] = (long(raw.value()) % long(right_operand)) < val;
|
||||||
} else {
|
} else {
|
||||||
PanicInfo(
|
PanicInfo(
|
||||||
OpTypeInvalid,
|
OpTypeInvalid,
|
||||||
|
@ -419,7 +419,7 @@ struct ArithOpIndexFunc {
|
||||||
res[i] = (raw.value() / right_operand) <= val;
|
res[i] = (raw.value() / right_operand) <= val;
|
||||||
} else if constexpr (arith_op ==
|
} else if constexpr (arith_op ==
|
||||||
proto::plan::ArithOpType::Mod) {
|
proto::plan::ArithOpType::Mod) {
|
||||||
res[i] = (fmod(raw.value(), right_operand)) <= val;
|
res[i] = (long(raw.value()) % long(right_operand)) <= val;
|
||||||
} else {
|
} else {
|
||||||
PanicInfo(
|
PanicInfo(
|
||||||
OpTypeInvalid,
|
OpTypeInvalid,
|
||||||
|
|
Loading…
Reference in New Issue