Copilot commented on code in PR #62179:
URL: https://github.com/apache/doris/pull/62179#discussion_r3052193748


##########
be/src/core/data_type_serde/data_type_number_serde.cpp:
##########
@@ -168,20 +167,23 @@ Status 
DataTypeNumberSerDe<T>::deserialize_one_cell_from_json(IColumn& column, S
         return Status::InvalidArgument("uint128 is not support");
     } else if constexpr (is_float_or_double(T) || T == TYPE_TIMEV2 || T == 
TYPE_TIME) {
         typename PrimitiveTypeTraits<T>::CppType val = 0;
-        if (!try_read_float_text(val, str_ref)) {
+        CastParameters params;
+        if (!CastToFloat::from_string(str_ref, val, params)) {
             return Status::InvalidArgument("parse number fail, string: '{}'", 
slice.to_string());
         }
         column_data.insert_value(val);
     } else if constexpr (T == TYPE_BOOLEAN) {
         // Note: here we should handle the bool type
         typename PrimitiveTypeTraits<T>::CppType val = 0;
-        if (!try_read_bool_text(val, str_ref)) {
+        CastParameters params;
+        if (!CastToBool::from_string(str_ref, val, params)) {
             return Status::InvalidArgument("parse boolean fail, string: '{}'", 
slice.to_string());
         }
         column_data.insert_value(val);
     } else if constexpr (is_int_or_bool(T)) {
         typename PrimitiveTypeTraits<T>::CppType val = 0;
-        if (!try_read_int_text(val, str_ref)) {
+        CastParameters params;
+        if (!CastToInt::from_string<false>(str_ref, val, params)) {
             return Status::InvalidArgument("parse number fail, string: '{}'", 
slice.to_string());
         }

Review Comment:
   Same issue as above: `CastParameters params;` is used multiple times without 
explicit initialization. If any members lack default initialization, this can 
lead to undefined behavior or incorrect strictness/status propagation in serde 
parsing paths. Initialize `CastParameters` consistently (e.g. `CastParameters 
params{.status = Status::OK(), .is_strict = false};` or `CastParameters 
params{}; params.status = Status::OK(); params.is_strict = false;`).



##########
be/src/core/data_type_serde/data_type_number_serde.cpp:
##########
@@ -168,20 +167,23 @@ Status 
DataTypeNumberSerDe<T>::deserialize_one_cell_from_json(IColumn& column, S
         return Status::InvalidArgument("uint128 is not support");
     } else if constexpr (is_float_or_double(T) || T == TYPE_TIMEV2 || T == 
TYPE_TIME) {
         typename PrimitiveTypeTraits<T>::CppType val = 0;
-        if (!try_read_float_text(val, str_ref)) {
+        CastParameters params;
+        if (!CastToFloat::from_string(str_ref, val, params)) {
             return Status::InvalidArgument("parse number fail, string: '{}'", 
slice.to_string());
         }
         column_data.insert_value(val);
     } else if constexpr (T == TYPE_BOOLEAN) {
         // Note: here we should handle the bool type
         typename PrimitiveTypeTraits<T>::CppType val = 0;
-        if (!try_read_bool_text(val, str_ref)) {
+        CastParameters params;
+        if (!CastToBool::from_string(str_ref, val, params)) {
             return Status::InvalidArgument("parse boolean fail, string: '{}'", 
slice.to_string());
         }

Review Comment:
   Same issue as above: `CastParameters params;` is used multiple times without 
explicit initialization. If any members lack default initialization, this can 
lead to undefined behavior or incorrect strictness/status propagation in serde 
parsing paths. Initialize `CastParameters` consistently (e.g. `CastParameters 
params{.status = Status::OK(), .is_strict = false};` or `CastParameters 
params{}; params.status = Status::OK(); params.is_strict = false;`).



##########
be/src/core/data_type_serde/data_type_number_serde.cpp:
##########
@@ -168,20 +167,23 @@ Status 
DataTypeNumberSerDe<T>::deserialize_one_cell_from_json(IColumn& column, S
         return Status::InvalidArgument("uint128 is not support");
     } else if constexpr (is_float_or_double(T) || T == TYPE_TIMEV2 || T == 
TYPE_TIME) {
         typename PrimitiveTypeTraits<T>::CppType val = 0;
-        if (!try_read_float_text(val, str_ref)) {
+        CastParameters params;
+        if (!CastToFloat::from_string(str_ref, val, params)) {
             return Status::InvalidArgument("parse number fail, string: '{}'", 
slice.to_string());
         }

Review Comment:
   Same issue as above: `CastParameters params;` is used multiple times without 
explicit initialization. If any members lack default initialization, this can 
lead to undefined behavior or incorrect strictness/status propagation in serde 
parsing paths. Initialize `CastParameters` consistently (e.g. `CastParameters 
params{.status = Status::OK(), .is_strict = false};` or `CastParameters 
params{}; params.status = Status::OK(); params.is_strict = false;`).



-- 
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: [email protected]

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