This commit is contained in:
Alexey Milovidov 2018-02-28 22:36:01 +03:00
parent c8ca339c24
commit 63467dbcc2
2 changed files with 14 additions and 5 deletions

View File

@ -1,4 +1,5 @@
#include <Common/Exception.h>
#include <Common/FieldVisitors.h>
#include <Core/Block.h>
@ -409,10 +410,16 @@ static ReturnType checkBlockStructure(const Block & lhs, const Block & rhs, cons
return on_error("Block structure mismatch in " + context_description + " stream: different columns:\n"
+ lhs.dumpStructure() + "\n" + rhs.dumpStructure(), ErrorCodes::BLOCKS_HAVE_DIFFERENT_STRUCTURE);
if (actual.column->isColumnConst() && expected.column->isColumnConst()
&& static_cast<const ColumnConst &>(*actual.column).getField() != static_cast<const ColumnConst &>(*expected.column).getField())
return on_error("Block structure mismatch in " + context_description + " stream: different values of constants",
ErrorCodes::BLOCKS_HAVE_DIFFERENT_STRUCTURE);
if (actual.column->isColumnConst() && expected.column->isColumnConst())
{
Field actual_value = static_cast<const ColumnConst &>(*actual.column).getField();
Field expected_value = static_cast<const ColumnConst &>(*expected.column).getField();
if (actual_value != expected_value)
return on_error("Block structure mismatch in " + context_description + " stream: different values of constants, actual: "
+ applyVisitor(FieldVisitorToString(), actual_value) + ", expected: " + applyVisitor(FieldVisitorToString(), expected_value),
ErrorCodes::BLOCKS_HAVE_DIFFERENT_STRUCTURE);
}
}
return ReturnType(true);

View File

@ -338,9 +338,11 @@ public:
{
const auto & elem = block.getByPosition(arguments[0]);
/// Note that the result is not a constant, because it contains block size.
block.getByPosition(result).column
= DataTypeString().createColumnConst(block.rows(),
elem.type->getName() + ", " + elem.column->dumpStructure());
elem.type->getName() + ", " + elem.column->dumpStructure())->convertToFullColumnIfConst();
}
};