This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new e0f115ae038 [chore](cast) Simplify the execution of castexpr. (#56090)
e0f115ae038 is described below
commit e0f115ae038378f3353051cf49d1b68f69ca4ad8
Author: Mryange <[email protected]>
AuthorDate: Tue Sep 16 22:30:08 2025 +0800
[chore](cast) Simplify the execution of castexpr. (#56090)
### What problem does this PR solve?
Previously, we had a try block when executing the cast function, but in
fact, we have already ensured that exceptions will be caught inside the
function itself.
Some return value checks have already been performed on the expr ctx.
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [x] No need to test or manual test. Explain why:
- [x] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [x] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [x] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
---
be/src/vec/exprs/vcast_expr.cpp | 29 +++++------------------------
1 file changed, 5 insertions(+), 24 deletions(-)
diff --git a/be/src/vec/exprs/vcast_expr.cpp b/be/src/vec/exprs/vcast_expr.cpp
index 74a871575f6..e387d6b406c 100644
--- a/be/src/vec/exprs/vcast_expr.cpp
+++ b/be/src/vec/exprs/vcast_expr.cpp
@@ -115,30 +115,11 @@ doris::Status VCastExpr::execute(VExprContext* context,
doris::vectorized::Block
uint32_t num_columns_without_result = block->columns();
// prepare a column to save result
block->insert({nullptr, _data_type, _expr_name});
-
- auto state = Status::OK();
- try {
- state = _function->execute(context->fn_context(_fn_context_index),
*block,
- {static_cast<uint32_t>(column_id)},
num_columns_without_result,
- block->rows(), false);
- RETURN_IF_ERROR(state);
- // set the result column id only state is ok
- *result_column_id = num_columns_without_result;
- } catch (const Exception& e) {
- state = e.to_status();
- }
- if (state.ok()) {
- auto [result_column, is_const] =
-
unpack_if_const(block->get_by_position(num_columns_without_result).column);
-
- if (result_column->is_nullable() != _data_type->is_nullable()) {
- return Status::InternalError(
- fmt::format("CastExpr result column type mismatch, expect
{}, got {} , return "
- "column is const {}",
- _data_type->get_name(),
result_column->get_name(), is_const));
- }
- }
- return state;
+ RETURN_IF_ERROR(_function->execute(context->fn_context(_fn_context_index),
*block,
+ {static_cast<uint32_t>(column_id)},
+ num_columns_without_result,
block->rows()));
+ *result_column_id = num_columns_without_result;
+ return Status::OK();
}
const std::string& VCastExpr::expr_name() const {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]