Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions be/src/storage/delete/delete_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ std::string construct_sub_predicate(const TCondition& condition) {
}

// make operators from FE adaptive to BE
std::string trans_op(const std::string& opt) {
std::string trans_op(const std::string& opt, const std::string& condition_value = "") {
std::string op = string(opt);
if (op == "<") {
op += "<";
Expand All @@ -237,6 +237,8 @@ std::string trans_op(const std::string& opt) {
op = "=";
} else if (op == "!*=") {
op = "!=";
} else if (op == "<=>") {
op = iequal(condition_value, "NULL") ? "IS" : "=";
}
}
return op;
Expand Down Expand Up @@ -487,7 +489,8 @@ DeleteHandler::ConditionParseResult DeleteHandler::parse_condition(
}
res.column_name = sub_cond.column_name();
res.value_str.push_back(sub_cond.cond_value());
res.condition_op = parse_condition_op(sub_cond.op(), res.value_str);
auto norm_op = trans_op(sub_cond.op(), sub_cond.cond_value());
res.condition_op = parse_condition_op(norm_op, res.value_str);
return res;
}

Expand Down
3 changes: 3 additions & 0 deletions regression-test/data/delete_p0/test_delete_nullsafe_eq.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !after_delete --
2 20
45 changes: 45 additions & 0 deletions regression-test/suites/delete_p0/test_delete_nullsafe_eq.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

suite("test_delete_nullsafe_eq", "delete_p0") {
sql "DROP TABLE IF EXISTS test_delete_nullsafe_eq"

sql """
CREATE TABLE test_delete_nullsafe_eq (
k1 INT,
v1 INT
)
DUPLICATE KEY(k1)
DISTRIBUTED BY HASH(k1) BUCKETS 1
PROPERTIES(
"replication_num" = "1",
"disable_auto_compaction" = "true"
)
"""

sql """INSERT INTO test_delete_nullsafe_eq VALUES (1, 10), (2, 20)"""

try {
sql """SET delete_without_partition = true"""
sql """DELETE FROM test_delete_nullsafe_eq WHERE k1 <=> 1"""
sql """SYNC"""

order_qt_after_delete """SELECT * FROM test_delete_nullsafe_eq ORDER BY k1"""
} finally {
sql """SET delete_without_partition = false"""
}
}
Loading