diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/DateTimeUtils.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/DateTimeUtils.java index 6953c81d6309..5e04f97504bb 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/DateTimeUtils.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/DateTimeUtils.java @@ -779,8 +779,8 @@ public static long calcPositiveIntervalByMonth(long startTime, TimeDuration dura public static TimeDuration constructTimeDuration(String duration) { duration = duration.toLowerCase(); String currTimePrecision = CommonDescriptor.getInstance().getConfig().getTimestampPrecision(); - int temp = 0; - int monthDuration = 0; + long temp = 0; + long monthDuration = 0; long nonMonthDuration = 0; for (int i = 0; i < duration.length(); i++) { char ch = duration.charAt(i); @@ -809,6 +809,6 @@ public static TimeDuration constructTimeDuration(String duration) { temp = 0; } } - return new TimeDuration(monthDuration, nonMonthDuration); + return new TimeDuration((int) monthDuration, nonMonthDuration); } } diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/DateTimeUtilsTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/DateTimeUtilsTest.java index a42587232718..a7ed50c287a5 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/DateTimeUtilsTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/DateTimeUtilsTest.java @@ -261,5 +261,8 @@ public void testConstructTimeDuration() { timeDuration = DateTimeUtils.constructTimeDuration("1y1mo"); Assert.assertEquals(13, timeDuration.monthDuration); Assert.assertEquals(0, timeDuration.nonMonthDuration); + + timeDuration = DateTimeUtils.constructTimeDuration("10000000000ms"); + Assert.assertEquals(10000000000L, timeDuration.nonMonthDuration); } }