From 1e66b0c8b7d0b5f8d0c1c74e56286ce660e92594 Mon Sep 17 00:00:00 2001 From: zclllhhjj Date: Tue, 5 Nov 2024 14:15:12 +0800 Subject: [PATCH] [Optimize](Expr) Opt getting value of VLitreal (#43204) ### What problem does this PR solve? Issue Number: close #xxx Related PR: #xxx Problem Summary: For `VLiteral`, it only has one value as expected. So no need to use for loop. ### Check List (For Committer) - Test - [ ] 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 colde files have been changed. - [ ] Other reason - Behavior changed: - [x] No. - [ ] Yes. - Does this need documentation? - [x] No. - [ ] Yes. - Release note None ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label --- be/src/vec/exprs/vliteral.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/be/src/vec/exprs/vliteral.cpp b/be/src/vec/exprs/vliteral.cpp index 1d02a63321befd..8dcc5e3cb5a1cf 100644 --- a/be/src/vec/exprs/vliteral.cpp +++ b/be/src/vec/exprs/vliteral.cpp @@ -76,15 +76,8 @@ Status VLiteral::execute(VExprContext* context, vectorized::Block* block, int* r } std::string VLiteral::value() const { - //TODO: dcheck the equality of size with 1. then use string with size to replace the ss. - std::stringstream out; - for (size_t i = 0; i < _column_ptr->size(); i++) { - if (i != 0) { - out << ", "; - } - out << _data_type->to_string(*_column_ptr, i); - } - return out.str(); + DCHECK(_column_ptr->size() == 1); + return _data_type->to_string(*_column_ptr, 0); } std::string VLiteral::debug_string() const {