Fixed error found by M.Filimonov [#CLICKHOUSE-2].

This commit is contained in:
Alexey Milovidov 2017-12-23 04:35:25 +03:00
parent 62bccc4eef
commit 75f9ff1717
2 changed files with 3 additions and 3 deletions

View File

@ -21,7 +21,7 @@ static std::string extractTimeZoneNameFromColumn(const IColumn & column)
std::string extractTimeZoneNameFromFunctionArguments(const ColumnsWithTypeAndName & arguments, size_t time_zone_arg_num, size_t datetime_arg_num)
{
/// Explicit time zone may be passed in last argument.
if (arguments.size() == time_zone_arg_num + 1)
if (arguments.size() == time_zone_arg_num + 1 && arguments[time_zone_arg_num].column)
{
return extractTimeZoneNameFromColumn(*arguments[time_zone_arg_num].column);
}

View File

@ -837,13 +837,13 @@ public:
void getReturnTypeAndPrerequisitesImpl(
const ColumnsWithTypeAndName & arguments, DataTypePtr & out_return_type, ExpressionActions::Actions & /*out_prerequisites*/) override
{
auto index_col = checkAndGetColumnConst<ColumnUInt8>(&*arguments[1].column);
auto index_col = checkAndGetColumnConst<ColumnUInt8>(arguments[1].column.get());
if (!index_col)
throw Exception("Second argument to " + getName() + " must be a constant UInt8", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
size_t index = index_col->getValue<UInt8>();
const DataTypeTuple * tuple = checkAndGetDataType<DataTypeTuple>(&*arguments[0].type);
const DataTypeTuple * tuple = checkAndGetDataType<DataTypeTuple>(arguments[0].type.get());
if (!tuple)
throw Exception("First argument for function " + getName() + " must be tuple.", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);