-
Notifications
You must be signed in to change notification settings - Fork 411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pipeline: Support pipeline table scan fullstack part 1 #7225
Changes from 19 commits
c1f9554
5cab781
373d0d8
fd8087f
8243ccd
1450a7a
2fab85d
841cabd
b7a469e
dc24eef
c09481f
7c87eaa
1845fc1
e6314d5
11c520a
067ceaa
e33ae47
3b98ab0
84f9ad3
388fa9b
e7595c5
cb3e3c6
f075bd7
e42e849
7ed8f49
6a4efe4
7c99ab7
afed2f5
38ccc35
a04effe
d473f97
ea9081d
09946b5
6696c8a
5c62263
5c0c835
26793a5
091c4d1
7833379
b516e56
76956e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,68 @@ | ||||||||||||||||||||
// 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/GeneratedColumnPlaceHolderTransformAction.h> | ||||||||||||||||||||
|
||||||||||||||||||||
namespace DB | ||||||||||||||||||||
{ | ||||||||||||||||||||
GeneratedColumnPlaceHolderTransformAction::GeneratedColumnPlaceHolderTransformAction( | ||||||||||||||||||||
const Block & header_, | ||||||||||||||||||||
const std::vector<std::tuple<UInt64, String, DataTypePtr>> & generated_column_infos_) | ||||||||||||||||||||
: generated_column_infos(generated_column_infos_) | ||||||||||||||||||||
{ | ||||||||||||||||||||
header = header_; | ||||||||||||||||||||
insertColumns(header, false); | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
Block GeneratedColumnPlaceHolderTransformAction::getHeader() const | ||||||||||||||||||||
{ | ||||||||||||||||||||
return header; | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
void GeneratedColumnPlaceHolderTransformAction::checkColumn() const | ||||||||||||||||||||
{ | ||||||||||||||||||||
RUNTIME_CHECK(!generated_column_infos.empty()); | ||||||||||||||||||||
// Validation check. | ||||||||||||||||||||
for (size_t i = 1; i < generated_column_infos.size(); ++i) | ||||||||||||||||||||
{ | ||||||||||||||||||||
RUNTIME_CHECK(std::get<0>(generated_column_infos[i]) > std::get<0>(generated_column_infos[i - 1])); | ||||||||||||||||||||
} | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
void GeneratedColumnPlaceHolderTransformAction::insertColumns(Block & block, bool insert_data) const | ||||||||||||||||||||
{ | ||||||||||||||||||||
if (!block) | ||||||||||||||||||||
return; | ||||||||||||||||||||
|
||||||||||||||||||||
for (const auto & ele : generated_column_infos) | ||||||||||||||||||||
{ | ||||||||||||||||||||
const auto & col_index = std::get<0>(ele); | ||||||||||||||||||||
const auto & col_name = std::get<1>(ele); | ||||||||||||||||||||
const auto & data_type = std::get<2>(ele); | ||||||||||||||||||||
Comment on lines
+50
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Maybe get tuple's value with meaningful const name is better There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Only use for 1 time. I will keep it |
||||||||||||||||||||
ColumnPtr column = nullptr; | ||||||||||||||||||||
if (insert_data) | ||||||||||||||||||||
column = data_type->createColumnConstWithDefaultValue(block.rows()); | ||||||||||||||||||||
else | ||||||||||||||||||||
column = data_type->createColumn(); | ||||||||||||||||||||
block.insert(col_index, ColumnWithTypeAndName{column, data_type, col_name}); | ||||||||||||||||||||
} | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
bool GeneratedColumnPlaceHolderTransformAction::transform(Block & block) | ||||||||||||||||||||
ywqzzy marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||
{ | ||||||||||||||||||||
insertColumns(block, true); | ||||||||||||||||||||
return true; | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
} // namespace DB |
ywqzzy marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// 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 <Core/Block.h> | ||
|
||
namespace DB | ||
{ | ||
class GeneratedColumnPlaceHolderTransformAction | ||
{ | ||
public: | ||
GeneratedColumnPlaceHolderTransformAction( | ||
const Block & header_, | ||
const std::vector<std::tuple<UInt64, String, DataTypePtr>> & generated_column_infos_); | ||
|
||
bool transform(Block & block); | ||
|
||
Block getHeader() const; | ||
|
||
void checkColumn() const; | ||
|
||
private: | ||
void insertColumns(Block & block, bool insert_data) const; | ||
|
||
private: | ||
Block header; | ||
const std::vector<std::tuple<UInt64, String, DataTypePtr>> generated_column_infos; | ||
}; | ||
} // namespace DB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto