@Override
  public Analysis visitShowTimeSeries(
      ShowTimeSeriesStatement showTimeSeriesStatement, MPPQueryContext context) {
    Analysis analysis = new Analysis();
    analysis.setRealStatement(showTimeSeriesStatement);

    if (showTimeSeriesStatement.getPathPattern().getNodeLength() <= 1) {
      analysis.setFinishQueryAfterAnalyze(true);
      analysis.setRespDatasetHeader(DatasetHeaderFactory.getShowTimeSeriesHeader());
      return analysis;
    }

    PathPatternTree patternTree = new PathPatternTree();
    patternTree.appendPathPattern(showTimeSeriesStatement.getPathPattern());

    if (showTimeSeriesStatement.hasTimeCondition()) {
      try {
        // If there is time condition in SHOW TIMESERIES, we need to scan the raw data
        boolean hasSchema =
            analyzeTimeseriesRegionScan(
                showTimeSeriesStatement.getTimeCondition(),
                patternTree,
                analysis,
                context,
                showTimeSeriesStatement.getAuthorityScope());
        if (!hasSchema) {
          analysis.setRespDatasetHeader(DatasetHeaderFactory.getShowTimeSeriesHeader());
          return analysis;
        }
      } catch (IllegalPathException e) {
        throw new StatementAnalyzeException(e.getMessage());
      }

    } else {
      SchemaPartition schemaPartitionInfo = partitionFetcher.getSchemaPartition(patternTree);
      analysis.setSchemaPartitionInfo(schemaPartitionInfo);

      Map<Integer, Template> templateMap =
          schemaFetcher.checkAllRelatedTemplate(showTimeSeriesStatement.getPathPattern());
      analysis.setRelatedTemplateInfo(templateMap);
    }

    if (showTimeSeriesStatement.isOrderByHeat()) {
      patternTree.constructTree();
      // request schema fetch API
      logger.debug("[StartFetchSchema]");
      ISchemaTree schemaTree = schemaFetcher.fetchSchema(patternTree, true, context);
      updateSchemaTreeByViews(analysis, schemaTree, context);
      logger.debug("[EndFetchSchema]]");

      analyzeLastSource(
          analysis,
          Collections.singletonList(
              new TimeSeriesOperand(showTimeSeriesStatement.getPathPattern())),
          schemaTree,
          context);
      analyzeDataPartition(analysis, new QueryStatement(), schemaTree, context);
    }

    analysis.setRespDatasetHeader(DatasetHeaderFactory.getShowTimeSeriesHeader());
    return analysis;
  }
Since we fetch raw time series schema without template(The template sequence will be treated
as a normal node, not a device+templateId. This means that all nodes are what we need.). We
can use ALL_MATCH_PATTERN to get result.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java