github-actions[bot] commented on code in PR #62803: URL: https://github.com/apache/doris/pull/62803#discussion_r3165183172
########## be/test/exec/operator/nested_loop_join_probe_operator_test.cpp: ########## @@ -0,0 +1,185 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include <gtest/gtest.h> + +#include <cstddef> +#include <cstdint> + +#include "core/assert_cast.h" +#include "core/block/block.h" +#include "core/column/column_nullable.h" +#include "core/column/column_vector.h" +#include "core/data_type/data_type_nullable.h" +#include "core/data_type/data_type_number.h" + +namespace doris { + +class NLJAppendProbeDataWithNullTest : public testing::Test {}; + +// Reproduces the bug in _append_probe_data_with_null where the null map was +// only extended by 1 row instead of _probe_side_process_count rows when +// wrapping a non-nullable probe column into a nullable output column. +TEST_F(NLJAppendProbeDataWithNullTest, NullMapSizeMustMatchNestedColumnAfterInsertRange) { + // Build a non-nullable source column with N rows (simulates probe side). + constexpr size_t num_rows = 5; + auto src_column = ColumnInt32::create(); + for (int32_t i = 0; i < static_cast<int32_t>(num_rows); ++i) { + src_column->insert_value(i + 100); + } + ASSERT_EQ(src_column->size(), num_rows); + ASSERT_FALSE(src_column->is_nullable()); + + // Build a nullable destination column (simulates output column in mark join + // with RIGHT_OUTER / FULL_OUTER where probe columns become nullable). + auto nested_col = ColumnInt32::create(); + auto null_map = ColumnUInt8::create(); + auto dst_column = ColumnNullable::create(std::move(nested_col), std::move(null_map)); + ASSERT_TRUE(dst_column->is_nullable()); + + auto origin_sz = dst_column->size(); + ASSERT_EQ(origin_sz, 0); + + // This is the exact pattern from _append_probe_data_with_null: + // insert N rows into the nested column, then resize the null map. + const size_t probe_side_process_count = num_rows; + const size_t probe_block_start_pos = 0; + + assert_cast<ColumnNullable*>(dst_column.get()) Review Comment: This test reimplements the fixed sequence directly instead of exercising `_append_probe_data_with_null()` or the nested-loop-join operator path that calls it. If the production line regresses back to `origin_sz + 1`, this test will still pass because it uses its own local `origin_sz + probe_side_process_count` expression. Please drive the actual NLJ path for a mark RIGHT/FULL join with an empty build side, or otherwise call the changed helper through the fixture, so the test fails when the production code regresses. This is distinct from the existing comments on the previous test version because the current test no longer reaches the operator at all. -- 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]
