@Override
    protected Type visitSubqueryExpression(SubqueryExpression node, AnalysisContext context) {
      StatementAnalyzer analyzer = statementAnalyzerFactory.apply(node);
      TupleDescriptor descriptor = analyzer.process(node.getQuery(), context);

      // Scalar subqueries should only produce one column
      if (descriptor.getVisibleFieldCount() != 1) {
        throw new SemanticException(
            MULTIPLE_FIELDS_FROM_SCALAR_SUBQUERY,
            node,
            "Subquery expression must produce only one field. Found %s",
            descriptor.getVisibleFieldCount());
      }

      Type type = Iterables.getOnlyElement(descriptor.getVisibleFields()).getType();

      expressionTypes.put(node, type);
      return type;
    }