HappenLee commented on code in PR #22823:
URL: https://github.com/apache/doris/pull/22823#discussion_r1290841050


##########
be/src/vec/functions/if.cpp:
##########
@@ -494,6 +493,19 @@ class FunctionIf : public IFunction {
         cond_column.column = materialize_column_if_const(cond_column.column);
         const ColumnWithTypeAndName& arg_cond = 
block.get_by_position(arguments[0]);
 
+        if (auto* then_is_const = 
check_and_get_column<ColumnConst>(*arg_then.column)) {
+            if (then_is_const->only_null() == false &&
+                
check_and_get_column<ColumnNullable>(then_is_const->get_data_column())) {
+                arg_then.column = then_is_const->get_data_column_ptr();
+            }
+        }
+        if (auto* else_is_const = 
check_and_get_column<ColumnConst>(*arg_else.column)) {
+            if (else_is_const->only_null() == false &&
+                
check_and_get_column<ColumnNullable>(else_is_const->get_data_column())) {
+                arg_else.column = else_is_const->get_data_column_ptr();

Review Comment:
   the data_column length is 1,may cause bug in block



##########
be/src/vec/functions/if.cpp:
##########
@@ -494,6 +493,19 @@ class FunctionIf : public IFunction {
         cond_column.column = materialize_column_if_const(cond_column.column);
         const ColumnWithTypeAndName& arg_cond = 
block.get_by_position(arguments[0]);
 
+        if (auto* then_is_const = 
check_and_get_column<ColumnConst>(*arg_then.column)) {
+            if (then_is_const->only_null() == false &&
+                
check_and_get_column<ColumnNullable>(then_is_const->get_data_column())) {
+                arg_then.column = then_is_const->get_data_column_ptr();
+            }
+        }
+        if (auto* else_is_const = 
check_and_get_column<ColumnConst>(*arg_else.column)) {
+            if (else_is_const->only_null() == false &&
+                
check_and_get_column<ColumnNullable>(else_is_const->get_data_column())) {
+                arg_else.column = else_is_const->get_data_column_ptr();

Review Comment:
   the data_column length is 1,may cause bug in block



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