private Type analyzeSubquery(
        SubqueryExpression node, StackableAstVisitorContext<Context> context) {
      StatementAnalyzer analyzer =
          statementAnalyzerFactory.apply(node, context.getContext().getCorrelationSupport());
      Scope subqueryScope = Scope.builder().withParent(context.getContext().getScope()).build();
      Scope queryScope = analyzer.analyze(node.getQuery(), subqueryScope);

      ImmutableList.Builder<RowType.Field> fields = ImmutableList.builder();
      for (int i = 0; i < queryScope.getRelationType().getAllFieldCount(); i++) {
        Field field = queryScope.getRelationType().getFieldByIndex(i);
        if (!field.isHidden()) {
          if (field.getName().isPresent()) {
            fields.add(RowType.field(field.getName().get(), field.getType()));
          } else {
            fields.add(RowType.field(field.getType()));
          }
        }
      }

      List<RowType.Field> fieldList = fields.build();

      // Attention: remove this check after supporting RowType
      if (fieldList.size() != 1 || fieldList.get(0).getType() instanceof RowType) {
        throw new SemanticException(SUBQUERY_COLUMN_NUM_CHECK);
      }

      sourceFields.addAll(queryScope.getRelationType().getVisibleFields());
      // return RowType.from(fields.build());
      // For now, we only support one column in subqueries, we have checked this before.
      return getOnlyElement(fields.build().stream().iterator()).getType();
    }
@return the common supertype between the value type and subquery type
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/ExpressionAnalyzer.java