protected function compileOrdering(array $ordering): string
    {
        $result = [];
        foreach ($ordering as $order) {
            $direction = strtoupper($order[1]);

            if (!in_array($direction, ['ASC', 'DESC'])) {
                throw new CompilerException("Invalid sorting direction, only ASC and DESC are allowed");
            }

            $result[] = $this->quote($order[0]) . ' ' . $direction;
        }

        return implode(', ', $result);
    }