yangzhg commented on a change in pull request #3485:
URL: https://github.com/apache/incubator-doris/pull/3485#discussion_r421202946



##########
File path: be/src/exec/assert_num_rows_node.cpp
##########
@@ -56,12 +62,46 @@ Status AssertNumRowsNode::get_next(RuntimeState* state, 
RowBatch* output_batch,
     output_batch->reset();
     child(0)->get_next(state, output_batch, eos);
     _num_rows_returned += output_batch->num_rows();
-    if (_num_rows_returned > _desired_num_rows) {
-        LOG(INFO) << "Expected no more than " << _desired_num_rows << " to be 
returned by expression "
-                  << _subquery_string;
-        return Status::Cancelled(strings::Substitute(
-                                "Expected no more than $0 to be returned by 
expression $1",
-                                _desired_num_rows, _subquery_string));
+    bool assert_res = false;
+    switch (_assertion) {
+    case TAssertion::EQ:
+        assert_res = _num_rows_returned == _desired_num_rows;
+        break;
+    case TAssertion::NE:
+        assert_res = _num_rows_returned != _desired_num_rows;
+        break;
+    case TAssertion::LT:
+        assert_res = _num_rows_returned < _desired_num_rows;
+        break;
+    case TAssertion::LE:
+        assert_res = _num_rows_returned <= _desired_num_rows;
+        break;
+    case TAssertion::GT:
+        assert_res = _num_rows_returned > _desired_num_rows;
+        break;
+    case TAssertion::GE:
+        assert_res = _num_rows_returned >= _desired_num_rows;
+        break;
+    default:
+        break;
+    }
+
+    if (!assert_res) {
+        auto to_string_lamba = [](TAssertion::type assertion) {
+            std::map<int, const char*>::const_iterator it =
+                    _TAssertion_VALUES_TO_NAMES.find(assertion);

Review comment:
       `_TAssertion_VALUES_TO_NAMES` is generated by thrift, every `enum` has a 
variable like  `_xxxx_VALUES_TO_NAMES`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to