Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions be/src/format/table/table_format_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ class TableSchemaChangeHelper {
}

bool children_column_exists(std::string table_column_name) const override {
DCHECK(children.contains(table_column_name));
return children.at(table_column_name).exists;
auto child = children.find(table_column_name);
return child != children.end() && child->second.exists;
}

void add_not_exist_children(std::string table_column_name) override {
Expand Down
11 changes: 11 additions & 0 deletions be/test/format/table/table_schema_change_helper_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@
namespace doris {
class MockTableSchemaChangeHelper : public TableSchemaChangeHelper {};

TEST(MockTableSchemaChangeHelper, UnknownStructChildDoesNotExist) {
TableSchemaChangeHelper::StructNode root;
root.add_children("file_column", "file_column",
std::make_shared<TableSchemaChangeHelper::ScalarNode>());
root.add_not_exist_children("missing_file_column");

EXPECT_TRUE(root.children_column_exists("file_column"));
EXPECT_FALSE(root.children_column_exists("missing_file_column"));
EXPECT_FALSE(root.children_column_exists("partition_column"));
}

TEST(MockTableSchemaChangeHelper, OrcNameNoSchemaChange) {
std::vector<DataTypePtr> data_types;
std::vector<std::string> column_names;
Expand Down
Loading