mihaibudiu commented on code in PR #3653:
URL: https://github.com/apache/calcite/pull/3653#discussion_r1468017641


##########
core/src/main/java/org/apache/calcite/util/format/FormatElementEnum.java:
##########
@@ -132,17 +133,41 @@ public enum FormatElementEnum implements FormatElement {
       sb.append(String.format(Locale.ROOT, "%02d", 
calendar.get(Calendar.HOUR_OF_DAY)));
     }
   },
+  ID("u", "The weekday (Monday as the first day of the week) as a decimal 
number (1-7)") {
+    @Override public void format(StringBuilder sb, Date date) {
+      final Calendar calendar = Work.get().calendar;
+      calendar.setTime(date);
+      int weekDay = calendar.get(Calendar.DAY_OF_WEEK);
+      sb.append(String.format(Locale.ROOT, "%d", weekDay == 1 ? 7 : weekDay - 
1));

Review Comment:
   The DOW function implementation assumes that Sunday = 1.
   In Postgres DOW assumes that Sunday = 0.



-- 
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