Pig
  1. Pig
  2. PIG-3574

ToDate() can't handle some custom time formats

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 0.11, 0.12.0, 0.11.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Tags:
      ToDate, Joda

      Description

      When trying to parse a string with a format as follows Fri Nov 01 12:30:19 EDT 2013 there is no way to properly escape the EDT timezone. Both SimpleDate and Joda time provide the single quote character ' to escape custom text (see the examples here and documentation here, respectively). However, using this violates Pigs grammar and results in an error.

      This can be successfully escaped by using something like ToDate(date,'EEE MMM dd HH:mm:ss \'EDT\' yyyy', 'EST') and a date time will be returned. This introduces new problems, when you try something like a filter, the next line will throw an error (usually mismatched input '(' expecting SEMI_COLON). I believe this is a result of violating Pigs grammar once again.

      The problem here is that any datetime string that has a custom format can't be parsed (such as Nov 11th at 12:05, both due to the th and the at).

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Mike Peterson
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Development