mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Fixed error #1947
This commit is contained in:
parent
c8ca339c24
commit
63467dbcc2
@ -1,4 +1,5 @@
|
|||||||
#include <Common/Exception.h>
|
#include <Common/Exception.h>
|
||||||
|
#include <Common/FieldVisitors.h>
|
||||||
|
|
||||||
#include <Core/Block.h>
|
#include <Core/Block.h>
|
||||||
|
|
||||||
@ -409,11 +410,17 @@ static ReturnType checkBlockStructure(const Block & lhs, const Block & rhs, cons
|
|||||||
return on_error("Block structure mismatch in " + context_description + " stream: different columns:\n"
|
return on_error("Block structure mismatch in " + context_description + " stream: different columns:\n"
|
||||||
+ lhs.dumpStructure() + "\n" + rhs.dumpStructure(), ErrorCodes::BLOCKS_HAVE_DIFFERENT_STRUCTURE);
|
+ lhs.dumpStructure() + "\n" + rhs.dumpStructure(), ErrorCodes::BLOCKS_HAVE_DIFFERENT_STRUCTURE);
|
||||||
|
|
||||||
if (actual.column->isColumnConst() && expected.column->isColumnConst()
|
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",
|
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);
|
ErrorCodes::BLOCKS_HAVE_DIFFERENT_STRUCTURE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ReturnType(true);
|
return ReturnType(true);
|
||||||
}
|
}
|
||||||
|
@ -338,9 +338,11 @@ public:
|
|||||||
{
|
{
|
||||||
const auto & elem = block.getByPosition(arguments[0]);
|
const auto & elem = block.getByPosition(arguments[0]);
|
||||||
|
|
||||||
|
/// Note that the result is not a constant, because it contains block size.
|
||||||
|
|
||||||
block.getByPosition(result).column
|
block.getByPosition(result).column
|
||||||
= DataTypeString().createColumnConst(block.rows(),
|
= DataTypeString().createColumnConst(block.rows(),
|
||||||
elem.type->getName() + ", " + elem.column->dumpStructure());
|
elem.type->getName() + ", " + elem.column->dumpStructure())->convertToFullColumnIfConst();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user