Skip to content

Commit

Permalink
fix tiflash assert failure (pingcap#9456)
Browse files Browse the repository at this point in the history
ref pingcap#9430

Signed-off-by: xufei <[email protected]>
  • Loading branch information
windtalker committed Sep 23, 2024
1 parent 6f6b390 commit 452ba44
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dbms/src/Flash/Planner/Plans/PhysicalJoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ void PhysicalJoin::probeSideTransform(DAGPipeline & probe_pipeline, Context & co
execId(),
needScanHashMapAfterProbe(join_ptr->getKind()));
join_ptr->initProbe(probe_pipeline.firstStream()->getHeader(), probe_pipeline.streams.size());
join_ptr->setCancellationHook([&] { return context.isCancelled(); });
size_t probe_index = 0;
for (auto & stream : probe_pipeline.streams)
{
Expand All @@ -239,6 +238,7 @@ void PhysicalJoin::probeSideTransform(DAGPipeline & probe_pipeline, Context & co
settings.max_block_size);
stream->setExtraInfo(join_probe_extra_info);
}
join_ptr->setCancellationHook([&] { return context.isCancelled(); });
}

void PhysicalJoin::buildSideTransform(DAGPipeline & build_pipeline, Context & context, size_t max_streams)
Expand Down
1 change: 0 additions & 1 deletion dbms/src/Flash/Planner/Plans/PhysicalJoinBuild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ void PhysicalJoinBuild::buildPipelineExecGroupImpl(
join_execute_info.join_build_profile_infos = group_builder.getCurProfileInfos();
join_ptr->initBuild(group_builder.getCurrentHeader(), group_builder.concurrency());
join_ptr->setInitActiveBuildThreads();
join_ptr->setCancellationHook([&]() { return exec_context.isCancelled(); });
join_ptr.reset();
}
} // namespace DB
1 change: 1 addition & 0 deletions dbms/src/Flash/Planner/Plans/PhysicalJoinProbe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ void PhysicalJoinProbe::buildPipelineExecGroupImpl(
max_block_size,
input_header));
});
join_ptr->setCancellationHook([&]() { return exec_context.isCancelled(); });
join_ptr.reset();
}
} // namespace DB
7 changes: 6 additions & 1 deletion dbms/src/Interpreters/Join.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1352,8 +1352,10 @@ Block Join::doJoinBlockHash(ProbeProcessInfo & probe_process_info) const

Block Join::removeUselessColumn(Block & block) const
{
// cancelled
if (!block)
return block;

Block projected_block;
for (const auto & name : tidb_output_column_names)
{
Expand Down Expand Up @@ -2017,8 +2019,11 @@ Block Join::joinBlock(ProbeProcessInfo & probe_process_info, bool dry_run) const
else
block = joinBlockHash(probe_process_info);

// if cancelled, just return empty block
if (!block)
return block;
/// for (cartesian)antiLeftSemi join, the meaning of "match-helper" is `non-matched` instead of `matched`.
if (block && (kind == LeftOuterAnti || kind == Cross_LeftOuterAnti))
if (kind == LeftOuterAnti || kind == Cross_LeftOuterAnti)
{
const auto * nullable_column
= checkAndGetColumn<ColumnNullable>(block.getByName(match_helper_name).column.get());
Expand Down

0 comments on commit 452ba44

Please sign in to comment.