public TSDataType getType(final Expression expression) {
    // NULL_Operand needn't check
    if (expression.getExpressionType().equals(ExpressionType.NULL)) {
      return null;
    }

    if (allDevicesInOneTemplate()
        && (noWhereAndAggregation() || expression instanceof TimeSeriesOperand)) {
      TimeSeriesOperand seriesOperand = (TimeSeriesOperand) expression;
      return deviceTemplate.getSchemaMap().get(seriesOperand.getPath().getMeasurement()).getType();
    }

    final TSDataType type = expressionTypes.get(NodeRef.of(expression));
    checkArgument(type != null, "Expression is not analyzed: %s", expression);
    return type;
  }
Get all time partition ids and combine adjacent time partition if they belong to same data
region
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/Analysis.java