```
SET compile_expressions = 1
SELECT GREATEST(2,0)
```

{
        ColumnNumbers new_arguments = arguments;
        if (WhichDataType(block.getByPosition(new_arguments[1]).type).isAggregateFunction())
            std::swap(new_arguments[0], new_arguments[1]);
        if (!isColumnConst(*block.getByPosition(new_arguments[1]).column))
            throw Exception{"Illegal column " + block.getByPosition(new_arguments[1]).column->getName()
                + " of argument of aggregation state multiply. Should be integer constant", ErrorCodes::ILLEGAL_COLUMN};
        const IColumn & agg_state_column = *block.getByPosition(new_arguments[0]).column;
        bool agg_state_is_const = isColumnConst(agg_state_column);
        const ColumnAggregateFunction & column = typeid_cast<const ColumnAggregateFunction &>(
            agg_state_is_const ? assert_cast<const ColumnConst &>(agg_state_column).getDataColumn() : agg_state_column);
        AggregateFunctionPtr function = column.getAggregateFunction();
        size_t size = agg_state_is_const ? 1 : input_rows_count;
        auto column_to = ColumnAggregateFunction::create(function);
        column_to->reserve(size);
        auto column_from = ColumnAggregateFunction::create(function);
        column_from->reserve(size);
        for (size_t i = 0; i < size; ++i)
        {
            column_to->insertDefault();
            column_from->insertFrom(column.getData()[i]);
        }
        auto & vec_to = column_to->getData();
        auto & vec_from = column_from->getData();