zhangstar333 commented on code in PR #35032:
URL: https://github.com/apache/doris/pull/35032#discussion_r1613074363


##########
be/src/vec/exprs/vexpr_context.cpp:
##########
@@ -55,6 +61,39 @@ Status VExprContext::execute(vectorized::Block* block, int* 
result_column_id) {
         st = _root->execute(this, block, result_column_id);
         _last_result_column_id = *result_column_id;
     });
+    RETURN_IF_ERROR(st);
+#ifndef NDEBUG
+    RETURN_IF_ERROR(check_column_data_type(block, *result_column_id));
+#else
+#endif
+    return Status::OK();
+}
+
+Status VExprContext::check_column_data_type(vectorized::Block* block, int 
result_column_id) {
+    if (result_column_id < 0) {
+        return Status::InternalError("result_column_id error value {}", 
result_column_id);
+    }
+    ColumnWithTypeAndName data = block->get_by_position(result_column_id);
+    DataTypePtr column_data_type = data.type;
+    DataTypePtr expr_data_type = root()->data_type();
+    if (!expr_data_type->equals(*column_data_type)) {
+        return Status::InternalError(
+                "VExprContext expr match failed , expr data type : {} can not 
match block column "
+                "data type :{}",
+                expr_data_type->get_name(), column_data_type->get_name());
+    }
+    auto column_ptr = data.column->convert_to_full_column_if_const();
+    auto st = column_data_type->check_column_type(column_ptr.get());
+    if (!st.ok()) {
+        return Status::InternalError(
+                "VExprContext expr match failed ,"
+                "col name = {} , expr expected type = {} , "
+                "column expected type = {} , "
+                "column is nullable = {} , "
+                "error type msg = {}",
+                data.name, expr_data_type->get_name(), 
column_data_type->get_name(),
+                column_ptr->is_nullable(), st.msg());

Review Comment:
   column_ptr->dump_structure()



-- 
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.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to