Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-1165

Cast a varchar timestamp into date fails

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: 0.4.0
    • Component/s: Functions - Drill
    • Labels:
      None

      Description

      git.commit.id.abbrev=e5c2da0

      I have the following varchar data casted as timestamp:
      0: jdbc:drill:schema=dfs> select cast(create_time as timestamp) from student where student_id=15;
      ------------

      EXPR$0

      ------------

      2014-11-12 12:38:15.0

      I can cast the varchar data to a date:
      0: jdbc:drill:schema=dfs> select cast(create_time as date) from student where student_id=15;
      ------------

      EXPR$0

      ------------

      2014-11-12

      ------------

      However, it fails when I tried to cast it to a time:
      0: jdbc:drill:schema=dfs> select cast(create_time as time) from student where student_id=15;
      message: "Failure while running fragment. < IllegalArgumentException:[ Invalid format: "2014-11-12 12:38:15" is malformed at "14-11-12 12:38:15" ]"

      If it works for date, it should work for time. This query returned the time portion of the string when executed from postgres.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              knguyen Krystal
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: