snuyanzin commented on code in PR #28828:
URL: https://github.com/apache/flink/pull/28828#discussion_r3659007812


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/expressions/ValueLiteralExpression.java:
##########
@@ -411,6 +406,51 @@ private static void validateValueDataType(Object value, 
DataType dataType) {
         }
     }
 
+    /**
+     * Formats a year-month interval value as a SQL literal, including 
explicit precision on the
+     * {@code YEAR} field.
+     */
+    private static String formatYearMonthIntervalLiteral(
+            YearMonthIntervalType type, Period period) {
+        final long totalMonths = period.toTotalMonths();
+        final long years = totalMonths / 12;
+        final long months = totalMonths % 12;
+        final int yearPrecision = type.getYearPrecision();
+        return String.format("INTERVAL '%d-%d' YEAR(%d) TO MONTH", years, 
months, yearPrecision);
+    }
+
+    /**
+     * Formats a day-time interval value as a SQL literal, including explicit 
precision on the
+     * {@code DAY} and {@code SECOND} field.
+     */
+    private static String formatDayTimeIntervalLiteral(
+            DayTimeIntervalType type, Duration duration) {
+        final long days = duration.toDays();
+        final long hours = duration.toHours() % 24;
+        final long minutes = duration.toMinutes() % 60;
+        final long seconds = duration.getSeconds() % 60;

Review Comment:
   ```suggestion
           final int hours = duration.toHoursPart();
           final int minutes = duration.toMinutesPart();
           final int seconds = duration.getSecondsPart();
   ```
   since now min java is 11 it could be replaced like this



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to