private void analyzeDeviceRegionScan(
      WhereCondition timeCondition,
      PartialPath pattern,
      PathPatternTree authorityScope,
      Analysis analysis,
      MPPQueryContext context) {
    // If there is time condition in SHOW DEVICES, we need to scan the raw data
    analyzeGlobalTimeConditionInShowMetaData(timeCondition, analysis);
    context.generateGlobalTimeFilter(analysis);
    PathPatternTree patternTree = new PathPatternTree();
    patternTree.appendPathPattern(pattern);
    ISchemaTree schemaTree =
        schemaFetcher.fetchRawSchemaInDeviceLevel(patternTree, authorityScope, context);
    if (schemaTree.isEmpty()) {
      analysis.setFinishQueryAfterAnalyze(true);
      return;
    }

    // fetch Data partition

    Map<PartialPath, DeviceContext> devicePathsToInfoMap =
        schemaTree.getMatchedDevices(pattern).stream()
            .collect(Collectors.toMap(DeviceSchemaInfo::getDevicePath, DeviceContext::new));
    analysis.setDevicePathToContextMap(devicePathsToInfoMap);
    DataPartition dataPartition =
        fetchDataPartitionByDevices(
            devicePathsToInfoMap.keySet().stream()
                .map(PartialPath::getIDeviceIDAsFullDevice)
                .collect(Collectors.toSet()),
            schemaTree,
            context);
    analysis.setDataPartitionInfo(dataPartition);
  }
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