amorynan commented on code in PR #50180:
URL: https://github.com/apache/doris/pull/50180#discussion_r2051896947


##########
be/src/vec/functions/function_cast.h:
##########
@@ -1920,13 +1921,19 @@ class FunctionCast final : public IFunctionBase {
                     // TODO not found root cause, a tmp fix
                     
col_to->assume_mutable()->insert_many_defaults(input_rows_count);
                     col_to = make_nullable(col_to, true);
+                } else if (WhichDataType(data_type_to).is_string()) {
+                    // serialize to string
+                    return ConvertImplGenericToString::execute2(context, 
block, arguments, result,
+                                                                
input_rows_count);
+                } else if (WhichDataType(data_type_to).is_json()) {
+                    // serialize to json by parsing
+                    return ConvertImplGenericToJsonb::execute(context, block, 
arguments, result,
+                                                              
input_rows_count);
                 } else if (!data_type_to->is_nullable() &&
                            !WhichDataType(data_type_to).is_string()) {
+                    // other types
                     
col_to->assume_mutable()->insert_many_defaults(input_rows_count);
                     col_to = make_nullable(col_to, true);
-                } else if (WhichDataType(data_type_to).is_string()) {
-                    return ConvertImplGenericToString::execute2(context, 
block, arguments, result,
-                                                                
input_rows_count);
                 } else {

Review Comment:
   Before this pr we cast(v as jsonb) whether to enter this branch, call 
Nullable(ColumnObject)-> insert_many_defaults() which cause the wrong NULL 
value ?



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to