private boolean analyzeTimeseriesRegionScan(
      WhereCondition timeCondition,
      PathPatternTree patternTree,
      Analysis analysis,
      MPPQueryContext context,
      PathPatternTree authorityScope)
      throws IllegalPathException {
    analyzeGlobalTimeConditionInShowMetaData(timeCondition, analysis);
    context.generateGlobalTimeFilter(analysis);
    patternTree.constructTree();
    ISchemaTree schemaTree =
        schemaFetcher.fetchRawSchemaInMeasurementLevel(patternTree, authorityScope, context);

    if (schemaTree.isEmpty()) {
      analysis.setFinishQueryAfterAnalyze(true);
      return false;
    }
    removeLogicViewMeasurement(schemaTree);
    Map<PartialPath, Map<PartialPath, List<TimeseriesContext>>> deviceToTimeseriesContext =
        new HashMap<>();
    /**
     * 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.
     */
    List<DeviceSchemaInfo> deviceSchemaInfoList = schemaTree.getMatchedDevices(ALL_MATCH_PATTERN);
    Set<IDeviceID> deviceSet = new HashSet<>();
    for (DeviceSchemaInfo deviceSchemaInfo : deviceSchemaInfoList) {
      boolean isAligned = deviceSchemaInfo.isAligned();
      PartialPath devicePath = deviceSchemaInfo.getDevicePath();
      deviceSet.add(devicePath.getIDeviceIDAsFullDevice());
      if (isAligned) {
        List<String> measurementList = new ArrayList<>();
        List<IMeasurementSchema> schemaList = new ArrayList<>();
        List<TimeseriesContext> timeseriesContextList = new ArrayList<>();
        for (IMeasurementSchemaInfo measurementSchemaInfo :
            deviceSchemaInfo.getMeasurementSchemaInfoList()) {
          schemaList.add(measurementSchemaInfo.getSchema());
          measurementList.add(measurementSchemaInfo.getName());
          timeseriesContextList.add(new TimeseriesContext(measurementSchemaInfo));
        }
        AlignedPath alignedPath =
            new AlignedPath(devicePath.getNodes(), measurementList, schemaList);
        deviceToTimeseriesContext
            .computeIfAbsent(devicePath, k -> new HashMap<>())
            .put(alignedPath, timeseriesContextList);
      } else {
        for (IMeasurementSchemaInfo measurementSchemaInfo :
            deviceSchemaInfo.getMeasurementSchemaInfoList()) {
          MeasurementPath measurementPath =
              new MeasurementPath(
                  devicePath.concatNode(measurementSchemaInfo.getName()).getNodes());
          deviceToTimeseriesContext
              .computeIfAbsent(devicePath, k -> new HashMap<>())
              .put(
                  measurementPath,
                  Collections.singletonList(new TimeseriesContext(measurementSchemaInfo)));
        }
      }
    }

    analysis.setDeviceToTimeseriesSchemas(deviceToTimeseriesContext);
    // fetch Data partition
    DataPartition dataPartition = fetchDataPartitionByDevices(deviceSet, schemaTree, context);
    analysis.setDataPartitionInfo(dataPartition);
    return true;
  }
Check datatype consistency in ALIGN BY DEVICE.

<p>an inconsistent example: select s0 from root.sg1.d1, root.sg1.d2 align by device, return
false while root.sg1.d1.s0 is INT32 and root.sg1.d2.s0 is FLOAT.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java