diff --git a/src/Interpreters/HashJoin.cpp b/src/Interpreters/HashJoin.cpp index fbd9d522f47..f994336cd53 100644 --- a/src/Interpreters/HashJoin.cpp +++ b/src/Interpreters/HashJoin.cpp @@ -1102,13 +1102,20 @@ public: for (size_t i = 0; i < this->size(); ++i) { auto& col = columns[i]; + size_t default_count = 0; for (size_t j = 0; j < lazy_output.blocks.size(); ++j) { if (!lazy_output.blocks[j]) { - type_name[i].type->insertDefaultInto(*col); +// type_name[i].type->insertDefaultInto(*col); + default_count ++; continue; } + if (default_count > 0) + { + JoinCommon::addDefaultValues(*col, type_name[i].type, default_count); + default_count = 0; + } const auto & column_from_block = reinterpret_cast(lazy_output.blocks[j])->getByPosition(right_indexes[i]); /// If it's joinGetOrNull, we need to wrap not-nullable columns in StorageJoin. if (is_join_get) @@ -1122,6 +1129,11 @@ public: } col->insertFrom(*column_from_block.column, lazy_output.row_nums[j]); } + if (default_count > 0) + { + JoinCommon::addDefaultValues(*col, type_name[i].type, default_count); + default_count = 0; + } } }