fix: [2.5] Json Stats filter the data is double but the filter expr is int (#40771)

Json Stats  filter the data is double but the filter is int 
issue: https://github.com/milvus-io/milvus/issues/40707
master-pr:https://github.com/milvus-io/milvus/pull/38039

Signed-off-by: Xianhui.Lin <xianhui.lin@zilliz.com>
This commit is contained in:
Xianhui Lin 2025-03-19 20:22:13 +08:00 committed by GitHub
parent cd8d7efc96
commit 2710eb3fc9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 12 deletions

View File

@ -532,26 +532,34 @@ PhyBinaryRangeFilterExpr::ExecRangeVisitorImplForJsonForIndex() {
} while (false)
#define BinaryRangeJSONTypeCompare(cmp) \
do { \
if (type == uint8_t(milvus::index::JSONType::STRING)) { \
if constexpr (std::is_same_v<GetType, std::string_view>) { \
if constexpr (std::is_same_v<GetType, std::string_view>) { \
if (type == uint8_t(milvus::index::JSONType::STRING)) { \
auto val = json.at_string(offset, size); \
return (cmp); \
} else { \
return false; \
} \
} else if (type == uint8_t(milvus::index::JSONType::DOUBLE)) { \
if constexpr (std::is_same_v<GetType, double>) { \
} else if constexpr (std::is_same_v<GetType, double>) { \
if (type == uint8_t(milvus::index::JSONType::INT64)) { \
auto val = \
std::stoll(std::string(json.at_string(offset, size))); \
return (cmp); \
} else if (type == uint8_t(milvus::index::JSONType::DOUBLE)) { \
auto val = \
std::stod(std::string(json.at_string(offset, size))); \
return (cmp); \
} else { \
return false; \
} \
} else if (type == uint8_t(milvus::index::JSONType::INT64)) { \
if constexpr (std::is_same_v<GetType, int64_t>) { \
} else if constexpr (std::is_same_v<GetType, int64_t>) { \
if (type == uint8_t(milvus::index::JSONType::INT64)) { \
auto val = \
std::stoll(std::string(json.at_string(offset, size))); \
return (cmp); \
} else if (type == uint8_t(milvus::index::JSONType::DOUBLE)) { \
auto val = \
std::stod(std::string(json.at_string(offset, size))); \
return (cmp); \
} else { \
return false; \
} \

View File

@ -946,25 +946,32 @@ PhyUnaryRangeFilterExpr::ExecRangeVisitorImplJsonForIndex() {
#define UnaryJSONTypeCompare(cmp) \
do { \
if (type == uint8_t(milvus::index::JSONType::STRING)) { \
if constexpr (std::is_same_v<GetType, std::string_view>) { \
if constexpr (std::is_same_v<GetType, std::string_view>) { \
if (type == uint8_t(milvus::index::JSONType::STRING)) { \
auto x = json.at_string(offset, size); \
return (cmp); \
} else { \
return false; \
} \
} else if (type == uint8_t(milvus::index::JSONType::DOUBLE)) { \
if constexpr (std::is_same_v<GetType, double>) { \
} else if constexpr (std::is_same_v<GetType, double>) { \
if (type == uint8_t(milvus::index::JSONType::INT64)) { \
auto x = \
std::stoll(std::string(json.at_string(offset, size))); \
return (cmp); \
} else if (type == uint8_t(milvus::index::JSONType::DOUBLE)) { \
auto x = std::stod(std::string(json.at_string(offset, size))); \
return (cmp); \
} else { \
return false; \
} \
} else if (type == uint8_t(milvus::index::JSONType::INT64)) { \
if constexpr (std::is_same_v<GetType, int64_t>) { \
} else if constexpr (std::is_same_v<GetType, int64_t>) { \
if (type == uint8_t(milvus::index::JSONType::INT64)) { \
auto x = \
std::stoll(std::string(json.at_string(offset, size))); \
return (cmp); \
} else if (type == uint8_t(milvus::index::JSONType::DOUBLE)) { \
auto x = std::stod(std::string(json.at_string(offset, size))); \
return (cmp); \
} else { \
return false; \
} \