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. 
     


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to