Skip to content

Commit eba47e8

Browse files
csun5285claude
andcommitted
[fix](be) Fix BE UT compile error and Iceberg partition limit test crash
### What problem does this PR solve? Issue Number: None Related PR: #69223, #69174, #69327, #69183 Problem Summary: BE UT of every PR based on master fails since 2026-10-22. Two test-only breakages were merged by PRs whose own CI ran on an older master. 1. doris_be_test does not compile (TeamCity: "BE BUILD FAIL"): be/test/exprs/function/function_string_test.cpp:2971: error: no matching conversion for functional-style cast from 'std::string' to 'Field' be/test/exprs/function/function_string_test.cpp:2982: error: no member named 'FRAGMENT_LOCAL' in 'doris::FunctionContext' function_translate_mixed_const_map_test, added by #69223, builds a Field directly from std::string and uses FunctionContext::FRAGMENT_LOCAL. Field must be created with Field::create_field<TYPE_STRING>() now, and #69174 made FunctionStateScope an enum class. Use both current spellings, as the rest of be/test does. 2. Once it compiles, doris_be_test aborts (TeamCity: "CORE DUMPED") in DefaultAndConfiguredLimits/ExternalTableWriterPartitionLimitTest. IcebergRejectsNextPartitionBeforeOpeningAFile/0: shared_ptr_base.h:1344: [_Tp = doris::iceberg::Schema]: Assertion '__p != nullptr' failed. #69327 made VIcebergTableWriter validate every block against the schema pinned by open(): `iceberg::validate_write_block(*_schema, ...)`. The test added by #69183 skips open() and calls write_prepared_block() directly, so _schema is null. open() always sets _schema in production, so the writer stays unchanged. The test now pins a one-field schema that matches its block (optional INT "p", the source field of its identity partition), as viceberg_table_writer_test.cpp does. ### Release note None ### Check List (For Author) - Test: Unit Test - run-be-ut.sh --run --filter='function_string_test.function_translate_mixed_const_map_test:DefaultAndConfiguredLimits/ExternalTableWriterPartitionLimitTest.*' on master 57e41e9 plus this commit: doris_be_test compiles and all 5 tests pass (the translate case and the 2 Hive + 2 Iceberg partition limit cases). The failures above are from TeamCity BE UT runs of other PRs based on master (e.g. #68853, #69456). - Behavior changed: No - Does this need documentation: No Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 57e41e9 commit eba47e8

2 files changed

Lines changed: 19 additions & 7 deletions

File tree

‎be/test/exec/sink/writer/external_table_writer_partition_limit_test.cpp‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#include "exec/sink/writer/vhive_table_writer.h"
2626
#include "exprs/vexpr_context.h"
2727
#include "exprs/vslot_ref.h"
28+
#include "format/table/iceberg/schema.h"
29+
#include "format/table/iceberg/types.h"
2830
#include "runtime/runtime_state.h"
2931

3032
namespace doris {
@@ -94,6 +96,10 @@ TEST_P(ExternalTableWriterPartitionLimitTest, IcebergRejectsNextPartitionBeforeO
9496
VExprContextSPtrs exprs;
9597
iceberg::PartitionField field(1, 1000, "p", "identity");
9698
VIcebergTableWriter writer(sink, exprs, nullptr, nullptr);
99+
// open() pins the table schema, and every written block is validated against it.
100+
std::vector<iceberg::NestedField> columns;
101+
columns.emplace_back(true, 1, "p", std::make_unique<iceberg::IntegerType>(), std::nullopt);
102+
writer._schema = std::make_shared<iceberg::Schema>(std::move(columns));
97103
writer._iceberg_partition_columns.emplace_back(
98104
field, TYPE_INT, 0, std::vector<size_t> {},
99105
std::make_unique<IdentityPartitionColumnTransform>(std::make_shared<DataTypeInt32>()));

‎be/test/exprs/function/function_string_test.cpp‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2967,9 +2967,11 @@ TEST(function_string_test, function_translate_mixed_const_map_test) {
29672967
// Keep mixed source rows in one batch, with singleton nested mapping columns.
29682968
Block block;
29692969
block.insert({std::move(source), type, "source"});
2970-
block.insert(
2971-
{type->create_column_const(row_count, Field(std::string("ab"))), type, "from"});
2972-
block.insert({type->create_column_const(row_count, Field(to)), type, "to"});
2970+
block.insert({type->create_column_const(
2971+
row_count, Field::create_field<TYPE_STRING>(std::string("ab"))),
2972+
type, "from"});
2973+
block.insert({type->create_column_const(row_count, Field::create_field<TYPE_STRING>(to)),
2974+
type, "to"});
29732975
auto function = SimpleFunctionFactory::instance().get_function(
29742976
"translate", block.get_columns_with_type_and_name(), type);
29752977
ASSERT_NE(function, nullptr);
@@ -2979,12 +2981,16 @@ TEST(function_string_test, function_translate_mixed_const_map_test) {
29792981
context->set_constant_cols(
29802982
{nullptr, std::make_shared<ColumnPtrWrapper>(block.get_by_position(1).column),
29812983
std::make_shared<ColumnPtrWrapper>(block.get_by_position(2).column)});
2982-
ASSERT_TRUE(function->open(context, FunctionContext::FRAGMENT_LOCAL).ok());
2983-
ASSERT_TRUE(function->open(context, FunctionContext::THREAD_LOCAL).ok());
2984+
ASSERT_TRUE(
2985+
function->open(context, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());
2986+
ASSERT_TRUE(
2987+
function->open(context, FunctionContext::FunctionStateScope::THREAD_LOCAL).ok());
29842988
block.insert({nullptr, type, "result"});
29852989
ASSERT_TRUE(function->execute(context, block, {0, 1, 2}, 3, row_count).ok());
2986-
ASSERT_TRUE(function->close(context, FunctionContext::THREAD_LOCAL).ok());
2987-
ASSERT_TRUE(function->close(context, FunctionContext::FRAGMENT_LOCAL).ok());
2990+
ASSERT_TRUE(
2991+
function->close(context, FunctionContext::FunctionStateScope::THREAD_LOCAL).ok());
2992+
ASSERT_TRUE(
2993+
function->close(context, FunctionContext::FunctionStateScope::FRAGMENT_LOCAL).ok());
29882994

29892995
const auto& result = block.get_by_position(3).column;
29902996
ASSERT_EQ(row_count, result->size());

0 commit comments

Comments
 (0)