| 687 | } |
| 688 | |
| 689 | void HashJoin::initRightBlockStructure(Block & saved_block_sample) |
| 690 | { |
| 691 | /// We could remove key columns for LEFT | INNER HashJoin but we should keep them for JoinSwitcher (if any). |
| 692 | bool save_key_columns = !table_join->forceHashJoin() || isRightOrFull(kind) || table_join->getRuntimeFilterConsumer() != nullptr; |
| 693 | if (save_key_columns) |
| 694 | { |
| 695 | saved_block_sample = right_table_keys.cloneEmpty(); |
| 696 | } |
| 697 | else if (strictness == ASTTableJoin::Strictness::Asof) |
| 698 | { |
| 699 | /// Save ASOF key |
| 700 | saved_block_sample.insert(right_table_keys.safeGetByPosition(right_table_keys.columns() - 1)); |
| 701 | } |
| 702 | |
| 703 | /// Save non key columns |
| 704 | for (auto & column : sample_block_with_columns_to_add) |
| 705 | saved_block_sample.insert(column); |
| 706 | |
| 707 | if (nullable_right_side) |
| 708 | JoinCommon::convertColumnsToNullable(saved_block_sample, (isFull(kind) ? right_table_keys.columns() : 0)); |
| 709 | } |
| 710 | |
| 711 | Block HashJoin::structureRightBlock(const Block & block) const |
| 712 | { |
nothing calls this directly
no test coverage detected