You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2020/02/06 12:52:23 UTC
[incubator-doris] branch master updated: [Doris on Es] Fix lte and
gte error expression (#2851)
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push:
new b35e815 [Doris on Es] Fix lte and gte error expression (#2851)
b35e815 is described below
commit b35e8153c0689a7bcd12ea36ca83e8dd9acd9fe4
Author: Yunfeng,Wu <wu...@baidu.com>
AuthorDate: Thu Feb 6 20:52:14 2020 +0800
[Doris on Es] Fix lte and gte error expression (#2851)
LE should LTE
GE should GTE
---
be/src/exec/es/es_query_builder.cpp | 4 ++--
be/test/exec/es_query_builder_test.cpp | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/be/src/exec/es/es_query_builder.cpp b/be/src/exec/es/es_query_builder.cpp
index 5269e17..8ebe90d 100644
--- a/be/src/exec/es/es_query_builder.cpp
+++ b/be/src/exec/es/es_query_builder.cpp
@@ -82,13 +82,13 @@ void RangeQueryBuilder::to_json(rapidjson::Document* document, rapidjson::Value*
op_node.AddMember("lt", value, allocator);
break;
case TExprOpcode::LE:
- op_node.AddMember("le", value, allocator);
+ op_node.AddMember("lte", value, allocator);
break;
case TExprOpcode::GT:
op_node.AddMember("gt", value, allocator);
break;
case TExprOpcode::GE:
- op_node.AddMember("ge", value, allocator);
+ op_node.AddMember("gte", value, allocator);
break;
default:
break;
diff --git a/be/test/exec/es_query_builder_test.cpp b/be/test/exec/es_query_builder_test.cpp
index 432bb96..2abb19f 100644
--- a/be/test/exec/es_query_builder_test.cpp
+++ b/be/test/exec/es_query_builder_test.cpp
@@ -75,7 +75,7 @@ TEST_F(BooleanQueryBuilderTest, range_query) {
range_value.Accept(writer);
std::string actual_json = buffer.GetString();
//LOG(INFO) << "range query" << actual_json;
- ASSERT_STREQ("{\"range\":{\"k\":{\"ge\":\"a\"}}}", actual_json.c_str());
+ ASSERT_STREQ("{\"range\":{\"k\":{\"gte\":\"a\"}}}", actual_json.c_str());
}
TEST_F(BooleanQueryBuilderTest, es_query) {
@@ -248,7 +248,7 @@ TEST_F(BooleanQueryBuilderTest, bool_query) {
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
bool_query_value.Accept(writer);
std::string actual_json = buffer.GetString();
- std::string expected_json = "{\"bool\":{\"should\":[{\"wildcard\":{\"content\":\"a*e*g?\"}},{\"bool\":{\"must_not\":{\"exists\":{\"field\":\"f1\"}}}},{\"range\":{\"k\":{\"ge\":\"a\"}}},{\"term\":{\"content\":\"wyf\"}}]}}";
+ std::string expected_json = "{\"bool\":{\"should\":[{\"wildcard\":{\"content\":\"a*e*g?\"}},{\"bool\":{\"must_not\":{\"exists\":{\"field\":\"f1\"}}}},{\"range\":{\"k\":{\"gte\":\"a\"}}},{\"term\":{\"content\":\"wyf\"}}]}}";
//LOG(INFO) << "bool query" << actual_json;
ASSERT_STREQ(expected_json.c_str(), actual_json.c_str());
}
@@ -332,7 +332,7 @@ TEST_F(BooleanQueryBuilderTest, compound_bool_query) {
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
compound_bool_value.Accept(writer);
std::string actual_bool_json = buffer.GetString();
- std::string expected_json = "{\"bool\":{\"filter\":[{\"bool\":{\"should\":[{\"wildcard\":{\"content\":\"a*e*g?\"}},{\"bool\":{\"must_not\":{\"exists\":{\"field\":\"f1\"}}}}]}},{\"bool\":{\"should\":[{\"range\":{\"k\":{\"ge\":\"a\"}}}]}},{\"bool\":{\"should\":[{\"bool\":{\"must_not\":[{\"term\":{\"content\":\"wyf\"}}]}}]}},{\"bool\":{\"should\":[{\"bool\":{\"must_not\":[{\"terms\":{\"fv\":[\"8.0\",\"16.0\"]}}]}}]}}]}}";
+ std::string expected_json = "{\"bool\":{\"filter\":[{\"bool\":{\"should\":[{\"wildcard\":{\"content\":\"a*e*g?\"}},{\"bool\":{\"must_not\":{\"exists\":{\"field\":\"f1\"}}}}]}},{\"bool\":{\"should\":[{\"range\":{\"k\":{\"gte\":\"a\"}}}]}},{\"bool\":{\"should\":[{\"bool\":{\"must_not\":[{\"term\":{\"content\":\"wyf\"}}]}}]}},{\"bool\":{\"should\":[{\"bool\":{\"must_not\":[{\"terms\":{\"fv\":[\"8.0\",\"16.0\"]}}]}}]}}]}}";
//LOG(INFO) << "compound bool query" << actual_bool_json;
ASSERT_STREQ(expected_json.c_str(), actual_bool_json.c_str());
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org