private void analyzeGlobalTimeFilter(Analysis analysis, QueryStatement queryStatement) {
    Expression globalTimePredicate = null;
    boolean hasValueFilter = false;
    if (queryStatement.getWhereCondition() != null) {
      WhereCondition whereCondition = queryStatement.getWhereCondition();
      Expression predicate = whereCondition.getPredicate();

      Pair<Expression, Boolean> resultPair =
          PredicateUtils.extractGlobalTimePredicate(predicate, true, true);
      globalTimePredicate = resultPair.left;
      if (globalTimePredicate != null) {
        globalTimePredicate = PredicateUtils.predicateRemoveNot(globalTimePredicate);
      }
      hasValueFilter = resultPair.right;

      predicate = PredicateUtils.simplifyPredicate(predicate);

      // set where condition to null if predicate is true or time filter.
      if (!hasValueFilter || predicate.equals(ConstantOperand.TRUE)) {
        queryStatement.setWhereCondition(null);
      } else {
        whereCondition.setPredicate(predicate);
      }
    }
    analysis.setGlobalTimePredicate(globalTimePredicate);
    analysis.setHasValueFilter(hasValueFilter);
  }
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