eldenmoon commented on code in PR #34764:
URL: https://github.com/apache/doris/pull/34764#discussion_r1604282598


##########
be/src/vec/functions/function_cast.h:
##########
@@ -845,48 +860,21 @@ struct ConvertImplFromJsonb {
                         null_map[i] = 1;
                         res[i] = 0;
                     }
-                } else if constexpr (type_index == TypeIndex::Int8) {
-                    if (value->isInt8()) {
-                        res[i] = (int8_t)((const JsonbIntVal*)value)->val();
-                    } else {
-                        null_map[i] = 1;
-                        res[i] = 0;
-                    }
-                } else if constexpr (type_index == TypeIndex::Int16) {
-                    if (value->isInt8() || value->isInt16()) {
-                        res[i] = (int16_t)((const JsonbIntVal*)value)->val();
-                    } else {
-                        null_map[i] = 1;
-                        res[i] = 0;
-                    }
-                } else if constexpr (type_index == TypeIndex::Int32) {
-                    if (value->isInt8() || value->isInt16() || 
value->isInt32()) {
-                        res[i] = (int32_t)((const JsonbIntVal*)value)->val();
-                    } else {
-                        null_map[i] = 1;
-                        res[i] = 0;
-                    }
-                } else if constexpr (type_index == TypeIndex::Int64) {
-                    if (value->isInt8() || value->isInt16() || 
value->isInt32() ||
-                        value->isInt64()) {
-                        res[i] = (int64_t)((const JsonbIntVal*)value)->val();
-                    } else {
-                        null_map[i] = 1;
-                        res[i] = 0;
-                    }
-                } else if constexpr (type_index == TypeIndex::Int128) {
-                    if (value->isInt8() || value->isInt16() || 
value->isInt32() ||
-                        value->isInt64() || value->isInt128()) {
-                        res[i] = (int128_t)((const JsonbIntVal*)value)->val();
+                } else if constexpr (type_index == TypeIndex::Int8 ||
+                                     type_index == TypeIndex::Int16 ||
+                                     type_index == TypeIndex::Int32 ||
+                                     type_index == TypeIndex::Int64 ||
+                                     type_index == TypeIndex::Int128) {
+                    if (value->isInt()) {
+                        res[i] = ((const JsonbIntVal*)value)->val();

Review Comment:
   the same as cast bigint to tinyint



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