diff --git a/cpp-ch/local-engine/Shuffle/ShuffleSplitter.cpp b/cpp-ch/local-engine/Shuffle/ShuffleSplitter.cpp index b6aabf59344b..8955646bf16a 100644 --- a/cpp-ch/local-engine/Shuffle/ShuffleSplitter.cpp +++ b/cpp-ch/local-engine/Shuffle/ShuffleSplitter.cpp @@ -30,6 +30,7 @@ #include #include #include +#include namespace local_engine { @@ -305,8 +306,18 @@ void ColumnsBuffer::appendSelective( } if (!accumulated_columns[column_idx]->onlyNull()) { - accumulated_columns[column_idx]->insertRangeSelective( - *source.getByPosition(column_idx).column->convertToFullColumnIfConst(), selector, from, length); + auto * nullable_column = checkAndGetColumn(*source.getByPosition(column_idx).column); + if (!nullable_column) + { + accumulated_columns[column_idx]->insertRangeSelective( + *source.getByPosition(column_idx).column->convertToFullColumnIfConst(), selector, from, length); + } + else + { + auto * dst_column = typeid_cast(accumulated_columns[column_idx].get()); + dst_column->getNestedColumn().insertRangeSelective(nullable_column->getNestedColumn(), selector, from, length); + dst_column->getNullMapColumn().insertRangeSelective(nullable_column->getNullMapColumn(), selector, from, length); + } } else {