diff --git a/dbms/include/DB/Functions/FunctionsConversion.h b/dbms/include/DB/Functions/FunctionsConversion.h index 357f873f2ae..fba0d381ce1 100644 --- a/dbms/include/DB/Functions/FunctionsConversion.h +++ b/dbms/include/DB/Functions/FunctionsConversion.h @@ -84,11 +84,13 @@ struct ConvertImpl vec_to.resize(size); for (size_t i = 0; i < size; ++i) - vec_to[i] = date_lut.fromDayNum(Yandex::DayNum_t(vec_from[i])); + { + vec_to[i] = date_lut.safeFromDayNum(Yandex::DayNum_t(vec_from[i])); + } } else if (const ColumnConst * col_from = dynamic_cast *>(&*block.getByPosition(arguments[0]).column)) { - block.getByPosition(result).column = new ColumnConst(col_from->size(), date_lut.fromDayNum(Yandex::DayNum_t(col_from->getData()))); + block.getByPosition(result).column = new ColumnConst(col_from->size(), date_lut.safeFromDayNum(Yandex::DayNum_t(col_from->getData()))); } else throw Exception("Illegal column " + block.getByPosition(arguments[0]).column->getName() @@ -121,11 +123,11 @@ struct ConvertImpl vec_to.resize(size); for (size_t i = 0; i < size; ++i) - vec_to[i] = date_lut.toDayNum(vec_from[i]); + vec_to[i] = date_lut.safeToDayNum(vec_from[i]); } else if (const ColumnConst * col_from = dynamic_cast *>(&*block.getByPosition(arguments[0]).column)) { - block.getByPosition(result).column = new ColumnConst(col_from->size(), date_lut.toDayNum(col_from->getData())); + block.getByPosition(result).column = new ColumnConst(col_from->size(), date_lut.safeToDayNum(col_from->getData())); } else throw Exception("Illegal column " + block.getByPosition(arguments[0]).column->getName()