public static TimeDuration constructTimeDuration(String duration) {
    duration = duration.toLowerCase();
    String currTimePrecision = CommonDescriptor.getInstance().getConfig().getTimestampPrecision();
    long temp = 0;
    long monthDuration = 0;
    long nonMonthDuration = 0;
    int i = 0;
    for (; i < duration.length(); i++) {
      char ch = duration.charAt(i);
      if (Character.isDigit(ch)) {
        temp *= 10;
        temp += (ch - '0');
      } else {
        StringBuilder unit = new StringBuilder(String.valueOf(duration.charAt(i)));
        i++;
        // This is to identify units.
        while (i < duration.length() && !Character.isDigit(duration.charAt(i))) {
          unit.append(duration.charAt(i));
          i++;
        }
        i--;
        if ("y".contentEquals(unit) || "year".contentEquals(unit)) {
          monthDuration += temp * 12;
          temp = 0;
          continue;
        }
        if ("mo".contentEquals(unit) || "month".contentEquals(unit)) {
          monthDuration += temp;
          temp = 0;
          continue;
        }
        nonMonthDuration +=
            DateTimeUtils.convertDurationStrToLong(-1, temp, unit.toString(), currTimePrecision);
        temp = 0;
      }
    }
    return new TimeDuration((int) monthDuration, nonMonthDuration);
  }
Storage the duration into two parts: month part and non-month part, the non-month part's
precision is depended on current time precision. e.g. ms precision: '1y1mo1ms' -> monthDuration
= 13, nonMonthDuration = 1, ns precision: '1y1mo1ms' -> monthDuration = 13, nonMonthDuration =
1000_000.

@param duration the input duration string
@return the TimeDuration instance contains month part and non-month part
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/DateTimeUtils.java