From 59814c06edece89edfaedb26df48d78064c59655 Mon Sep 17 00:00:00 2001 From: Michael Kolupaev Date: Wed, 5 Jun 2013 09:56:47 +0000 Subject: [PATCH] clickhouse: fixed replicate [#CONV-7444]. --- dbms/include/DB/Functions/FunctionsMiscellaneous.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dbms/include/DB/Functions/FunctionsMiscellaneous.h b/dbms/include/DB/Functions/FunctionsMiscellaneous.h index 30170cc580e..bdbed02bd5e 100644 --- a/dbms/include/DB/Functions/FunctionsMiscellaneous.h +++ b/dbms/include/DB/Functions/FunctionsMiscellaneous.h @@ -730,11 +730,13 @@ class FunctionReplicate : public IFunction ColumnConstArray * const_array_column = dynamic_cast(&*block.getByPosition(arguments[1]).column); if (!const_array_column) throw Exception("Unexpected column for replicate", ErrorCodes::ILLEGAL_COLUMN); - ColumnPtr temp_column = const_array_column->convertToFullColumn(); + temp_column = const_array_column->convertToFullColumn(); array_column = dynamic_cast(&*temp_column); } res = first_column->replicate(array_column->getOffsets()); + if (res->isConst()) + res = dynamic_cast(&*res).convertToFullColumn(); res = new ColumnArray(res, array_column->getOffsetsColumn()); block.getByPosition(result).column = res;