private long parseTimeValue(ConstantContext constant) {
    if (constant.INTEGER_LITERAL() != null) {
      try {
        if (constant.MINUS() != null) {
          return Long.parseLong("-" + constant.INTEGER_LITERAL().getText());
        }
        return Long.parseLong(constant.INTEGER_LITERAL().getText());
      } catch (NumberFormatException e) {
        throw new SemanticException(
            String.format(
                "Failed to parse the timestamp: "
                    + e.getMessage()
                    + "Current system timestamp precision is %s, "
                    + "please check whether the timestamp %s is correct.",
                TIMESTAMP_PRECISION,
                constant.INTEGER_LITERAL().getText()));
      }
    } else if (constant.dateExpression() != null) {
      return parseDateExpression(constant.dateExpression(), CommonDateTimeUtils.currentTime());
    } else {
      throw new SemanticException(String.format("Can not parse %s to time", constant));
    }
  }
Parse time range (startTime and endTime) in group by time.

@throws SemanticException if startTime is larger or equals to endTime in timeRange
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java