[
https://issues.apache.org/jira/browse/DRILL-4551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15217083#comment-15217083
]
ASF GitHub Bot commented on DRILL-4551:
---------------------------------------
Github user jinfengni commented on a diff in the pull request:
https://github.com/apache/drill/pull/452#discussion_r57819554
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctionHelpers.java
---
@@ -213,11 +213,39 @@ public static long getDate(DrillBuf buf, int start,
int end){
if (BoundsChecking.BOUNDS_CHECKING_ENABLED) {
buf.checkBytes(start, end);
}
- return memGetDate(buf.memoryAddress(), start, end);
+ int[] dateFields = memGetDate(buf.memoryAddress(), start, end);
+ return CHRONOLOGY.getDateTimeMillis(dateFields[0], dateFields[1],
dateFields[2], 0);
}
+ /**
+ * Takes a string value, specified as a buffer with a start and end and
+ * returns true if the value can be read as a date.
+ *
+ * @param buf
+ * @param start
+ * @param end
+ * @return true iff the string value can be read as a date
+ */
+ public static boolean isReadableAsDate(DrillBuf buf, int start, int end){
+ if (BoundsChecking.BOUNDS_CHECKING_ENABLED) {
+ buf.checkBytes(start, end);
+ }
+ int[] dateFields = memGetDate(buf.memoryAddress(), start, end);
--- End diff --
Can we call getDate() directly here, and wrap with a try/catch block? The
code seems identical to getDate(), except for the try/catch block.
> Add some missing functions that are generated by Tableau (cot, regex_matches,
> split_part, isdate)
> -------------------------------------------------------------------------------------------------
>
> Key: DRILL-4551
> URL: https://issues.apache.org/jira/browse/DRILL-4551
> Project: Apache Drill
> Issue Type: Improvement
> Reporter: Jason Altekruse
> Assignee: Jason Altekruse
>
> Several of these functions do not appear to be standard SQL functions, but
> they are available in several other popular databases like SQL Server, Oracle
> and Postgres.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)