protected function _sqlCompiler(&$sql, $query, $generator)
    {
        return function ($parts, $name) use (&$sql, $query, $generator) {
            if (!isset($parts) ||
                ((is_array($parts) || $parts instanceof \Countable) && !count($parts))
            ) {
                return;
            }
            if ($parts instanceof ExpressionInterface) {
                $parts = [$parts->sql($generator)];
            }
            if (isset($this->_templates[$name])) {
                $parts = $this->_stringifyExpressions((array)$parts, $generator);

                return $sql .= sprintf($this->_templates[$name], implode(', ', $parts));
            }

            return $sql .= $this->{'_build' . ucfirst($name) . 'Part'}($parts, $query, $generator);
        };
    }