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