Header in every stream: development [#CLICKHOUSE-2]

This commit is contained in:
Alexey Milovidov 2018-02-17 20:09:18 +03:00
parent 84c110a8ae
commit 9e1638e1dd
2 changed files with 8 additions and 7 deletions

View File

@ -23,6 +23,7 @@
#include <DataTypes/getMostSubtype.h>
#include <Core/TypeListNumber.h>
namespace DB
{
@ -156,7 +157,7 @@ public:
++index;
}
ColumnPtr getNullMapData() && { return std::move(sink_null_map_holder); }
ColumnPtr getNullMapColumnPtr() && { return std::move(sink_null_map_holder); }
private:
const UInt8 * src_null_map = nullptr;
@ -776,25 +777,25 @@ DataTypePtr FunctionArrayElement::getReturnTypeImpl(const DataTypes & arguments)
void FunctionArrayElement::executeImpl(Block & block, const ColumnNumbers & arguments, size_t result)
{
/// Check nullability.
bool is_nullable_array = false;
bool is_array_of_nullable = false;
const ColumnArray * col_array = nullptr;
const ColumnArray * col_const_array = nullptr;
col_array = checkAndGetColumn<ColumnArray>(block.getByPosition(arguments[0]).column.get());
if (col_array)
is_nullable_array = col_array->getData().isColumnNullable();
is_array_of_nullable = col_array->getData().isColumnNullable();
else
{
col_const_array = checkAndGetColumnConstData<ColumnArray>(block.getByPosition(arguments[0]).column.get());
if (col_const_array)
is_nullable_array = col_const_array->getData().isColumnNullable();
is_array_of_nullable = col_const_array->getData().isColumnNullable();
else
throw Exception("Illegal column " + block.getByPosition(arguments[0]).column->getName()
+ " of first argument of function " + getName(), ErrorCodes::ILLEGAL_COLUMN);
}
if (!is_nullable_array)
if (!is_array_of_nullable)
{
ArrayImpl::NullMapBuilder builder;
perform(block, arguments, result, builder);
@ -860,7 +861,7 @@ void FunctionArrayElement::executeImpl(Block & block, const ColumnNumbers & argu
/// Store the result.
const ColumnWithTypeAndName & source_col = source_block.getByPosition(2);
ColumnWithTypeAndName & dest_col = block.getByPosition(result);
dest_col.column = ColumnNullable::create(source_col.column, std::move(builder).getNullMapData());
dest_col.column = ColumnNullable::create(source_col.column, builder ? std::move(builder).getNullMapColumnPtr() : ColumnUInt8::create());
}
}

View File

@ -15,7 +15,7 @@
#include <vector>
// TODO: https://stackoverflow.com/questions/16464032/how-to-enhance-this-variable-dumping-debug-macro-to-be-variadic
#define DUMPS(VAR) #VAR " = " << VAR
#define DUMPS(VAR) #VAR " = " << (VAR)
#define DUMPHEAD std::cerr << __FILE__ << ":" << __LINE__ << " "
#define DUMP(V1) DUMPHEAD << DUMPS(V1) << "\n";
#define DUMP2(V1, V2) DUMPHEAD << DUMPS(V1) << ", " << DUMPS(V2) << "\n";