code: public static CalendarInterval fromDayTimeString(String s) throws IllegalArgumentException {
      CalendarInterval result = null;
      if (s == null) {
        throw new IllegalArgumentException("Interval day-time string was null");
      }
      s = s.trim();
      Matcher m = dayTimePattern.matcher(s);
      if (!m.matches()) {
        throw new IllegalArgumentException(
          "Interval string does not match day-time format of 'd h:m:s.n': " + s);
      } else {
        try {
          int sign = m.group(1) != null && m.group(1).equals("-") ? -1 : 1;
          long days = toLongWithRange("day", m.group(2), 0, Integer.MAX_VALUE);
          long hours = toLongWithRange("hour", m.group(3), 0, 23);
          long minutes = toLongWithRange("minute", m.group(4), 0, 59);
          long seconds = toLongWithRange("second", m.group(5), 0, 59);
          // Hive allow nanosecond precision interval
          long nanos = toLongWithRange("nanosecond", m.group(7), 0L, 999999999L);
          result = new CalendarInterval(0, sign * (
            days * MICROS_PER_DAY + hours * MICROS_PER_HOUR + minutes * MICROS_PER_MINUTE +
            seconds * MICROS_PER_SECOND + nanos / 1000L));
        } catch (Exception e) {
          throw new IllegalArgumentException(
            "Error parsing interval day-time string: " + e.getMessage(), e);
        }
      }
      return result;
    }
docs: Parse dayTime string in form: [-]d HH:mm:ss.nnnnnnnnn
  
  adapted from HiveIntervalDayTime.valueOf