From 44aa30fedfda050576d3d3c4f6efc559c6fbc8ea Mon Sep 17 00:00:00 2001 From: Alexey Arno Date: Tue, 26 Jul 2016 12:18:28 +0300 Subject: [PATCH] dbms: better [#METR-19266] --- .../DataStreams/MaterializingBlockInputStream.h | 11 ++++++++++- .../DataStreams/MaterializingBlockOutputStream.h | 10 ++++++++++ dbms/src/Core/Block.cpp | 15 ++------------- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/dbms/include/DB/DataStreams/MaterializingBlockInputStream.h b/dbms/include/DB/DataStreams/MaterializingBlockInputStream.h index db5362de96c..d99621ed1c9 100644 --- a/dbms/include/DB/DataStreams/MaterializingBlockInputStream.h +++ b/dbms/include/DB/DataStreams/MaterializingBlockInputStream.h @@ -1,7 +1,8 @@ #pragma once #include - +#include +#include #include @@ -41,7 +42,15 @@ protected: auto & src = res.getByPosition(i).column; ColumnPtr converted = src->convertToFullColumnIfConst(); if (converted) + { src = converted; + auto & type = res.getByPosition(i).type; + if (type.get()->isNull()) + { + /// A ColumnNull that is converted to a full column has the type DataTypeUInt8. + type = std::make_shared(std::make_shared()); + } + } } return res; diff --git a/dbms/include/DB/DataStreams/MaterializingBlockOutputStream.h b/dbms/include/DB/DataStreams/MaterializingBlockOutputStream.h index 1e1cbc880dc..8db8bfadc22 100644 --- a/dbms/include/DB/DataStreams/MaterializingBlockOutputStream.h +++ b/dbms/include/DB/DataStreams/MaterializingBlockOutputStream.h @@ -1,6 +1,8 @@ #pragma once #include +#include +#include #include #include @@ -42,7 +44,15 @@ private: auto & src = block.getByPosition(i).column; ColumnPtr converted = src->convertToFullColumnIfConst(); if (converted) + { src = converted; + auto & type = block.getByPosition(i).type; + if (type.get()->isNull()) + { + /// A ColumnNull that is converted to a full column has the type DataTypeUInt8. + type = std::make_shared(std::make_shared()); + } + } } return block; diff --git a/dbms/src/Core/Block.cpp b/dbms/src/Core/Block.cpp index cf0e76b512e..67c7d506008 100644 --- a/dbms/src/Core/Block.cpp +++ b/dbms/src/Core/Block.cpp @@ -404,19 +404,8 @@ Block Block::extractNonNullableBlock(const ColumnNumbers & arguments) const auto nullable_col = static_cast(col.column.get()); ColumnPtr nested_col = nullable_col->getNestedColumn(); - DataTypePtr nested_type; - - if (col.type.get()->isNull()) - { - /// A ColumnNull that is converted to a full column has the type DataTypeUInt8. - nested_type = std::make_shared(); - } - else - { - auto nullable_type = static_cast(col.type.get()); - nested_type = nullable_type->getNestedType(); - - } + auto nullable_type = static_cast(col.type.get()); + DataTypePtr nested_type = nullable_type->getNestedType(); non_nullable_block.insert(pos, {nested_col, nested_type, col.name}); }