From e07e27f9ed2b9fc1a839567cb851ab69154d0b22 Mon Sep 17 00:00:00 2001 From: ZhangYu0123 Date: Thu, 3 Sep 2020 19:32:56 +0800 Subject: [PATCH 1/4] fix delete hanlder --- be/src/olap/delete_handler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/be/src/olap/delete_handler.cpp b/be/src/olap/delete_handler.cpp index ed6da5606593bb..c601f387106f9e 100644 --- a/be/src/olap/delete_handler.cpp +++ b/be/src/olap/delete_handler.cpp @@ -199,7 +199,7 @@ bool DeleteHandler::_parse_condition(const std::string& condition_str, TConditio try { // Condition string format const char* const CONDITION_STR_PATTERN = - R"((\w+)\s*((?:=)|(?:!=)|(?:>>)|(?:<<)|(?:>=)|(?:<=)|(?:\*=)|(?:IS))\s*((?:[\S ]+)?))"; + R"((\w+)\s*((?:=)|(?:!=)|(?:>>)|(?:<<)|(?:>=)|(?:<=)|(?:\*=)|(?:IS))\s*((?:[\r\n\S ]+)?))"; regex ex(CONDITION_STR_PATTERN); if (regex_match(condition_str, what, ex)) { if (condition_str.size() != what[0].str().size()) { From 4c1e7e5b4ebf376f43321444b3e9e24bc54b7643 Mon Sep 17 00:00:00 2001 From: ZhangYu0123 Date: Thu, 3 Sep 2020 19:43:12 +0800 Subject: [PATCH 2/4] fix --- be/src/olap/delete_handler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/be/src/olap/delete_handler.cpp b/be/src/olap/delete_handler.cpp index c601f387106f9e..bd8857dc680309 100644 --- a/be/src/olap/delete_handler.cpp +++ b/be/src/olap/delete_handler.cpp @@ -199,7 +199,7 @@ bool DeleteHandler::_parse_condition(const std::string& condition_str, TConditio try { // Condition string format const char* const CONDITION_STR_PATTERN = - R"((\w+)\s*((?:=)|(?:!=)|(?:>>)|(?:<<)|(?:>=)|(?:<=)|(?:\*=)|(?:IS))\s*((?:[\r\n\S ]+)?))"; + R"((\w+)\s*((?:=)|(?:!=)|(?:>>)|(?:<<)|(?:>=)|(?:<=)|(?:\*=)|(?:IS))\s*((?:[\r\n\t\S ]+)?))"; regex ex(CONDITION_STR_PATTERN); if (regex_match(condition_str, what, ex)) { if (condition_str.size() != what[0].str().size()) { From eda0bd4ed28fa00c52cfb2af37abe60da2831aa3 Mon Sep 17 00:00:00 2001 From: ZhangYu0123 Date: Thu, 3 Sep 2020 20:20:15 +0800 Subject: [PATCH 3/4] add comment --- be/src/olap/delete_handler.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/be/src/olap/delete_handler.cpp b/be/src/olap/delete_handler.cpp index bd8857dc680309..0a5d365c7152fb 100644 --- a/be/src/olap/delete_handler.cpp +++ b/be/src/olap/delete_handler.cpp @@ -197,7 +197,11 @@ bool DeleteHandler::_parse_condition(const std::string& condition_str, TConditio smatch what; try { - // Condition string format + // Condition string format, the format is (column_name)(op)(value) + // eg: c1 = 1597751948193618247 and length(source)<1;\n;\n + // group1: (\w+) matchs "c1" + // group2: ((?:=)|(?:!=)|(?:>>)|(?:<<)|(?:>=)|(?:<=)|(?:\*=)|(?:IS)) matchs "=" + // group3: ((?:[\r\n\t\S ]+)?) matchs "1597751948193618247 and length(source)<1;\n;\n" const char* const CONDITION_STR_PATTERN = R"((\w+)\s*((?:=)|(?:!=)|(?:>>)|(?:<<)|(?:>=)|(?:<=)|(?:\*=)|(?:IS))\s*((?:[\r\n\t\S ]+)?))"; regex ex(CONDITION_STR_PATTERN); From 81f23a765c4e5f767318b07a2f2deb003c44baed Mon Sep 17 00:00:00 2001 From: ZhangYu0123 Date: Thu, 3 Sep 2020 20:25:43 +0800 Subject: [PATCH 4/4] add comment --- be/src/olap/delete_handler.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/be/src/olap/delete_handler.cpp b/be/src/olap/delete_handler.cpp index 0a5d365c7152fb..a58b3e401c5769 100644 --- a/be/src/olap/delete_handler.cpp +++ b/be/src/olap/delete_handler.cpp @@ -198,12 +198,12 @@ bool DeleteHandler::_parse_condition(const std::string& condition_str, TConditio try { // Condition string format, the format is (column_name)(op)(value) - // eg: c1 = 1597751948193618247 and length(source)<1;\n;\n - // group1: (\w+) matchs "c1" - // group2: ((?:=)|(?:!=)|(?:>>)|(?:<<)|(?:>=)|(?:<=)|(?:\*=)|(?:IS)) matchs "=" - // group3: ((?:[\r\n\t\S ]+)?) matchs "1597751948193618247 and length(source)<1;\n;\n" + // eg: condition_str="c1 = 1597751948193618247 and length(source)<1;\n;\n" + // group1: (\w+) matchs "c1" + // group2: ((?:=)|(?:!=)|(?:>>)|(?:<<)|(?:>=)|(?:<=)|(?:\*=)|(?:IS)) matchs "=" + // group3: ((?:[\s\S]+)?) matchs "1597751948193618247 and length(source)<1;\n;\n" const char* const CONDITION_STR_PATTERN = - R"((\w+)\s*((?:=)|(?:!=)|(?:>>)|(?:<<)|(?:>=)|(?:<=)|(?:\*=)|(?:IS))\s*((?:[\r\n\t\S ]+)?))"; + R"((\w+)\s*((?:=)|(?:!=)|(?:>>)|(?:<<)|(?:>=)|(?:<=)|(?:\*=)|(?:IS))\s*((?:[\s\S]+)?))"; regex ex(CONDITION_STR_PATTERN); if (regex_match(condition_str, what, ex)) { if (condition_str.size() != what[0].str().size()) {