presto-main/src/main/java/io/prestosql/sql/analyzer/ExpressionAnalyzer.java/Visitor/visitFormat
class Visitor:        @Override
        protected Type visitFormat(Format node, StackableAstVisitorContext<Context> context)
        {
            List<Type> arguments = node.getArguments().stream()
                    .map(expression -> process(expression, context))
                    .collect(toImmutableList());

            if (!isVarcharType(arguments.get(0))) {
                throw semanticException(TYPE_MISMATCH, node.getArguments().get(0), "Type of first argument to format() must be VARCHAR (actual: %s)", arguments.get(0));
            }

            for (int i = 1; i < arguments.size(); i++) {
                try {
                    FormatFunction.validateType(metadata, arguments.get(i));
                }
                catch (PrestoException e) {
                    if (e.getErrorCode().equals(NOT_SUPPORTED.toErrorCode())) {
                        throw semanticException(NOT_SUPPORTED, node.getArguments().get(i), "%s", e.getRawMessage());
                    }
                    throw e;
                }
            }

            return setExpressionType(node, VARCHAR);
        }