diff --git a/dbms/src/DataStreams/RemoteBlockInputStream.cpp b/dbms/src/DataStreams/RemoteBlockInputStream.cpp index eb576075f80..9e9d47f9516 100644 --- a/dbms/src/DataStreams/RemoteBlockInputStream.cpp +++ b/dbms/src/DataStreams/RemoteBlockInputStream.cpp @@ -164,7 +164,18 @@ static Block adaptBlockStructure(const Block & block, const Block & header, cons res.info = block.info; for (const auto & elem : header) - res.insert({ castColumn(block.getByName(elem.name), elem.type, context), elem.type, elem.name }); + { + ColumnPtr column; + + if (elem.column && isColumnConst(*elem.column)) + /// TODO: check that column from block contains the same value. + /// TODO: serialize const columns. + column = elem.column->cloneResized(block.rows()); + else + column = castColumn(block.getByName(elem.name), elem.type, context); + + res.insert({column, elem.type, elem.name}); + } return res; }