Skip to content

Commit

Permalink
fix ut
Browse files Browse the repository at this point in the history
  • Loading branch information
JinheLin committed Dec 25, 2024
1 parent 240c596 commit 4dc4d6c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
17 changes: 11 additions & 6 deletions dbms/src/Storages/DeltaMerge/Segment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1259,13 +1259,18 @@ BlockInputStreamPtr Segment::getInputStreamModeRaw(
size_t expected_block_size)
{
auto new_columns_to_read = std::make_shared<ColumnDefines>();

new_columns_to_read->push_back(getExtraHandleColumnDefine(is_common_handle));

for (const auto & c : columns_to_read)
if (columns_to_read.front().id == EXTRA_HANDLE_COLUMN_ID)
{
if (c.id != EXTRA_HANDLE_COLUMN_ID)
new_columns_to_read->push_back(c);
*new_columns_to_read = columns_to_read;
}
else
{
new_columns_to_read->push_back(getExtraHandleColumnDefine(is_common_handle));
for (const auto & c : columns_to_read)
{
if (c.id != EXTRA_HANDLE_COLUMN_ID)
new_columns_to_read->push_back(c);
}
}

BlockInputStreamPtr stable_stream = segment_snap->stable->getInputStream(
Expand Down
4 changes: 4 additions & 0 deletions dbms/src/Storages/DeltaMerge/tests/DMTestEnv.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ class DMTestEnv
columns->emplace_back(getExtraHandleColumnDefine(/*is_common_handle=*/false));
break;
case PkType::CommonHandle:
// EXTRA_HANDLE_COLUMN_STRING_TYPE is initialized according to STORAGE_FORMAT_CURRENT when the program starts and its value never changed.
// But unit-tests will change STORAGE_FORMAT_CURRENT for testing, without restarting the program.
// So we need to create DataTypeString dynamically here.
columns->emplace_back(getExtraHandleColumnDefine(/*is_common_handle=*/true));
columns->back().type = DataTypeFactory::instance().get(DataTypeString::getDefaultName());
break;
case PkType::PkIsHandleInt64:
columns->emplace_back(ColumnDefine{PK_ID_PK_IS_HANDLE, PK_NAME_PK_IS_HANDLE, EXTRA_HANDLE_COLUMN_INT_TYPE});
Expand Down

0 comments on commit 4dc4d6c

Please sign in to comment.