protected function handleExpressions(array $expressions)
    {
        $sql = [];

        foreach ($expressions as $expr) {
            switch ($expr['type']) {
                case 'column':
                    $sql[] = $this->wrap($expr['value']);
                    break;
                case 'op':
                    $sql[] = $expr['value'];
                    break;
                case 'value':
                    $sql[] = $this->param($expr['value']);
                    break;
                case 'group':
                    /** @var Expression $expression */
                    $expression = $expr['value'];
                    $sql[] = '(' . $this->handleExpressions($expression->getExpressions()) . ')';
                    break;
                case 'function':
                    $sql[] = $this->handleSqlFunction($expr['value']);
                    break;
                case 'subquery':
                    /** @var Subquery $subquery */
                    $subquery = $expr['value'];
                    $sql[] = '(' . $this->select($subquery->getSQLStatement()) . ')';
                    break;
            }
        }

        return implode(' ', $sql);
    }