You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/11/18 12:02:00 UTC

[jira] [Commented] (DRILL-8340) Add Additional Date Manipulation Functions (Part 1)

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

ASF GitHub Bot commented on DRILL-8340:
---------------------------------------

jnturton commented on code in PR #2689:
URL: https://github.com/apache/drill/pull/2689#discussion_r1026354128


##########
contrib/udfs/src/main/java/org/apache/drill/exec/udfs/DateFunctions.java:
##########
@@ -140,8 +142,36 @@ public void eval() {
       java.time.format.DateTimeFormatter formatter = java.time.format.DateTimeFormatter.ofPattern(format);
       java.time.LocalDateTime dateTime = java.time.LocalDateTime.parse(inputDate, formatter);
 
-      java.time.LocalDateTime td = org.apache.drill.exec.udfs.NearestDateUtils.getDate(dateTime, intervalString);
+      java.time.LocalDateTime td = DateConversionUtils.getDate(dateTime, intervalString);
       out.value = td.atZone(java.time.ZoneId.of("UTC")).toInstant().toEpochMilli();
     }
   }
+
+  @FunctionTemplate(names = {"to_timestamp"},

Review Comment:
   Please add a comment explaining that this function differs from the other `to_timestamp` functions in that it takes no timestamp format argument and will try to determine one automatically.





> Add Additional Date Manipulation Functions (Part 1)
> ---------------------------------------------------
>
>                 Key: DRILL-8340
>                 URL: https://issues.apache.org/jira/browse/DRILL-8340
>             Project: Apache Drill
>          Issue Type: Improvement
>          Components: Functions - Drill
>    Affects Versions: 1.20.2
>            Reporter: Charles Givre
>            Assignee: Charles Givre
>            Priority: Major
>             Fix For: 2.0.0
>
>
> This PR adds several utility functions to facilitate working with dates and times.  These are modeled after the date/time functionality in MySQL.
> Specifically this adds:
>  * YEARWEEK(<date>):  Returns an int of year week. IE (202002)
>  * TIME_STAMP(<date string>):  Converts most anything that looks like a date string into a timestamp.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)