dbms: fixed error when writing tuple of date or datetime elements in pretty formats (tnx. hertz) [#METR-2944].

This commit is contained in:
Alexey Milovidov 2014-11-23 07:00:18 +03:00
parent 53fc3b7cd2
commit be73e48c46
3 changed files with 20 additions and 5 deletions

View File

@ -273,13 +273,24 @@ void FunctionVisibleWidth::execute(Block & block, const ColumnNumbers & argument
additional_symbols += 2; /// Кавычки.
}
ColumnUInt64 * nested_result_column = typeid_cast<ColumnUInt64 *>(&*nested_block.getByPosition(nested_block.columns() - 1).column);
ColumnUInt64::Container_t & nested_res = nested_result_column->getData();
ColumnPtr & nested_result_column = nested_block.getByPosition(nested_block.columns() - 1).column;
for (size_t i = 0; i < rows; ++i)
nested_res[i] += 2 + additional_symbols;
if (nested_result_column->isConst())
{
ColumnConstUInt64 & nested_result_column_const = typeid_cast<ColumnConstUInt64 &>(*nested_result_column);
if (nested_result_column_const.size())
nested_result_column_const.getData() += 2 + additional_symbols;
}
else
{
ColumnUInt64 & nested_result_column_vec = typeid_cast<ColumnUInt64 &>(*nested_result_column);
ColumnUInt64::Container_t & nested_res = nested_result_column_vec.getData();
block.getByPosition(result).column = nested_block.getByPosition(nested_block.columns() - 1).column;
for (size_t i = 0; i < rows; ++i)
nested_res[i] += 2 + additional_symbols;
}
block.getByPosition(result).column = nested_result_column;
}
else if (const ColumnConstArray * col = typeid_cast<const ColumnConstArray *>(&*column))
{

View File

@ -0,0 +1,3 @@
┌─x───────────────────────────┐
│ ('2000-01-01','2000-01-01') │
└─────────────────────────────┘

View File

@ -0,0 +1 @@
SELECT (toDate('2000-01-01'), toDate('2000-01-01')) AS x FORMAT PrettyCompact;