zhiqiang-hhhh commented on code in PR #36004:
URL: https://github.com/apache/doris/pull/36004#discussion_r1630547491


##########
be/src/vec/functions/comparison_equal_for_null.cpp:
##########
@@ -75,33 +79,62 @@ class FunctionEqForNull : public IFunction {
         } else if (left_only_null) {
             auto right_type_nullable = col_right.type->is_nullable();
             if (!right_type_nullable) {
+                // right_column is not nullable, so result is all false.
                 block.get_by_position(result).column =
                         ColumnVector<UInt8>::create(input_rows_count, 0);
             } else {
-                auto const* nullable_right_col =
-                        assert_cast<const 
ColumnNullable*>(col_right.column.get());
+                // right_column is nullable
+                const ColumnNullable* nullable_right_col = nullptr;
+                if (right_const) {
+                    nullable_right_col = assert_cast<const ColumnNullable*>(
+                            &(assert_cast<const 
ColumnConst*>(col_right.column.get())
+                                      ->get_data_column()));
+                } else {
+                    nullable_right_col = assert_cast<const 
ColumnNullable*>(col_right.column.get());
+                }
+                // left column is all null, so result has same nullmap with 
right column.
                 block.get_by_position(result).column =
                         
nullable_right_col->get_null_map_column().clone_resized(input_rows_count);
             }
             return Status::OK();
         } else if (right_only_null) {
             auto left_type_nullable = col_left.type->is_nullable();
             if (!left_type_nullable) {

Review Comment:
   bug fix should not be mixed with refactor



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