tanclary commented on code in PR #3125:
URL: https://github.com/apache/calcite/pull/3125#discussion_r1175495658
##########
core/src/main/java/org/apache/calcite/rel/type/TimeFrameSet.java:
##########
@@ -287,6 +287,41 @@ public long diffTimestamp(long timestamp, long timestamp2,
TimeFrame frame) {
return timestamp;
}
+ /** For ISOWEEK and WEEK(WEEKDAY), EXTRACT can be rewritten
+ * as the composition of DATE_DIFF and DATE_TRUNC. DAYOFWEEK and DAYOFYEAR
+ * are just translated to DOW and DOY respectively. */
+ public long extractDate(int date, TimeFrame timeFrame) {
+ TimeUnitRange timeUnitRange;
+ int offset = 0;
+ // Date will be truncated to either ISOYEAR or YEAR depending on time
frame.
+ switch (timeFrame.name()) {
+ case "DAYOFWEEK":
Review Comment:
Yes I completely agree.
--
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]