-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix-extra_table_id_column-duration-lm
- Loading branch information
Showing
99 changed files
with
2,615 additions
and
975 deletions.
There are no files selected for viewing
Submodule aws
updated
2 files
+1 −1 | src/aws-cpp-sdk-core/source/client/AWSClient.cpp | |
+11 −1 | src/aws-cpp-sdk-core/source/client/AWSXmlClient.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2023 PingCAP, Ltd. | ||
// | ||
// Licensed 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 <DataStreams/AddExtraTableIDColumnInputStream.h> | ||
|
||
namespace DB | ||
{ | ||
|
||
AddExtraTableIDColumnInputStream::AddExtraTableIDColumnInputStream( | ||
BlockInputStreamPtr input, | ||
int extra_table_id_index, | ||
TableID physical_table_id) | ||
: action(input->getHeader(), extra_table_id_index, physical_table_id) | ||
{ | ||
children.push_back(input); | ||
} | ||
|
||
Block AddExtraTableIDColumnInputStream::readImpl() | ||
{ | ||
Block res = children.back()->read(); | ||
if (!res) | ||
return res; | ||
|
||
auto ok = action.transform(res); | ||
if (!ok) | ||
return {}; | ||
|
||
return res; | ||
} | ||
|
||
} // namespace DB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2023 PingCAP, Ltd. | ||
// | ||
// Licensed 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. | ||
|
||
#pragma once | ||
|
||
#include <DataStreams/AddExtraTableIDColumnTransformAction.h> | ||
#include <DataStreams/IProfilingBlockInputStream.h> | ||
#include <Storages/Transaction/Types.h> | ||
|
||
namespace DB | ||
{ | ||
|
||
/** | ||
* Adds an extra TableID column to the block. | ||
*/ | ||
class AddExtraTableIDColumnInputStream : public IProfilingBlockInputStream | ||
{ | ||
static constexpr auto NAME = "AddExtraTableIDColumn"; | ||
|
||
public: | ||
AddExtraTableIDColumnInputStream( | ||
BlockInputStreamPtr input, | ||
int extra_table_id_index, | ||
TableID physical_table_id); | ||
|
||
String getName() const override { return NAME; } | ||
|
||
Block getHeader() const override { return action.getHeader(); } | ||
|
||
protected: | ||
Block readImpl() override; | ||
|
||
private: | ||
AddExtraTableIDColumnTransformAction action; | ||
}; | ||
|
||
} // namespace DB |
93 changes: 93 additions & 0 deletions
93
dbms/src/DataStreams/AddExtraTableIDColumnTransformAction.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// Copyright 2022 PingCAP, Ltd. | ||
// | ||
// Licensed 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 <DataStreams/AddExtraTableIDColumnTransformAction.h> | ||
#include <Storages/DeltaMerge/DeltaMergeHelpers.h> | ||
|
||
namespace DB | ||
{ | ||
|
||
Block AddExtraTableIDColumnTransformAction::buildHeader( | ||
const Block & inner_header_, | ||
int extra_table_id_index) | ||
{ | ||
auto header = inner_header_.cloneEmpty(); | ||
if (extra_table_id_index != InvalidColumnID) | ||
{ | ||
const auto & extra_table_id_col_define = DM::getExtraTableIDColumnDefine(); | ||
ColumnWithTypeAndName col{ | ||
extra_table_id_col_define.type->createColumn(), | ||
extra_table_id_col_define.type, | ||
extra_table_id_col_define.name, | ||
extra_table_id_col_define.id, | ||
extra_table_id_col_define.default_value}; | ||
header.insert(extra_table_id_index, col); | ||
} | ||
return header; | ||
} | ||
|
||
Block AddExtraTableIDColumnTransformAction::buildHeader( | ||
const DM::ColumnDefines & columns_to_read_, | ||
int extra_table_id_index) | ||
{ | ||
auto inner_header = toEmptyBlock(columns_to_read_); | ||
return buildHeader(inner_header, extra_table_id_index); | ||
} | ||
|
||
AddExtraTableIDColumnTransformAction::AddExtraTableIDColumnTransformAction( | ||
const Block & inner_header_, | ||
int extra_table_id_index_, | ||
TableID physical_table_id_) | ||
: header(buildHeader(inner_header_, extra_table_id_index_)) | ||
, extra_table_id_index(extra_table_id_index_) | ||
, physical_table_id(physical_table_id_) | ||
{ | ||
} | ||
|
||
AddExtraTableIDColumnTransformAction::AddExtraTableIDColumnTransformAction( | ||
const DM::ColumnDefines & columns_to_read_, | ||
int extra_table_id_index_, | ||
TableID physical_table_id_) | ||
: header(buildHeader(columns_to_read_, extra_table_id_index_)) | ||
, extra_table_id_index(extra_table_id_index_) | ||
, physical_table_id(physical_table_id_) | ||
{ | ||
} | ||
|
||
Block AddExtraTableIDColumnTransformAction::getHeader() const | ||
{ | ||
return header; | ||
} | ||
|
||
bool AddExtraTableIDColumnTransformAction::transform(Block & block) | ||
{ | ||
if (unlikely(!block)) | ||
return true; | ||
|
||
if (extra_table_id_index != InvalidColumnID) | ||
{ | ||
const auto & extra_table_id_col_define = DM::getExtraTableIDColumnDefine(); | ||
ColumnWithTypeAndName col{{}, extra_table_id_col_define.type, extra_table_id_col_define.name, extra_table_id_col_define.id}; | ||
size_t row_number = block.rows(); | ||
auto col_data = col.type->createColumnConst(row_number, Field(physical_table_id)); | ||
col.column = std::move(col_data); | ||
block.insert(extra_table_id_index, std::move(col)); | ||
} | ||
|
||
total_rows += block.rows(); | ||
|
||
return true; | ||
} | ||
|
||
} // namespace DB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.