-
Notifications
You must be signed in to change notification settings - Fork 409
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
auto pass through hashagg #9167
Merged
ti-chi-bot
merged 130 commits into
pingcap:master
from
guo-shaoge:auto_passthrough_hashagg
Aug 7, 2024
Merged
Changes from 119 commits
Commits
Show all changes
130 commits
Select commit
Hold shift + click to select a range
cd6cbea
selective: updateWeakHash32 done
guo-shaoge bf2af85
selective: scatterTo
guo-shaoge 2e3662d
selective: scatter
guo-shaoge dab162f
mpp writer
guo-shaoge fd21bf1
1. Aggregator: support collect_hit_rate and only_lookup
guo-shaoge 5e803e2
execution: support auto pass operator/stream
guo-shaoge 957c8e1
fix wrong check
guo-shaoge 82883fe
interpter support auto pass through
guo-shaoge 7b5320e
unit test
guo-shaoge f9105ec
Merge branch 'master' of github.com:pingcap/tiflash into auto_passthr…
guo-shaoge b469fa2
unit test for auto pass context
guo-shaoge 59422ca
unit test for executor
guo-shaoge 0db738e
fmt
guo-shaoge a7e8036
getPassThroughBlock && integration unit test
guo-shaoge 3b588c2
fix AutoPassThroughHashAggContext/ColumnString todo
guo-shaoge 6d646d9
updateWeakHash32 declaration
guo-shaoge 4df0268
fix lookupImpl && fix getNotFoundRows && getPassThroughBlock()
guo-shaoge 605c4ba
use findKey for only_lookup;
guo-shaoge 3aa40cc
row_limit_unit
guo-shaoge 1db168a
fix some todo
guo-shaoge c30b4bf
fmt
guo-shaoge 047f4ed
tipb
guo-shaoge c0018b7
del setHitBit
guo-shaoge a7d444b
statistics
guo-shaoge 9fb0cb1
fmt
guo-shaoge 0f4cc76
fmt
guo-shaoge d43a8de
Merge branch 'master' of ssh://github.com/pingcap/tiflash into auto_p…
guo-shaoge 7125e5a
fmt
guo-shaoge f28933a
fix some todo
guo-shaoge 285dd6f
fix some todo
guo-shaoge a5d6382
try fix unit-test
guo-shaoge 313d822
try fix unit-test
guo-shaoge 31aab83
add check_block_selective for expression stream
guo-shaoge e1a5718
fix some todo
guo-shaoge 2d3f579
fix case
guo-shaoge 75cf66f
handle empty data without group by key
guo-shaoge 978207e
empty tbl test
guo-shaoge 496cd20
fix fill def agg func bug
guo-shaoge c02cc8f
fix empty tbl case
guo-shaoge 45e77bb
3-value tiflash_pre_agg_mode
guo-shaoge 8db40e7
update tipb
guo-shaoge 877e833
remove switcher
guo-shaoge d8737b4
fix
guo-shaoge f41bb30
tipb
guo-shaoge 98e90e6
fix
guo-shaoge db539b3
refine
guo-shaoge 4022883
fix
guo-shaoge 8e9fdc3
Merge branch 'master' of github.com:pingcap/tiflash into auto_passthr…
guo-shaoge 4ad1654
support selective block for MPPExchangeWriter
guo-shaoge 162bd6e
unit-test
guo-shaoge 0c4592c
scatter unit-test
guo-shaoge 2d44281
fix
guo-shaoge bc6d280
fix
guo-shaoge 29f6ea2
scatterTo unittest
guo-shaoge 018e208
fix
guo-shaoge 77826d8
fix
guo-shaoge 4e63522
add updateWeakHash32Impl
guo-shaoge 18cf199
refine
guo-shaoge aa0ea6b
refine
guo-shaoge 954e903
check block.info runtime
guo-shaoge b50063e
refine LoopOneColumn
guo-shaoge db21b5a
refine
guo-shaoge 35b38e5
refine
guo-shaoge 643d1b6
Merge branch 'master' of github.com:pingcap/tiflash into auto_passthr…
guo-shaoge 7470ef1
fix getPassThroughBlock
guo-shaoge 60a8559
Merge branch 'master' of github.com:pingcap/tiflash into selective_block
guo-shaoge 4eaa2b0
Merge branch 'selective_block' of github.com:guo-shaoge/tiflash into …
guo-shaoge c98d332
fix conflict
guo-shaoge 569053a
del checkSelective
guo-shaoge 0a4148a
log
guo-shaoge 6cecb2c
disable selective check for expression block input stream
guo-shaoge ed6033b
disable state switch
guo-shaoge d4a1ac6
Revert "disable state switch"
guo-shaoge e471184
Revert "disable selective check for expression block input stream"
guo-shaoge 717dced
fix select template for exchange sender
guo-shaoge b25dee7
fix auto pass through integration case(need fix todos later)
guo-shaoge 6df41d0
optimize getPassThroughBlock
guo-shaoge 839e0cb
case for AutoPassThroughHashAggHelper
guo-shaoge 9a03f59
benchmark for setupAutoPassThroughColumnGenerator
guo-shaoge 8a8d9b6
fix some todos
guo-shaoge 41783c8
fix projection
guo-shaoge 1f71029
tmp disable send block in advance
guo-shaoge 45f033d
Revert "tmp disable send block in advance"
guo-shaoge 926d79e
tmp refine count col generator
guo-shaoge f5d1ba9
tmp change decimal infer
guo-shaoge 9d5e7e3
tmp some log
guo-shaoge b4323f7
tmp disable expression copy block info
guo-shaoge 8ba8bc3
tmp log agg expr actions
guo-shaoge 7d99144
log expression block input stream time
guo-shaoge 00b8b4e
tmp remove cast after agg
guo-shaoge 77ab379
tmp debug exchange sender(and header in executeQuery)
guo-shaoge 837284d
tmp disable cast in final projection
guo-shaoge b4a1510
Revert "tmp disable cast in final projection"
guo-shaoge 70f4329
tmp hack count: count return int64; count gen didn't check nullable
guo-shaoge 826734f
refine
guo-shaoge 6e2a5a5
Merge branch 'master' of github.com:pingcap/tiflash into auto_passthr…
guo-shaoge 7a675b0
refine
guo-shaoge 35a742c
fix case
guo-shaoge e08f0ce
refine sum(null)/count(1)/min/max
guo-shaoge d6c8059
refine
guo-shaoge a430c69
refine case
guo-shaoge fd6b49c
lint
guo-shaoge b07a871
del template fro ExpressionBlockInputStream
guo-shaoge 0d0e1ec
refine comment; add check for ExpressionBlockInputStream
guo-shaoge c060643
fix build
guo-shaoge ed65697
refine auto pass through helper
guo-shaoge 947a19e
check block.info.selective runtime
guo-shaoge 97b46f3
refine
guo-shaoge 2f15000
enable -> enabled
guo-shaoge 38b323b
refine log
guo-shaoge 60736a1
fmt
guo-shaoge cb8098c
aggresive pass through policy
guo-shaoge 411633a
refine stream
guo-shaoge 8a508a1
fix cycle reference
guo-shaoge c75ac8c
refine setParent; add spillable case
guo-shaoge dcfd99c
refine forceState()
guo-shaoge 8c5960b
refine case(spill not-spill)
guo-shaoge 1cd2063
refine
guo-shaoge a8bf0f0
del spill case
guo-shaoge 4c04f55
clear spill callback for auto pass
guo-shaoge c02793f
refine spill case
guo-shaoge cd9ed17
refine comment
guo-shaoge 19bf804
update continusous limit logic
guo-shaoge 35f5fc7
finish spillable stage
guo-shaoge 0100f6b
fmt
guo-shaoge 76a1e34
Merge branch 'master' into auto_passthrough_hashagg
guo-shaoge a5af40c
fix recursiveSetBlockInputStreamParent
guo-shaoge c3be1a9
Compression: add microbenchmark (#9293)
Lloyd-Pottiger 7c49f3f
Revert "Compression: add microbenchmark (#9293)"
guo-shaoge d1447f2
Merge branch 'master' into auto_passthrough_hashagg
guo-shaoge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
48 changes: 48 additions & 0 deletions
48
dbms/src/DataStreams/AutoPassThroughAggregatingBlockInputStream.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,48 @@ | ||
// Copyright 2024 PingCAP, Inc. | ||
// | ||
// 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/AutoPassThroughAggregatingBlockInputStream.h> | ||
|
||
namespace DB | ||
{ | ||
|
||
template <bool force_streaming> | ||
Block AutoPassThroughAggregatingBlockInputStream<force_streaming>::readImpl() | ||
{ | ||
while (!build_done) | ||
{ | ||
Block block = children[0]->read(); | ||
if (block) | ||
{ | ||
auto_pass_through_context->onBlock<force_streaming>(block); | ||
} | ||
else | ||
{ | ||
build_done = true; | ||
break; | ||
} | ||
|
||
if (auto res = auto_pass_through_context->tryGetDataInAdvance()) | ||
return res; | ||
} | ||
|
||
assert(build_done); | ||
|
||
if (auto res = auto_pass_through_context->tryGetDataInAdvance()) | ||
return res; | ||
|
||
return auto_pass_through_context->getDataFromHashTable(); | ||
} | ||
|
||
} // namespace DB |
60 changes: 60 additions & 0 deletions
60
dbms/src/DataStreams/AutoPassThroughAggregatingBlockInputStream.h
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,60 @@ | ||
// Copyright 2024 PingCAP, Inc. | ||
// | ||
// 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/IProfilingBlockInputStream.h> | ||
#include <Interpreters/Aggregator.h> | ||
#include <Operators/AutoPassThroughHashAggContext.h> | ||
|
||
namespace DB | ||
{ | ||
static constexpr std::string_view autoPassThroughAggregatingExtraInfo = "auto pass through"; | ||
|
||
template <bool force_streaming> | ||
class AutoPassThroughAggregatingBlockInputStream : public IProfilingBlockInputStream | ||
{ | ||
static constexpr auto NAME = "Aggregating"; | ||
|
||
public: | ||
AutoPassThroughAggregatingBlockInputStream( | ||
const BlockInputStreamPtr & input_, | ||
const Aggregator::Params & params_, | ||
const String & req_id, | ||
UInt64 row_limit_unit) | ||
{ | ||
children.push_back(input_); | ||
auto_pass_through_context = std::make_unique<AutoPassThroughHashAggContext>( | ||
children[0]->getHeader(), | ||
params_, | ||
[&]() { return this->isCancelled(); }, | ||
req_id, | ||
row_limit_unit); | ||
} | ||
|
||
String getName() const override { return NAME; } | ||
|
||
Block getHeader() const override { return auto_pass_through_context->getHeader(); } | ||
|
||
protected: | ||
Block readImpl() override; | ||
|
||
private: | ||
AutoPassThroughHashAggContextPtr auto_pass_through_context; | ||
bool build_done = false; | ||
}; | ||
|
||
template class AutoPassThroughAggregatingBlockInputStream<true>; | ||
template class AutoPassThroughAggregatingBlockInputStream<false>; | ||
} // 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 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
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
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 |
---|---|---|
|
@@ -93,6 +93,7 @@ void PhysicalPlan::build(const tipb::Executor * executor) | |
{ | ||
RUNTIME_CHECK(executor); | ||
RUNTIME_CHECK(executor->has_executor_id()); | ||
|
||
const auto & executor_id = executor->executor_id(); | ||
switch (executor->tp()) | ||
{ | ||
|
@@ -312,10 +313,23 @@ String PhysicalPlan::toString() const | |
return PhysicalPlanVisitor::visitToString(root_node); | ||
} | ||
|
||
void recursiveSetBlockInputStreamParent(BlockInputStreamPtr self, const IBlockInputStream * parent) | ||
{ | ||
if (self->getParent() != nullptr) | ||
return; | ||
|
||
for (auto & child : self->getChildren()) | ||
{ | ||
recursiveSetBlockInputStreamParent(child, self.get()); | ||
} | ||
self->setParent(parent); | ||
} | ||
|
||
void PhysicalPlan::buildBlockInputStream(DAGPipeline & pipeline, Context & context, size_t max_streams) | ||
{ | ||
RUNTIME_CHECK(root_node); | ||
root_node->buildBlockInputStream(pipeline, context, max_streams); | ||
pipeline.transform([](auto & stream) { recursiveSetBlockInputStreamParent(stream, nullptr); }); | ||
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. I think you need call this 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. done |
||
} | ||
|
||
PipelinePtr PhysicalPlan::toPipeline(PipelineExecutorContext & exec_context, Context & context) | ||
|
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think you need first check if
parent
is set, otherwise it may meet performance issues like #4494There 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.
done