Skip to content

Commit

Permalink
add jsonkeyindex unitest
Browse files Browse the repository at this point in the history
Signed-off-by: Xianhui.Lin <[email protected]>
  • Loading branch information
JsDove committed Jan 20, 2025
1 parent 36ac66b commit b4e690a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 23 deletions.
9 changes: 7 additions & 2 deletions internal/core/src/exec/expression/UnaryExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -964,8 +964,13 @@ PhyUnaryRangeFilterExpr::ExecRangeVisitorImplJsonForIndex() {
}
return !CompareTwoJsonArray(array.value(), val);
} else {
UnaryRangeJSONIndexCompareNotEqual(
ExprValueType(x.value()) != val);
if (!arrayIndex.empty()) {
UnaryRangeJSONIndexCompareWithArrayIndex(
ExprValueType(x.value()) != val);
} else {
UnaryRangeJSONIndexCompareNotEqual(
ExprValueType(x.value()) != val);
}
}
case proto::plan::PrefixMatch:
if constexpr (std::is_same_v<GetType, proto::plan::Array>) {
Expand Down
46 changes: 25 additions & 21 deletions internal/core/unittest/test_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1230,16 +1230,17 @@ TEST_P(ExprTest, TestUnaryRangeJson) {
int64_t val;
std::vector<std::string> nested_path;
};
std::vector<Testcase> testcases{
{10, {"int"}},
{20, {"int"}},
{30, {"int"}},
{40, {"int"}},
{10, {"double"}},
{20, {"double"}},
{30, {"double"}},
{40, {"double"}},
};
std::vector<Testcase> testcases{{10, {"int"}},
{20, {"int"}},
{30, {"int"}},
{40, {"int"}},
{10, {"double"}},
{20, {"double"}},
{30, {"double"}},
{40, {"double"}},
{1, {"array", "0"}},
{2, {"array", "1"}},
{3, {"array", "2"}}};

auto schema = std::make_shared<Schema>();
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
Expand Down Expand Up @@ -1341,11 +1342,13 @@ TEST_P(ExprTest, TestUnaryRangeJson) {

for (int i = 0; i < N * num_iters; ++i) {
auto ans = final[i];
if (testcase.nested_path[0] == "int") {
if (testcase.nested_path[0] == "int" ||
testcase.nested_path[0] == "array") {
auto val =
milvus::Json(simdjson::padded_string(json_col[i]))
.template at<int64_t>(pointer)
.value();

auto ref = f(val);
ASSERT_EQ(ans, ref);
if (i % 2 == 0) {
Expand Down Expand Up @@ -1442,16 +1445,17 @@ TEST_P(ExprTest, TestUnaryRangeJsonNullable) {
int64_t val;
std::vector<std::string> nested_path;
};
std::vector<Testcase> testcases{
{10, {"int"}},
{20, {"int"}},
{30, {"int"}},
{40, {"int"}},
{10, {"double"}},
{20, {"double"}},
{30, {"double"}},
{40, {"double"}},
};
std::vector<Testcase> testcases{{10, {"int"}},
{20, {"int"}},
{30, {"int"}},
{40, {"int"}},
{10, {"double"}},
{20, {"double"}},
{30, {"double"}},
{40, {"double"}},
{1, {"array", "0"}},
{2, {"array", "1"}},
{3, {"array", "2"}}};

auto schema = std::make_shared<Schema>();
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
Expand Down
1 change: 1 addition & 0 deletions tests/python_client/testcases/test_compaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,7 @@ def test_compact_cross_partition(self):
assert len(plan.sources) == 1

@pytest.mark.tags(CaseLabel.L1)
@pytest.mark.skip("https://github.com/milvus-io/milvus/issues/31258")
def test_compact_during_insert(self):
"""
target: test compact during insert and flush
Expand Down

0 comments on commit b4e690a

Please sign in to comment.