private ISchemaTree analyzeSchema(
      QueryStatement queryStatement, Analysis analysis, MPPQueryContext context) {
    // concat path and construct path pattern tree
    ConcatPathRewriter concatPathRewriter = new ConcatPathRewriter();
    queryStatement =
        (QueryStatement)
            concatPathRewriter.rewrite(
                queryStatement, new PathPatternTree(queryStatement.useWildcard()), context);
    analysis.setRealStatement(queryStatement);

    // request schema fetch API
    long startTime = System.nanoTime();
    ISchemaTree schemaTree;
    try {
      logger.debug("[StartFetchSchema]");
      PathPatternTree authorizedPatternTree = queryStatement.getAuthorityScope();
      // If the authority scope of query statement contains full path, we should fetch schema
      // without template. Otherwise, the result ISchemaTree may contain template series that is
      // not authorized to access.
      boolean allWildcardLeaf =
          !authorizedPatternTree.isContainFullPath() && authorizedPatternTree.isContainWildcard();
      if (queryStatement.isGroupByTag()) {
        schemaTree =
            schemaFetcher.fetchSchemaWithTags(
                concatPathRewriter.getPatternTree(), allWildcardLeaf, context);
      } else {
        schemaTree =
            schemaFetcher.fetchSchema(
                concatPathRewriter.getPatternTree(), allWildcardLeaf, context);
      }

      // make sure paths in logical view is fetched
      updateSchemaTreeByViews(analysis, schemaTree, context);
    } finally {
      logger.debug("[EndFetchSchema]");
      long schemaFetchCost = System.nanoTime() - startTime;
      context.setFetchSchemaCost(schemaFetchCost);
      QueryPlanCostMetricSet.getInstance().recordTreePlanCost(SCHEMA_FETCHER, schemaFetchCost);
    }

    analysis.setSchemaTree(schemaTree);
    return schemaTree;
  }
This visitor is used to analyze each type of Statement and returns the {@link Analysis}.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java