This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 7ea5e1d744f6b02dd7c5456873c392488ebcbcef
Author: Ashin Gau <ashin...@users.noreply.github.com>
AuthorDate: Fri Apr 12 17:26:27 2024 +0800

    [fix](schema change) CastStringConverter is compiled failed in g++ (#33546)
    
    follow #32873, CastStringConverter is compiled failed in g++ for 
uninitialized value, which is ok in clang:
---
 be/src/vec/exec/format/column_type_convert.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/be/src/vec/exec/format/column_type_convert.h 
b/be/src/vec/exec/format/column_type_convert.h
index 65742671f72..43cae065fca 100644
--- a/be/src/vec/exec/format/column_type_convert.h
+++ b/be/src/vec/exec/format/column_type_convert.h
@@ -384,7 +384,7 @@ public:
         to_col->resize(start_idx + rows);
         auto& data = static_cast<DstColumnType*>(to_col.get())->get_data();
         for (int i = 0; i < rows; ++i) {
-            DstCppType value;
+            DstCppType& value = data[start_idx + i];
             auto string_value = string_col.get_data_at(i);
             bool can_cast = false;
             if constexpr (is_decimal_type_const<DstPrimitiveType>()) {
@@ -398,9 +398,7 @@ public:
                 can_cast = SafeCastString<DstPrimitiveType>::safe_cast_string(
                         string_value.data, string_value.size, &value);
             }
-            if (can_cast) {
-                data[start_idx + i] = value;
-            } else {
+            if (!can_cast) {
                 if (null_map == nullptr) {
                     return Status::InternalError("Failed to cast string '{}' 
to not null column",
                                                  string_value.to_string());


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

Reply via email to