You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/09/25 13:00:01 UTC

[jira] [Commented] (FLINK-9432) Support extract epoch, decade, millisecond, microsecond

    [ https://issues.apache.org/jira/browse/FLINK-9432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16627308#comment-16627308 ] 

ASF GitHub Bot commented on FLINK-9432:
---------------------------------------

pnowojski commented on a change in pull request #6614: [FLINK-9432] [table] Support extract timeunit: DECADE, EPOCH, ISODOW, ISOYEAR…
URL: https://github.com/apache/flink/pull/6614#discussion_r220176652
 
 

 ##########
 File path: flink-libraries/flink-table/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java
 ##########
 @@ -751,15 +770,15 @@ private static int julianExtract(TimeUnitRange range, int julian) {
 				return day;
 			case DOW:
 				return (int) floorMod(julian + 1, 7) + 1; // sun=1, sat=7
+			case ISODOW:
+				return (int) floorMod(julian, 7) + 1; // mon=1, sun=7
 			case WEEK:
-				long fmofw = firstMondayOfFirstWeek(year);
-				if (julian < fmofw) {
-					fmofw = firstMondayOfFirstWeek(year - 1);
-				}
-				return (int) (julian - fmofw) / 7 + 1;
+				return getIso8601WeekNumber(julian, year, month, day);
 
 Review comment:
   Why did you change the old `WEEK` code to `getIso8601WeekNumber`? If they return the same thing, why didn't you implement `getIso8601WeekNumber` as `(julian - fmofw) / 7 + 1;`? 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Support extract epoch, decade, millisecond, microsecond
> -------------------------------------------------------
>
>                 Key: FLINK-9432
>                 URL: https://issues.apache.org/jira/browse/FLINK-9432
>             Project: Flink
>          Issue Type: New Feature
>            Reporter: Sergey Nuyanzin
>            Assignee: Sergey Nuyanzin
>            Priority: Major
>              Labels: pull-request-available
>
> The task is to separate activity from depending on https://issues.apache.org/jira/browse/CALCITE-2303 from all others that could be done without upgrade avatica/calcite in  https://issues.apache.org/jira/browse/FLINK-8518
> Now the implementations of next functions are blocked
> {code:sql}
> extract(decade from ...)
> extract(epoch from ...)
> extract(millisecond from ...)
> extract(microsecond from ...)
> extract(isodow from ...)
> extract(isoyear from ...)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)