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

Unable to cast string literal with the valid value in ISO 8601 format to interval

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 0.9.0
    • 1.2.0
    • Execution - Data Types
    • None

    Description

      0: jdbc:drill:schema=dfs> select cast('P1D' as interval day) from t1;
      Query failed: PARSE ERROR: From line 1, column 8 to line 1, column 34: Cast function cannot convert value of type CHAR(3) to type INTERVAL DAY
      
      [744f1f35-f8c5-46ba-80f9-0efd87036903 on atsqa4-134.qa.lab:31010]
      Error: exception while executing query: Failure while executing query. (state=,code=0)
      

      Workaround: cast to varchar.

      0: jdbc:drill:schema=dfs> select cast(cast('P1D' as varchar(3)) as interval day) from t1;
      +------------+
      |   EXPR$0   |
      +------------+
      | P1D        |
      | P1D        |
      | P1D        |
      | P1D        |
      | P1D        |
      | P1D        |
      | P1D        |
      | P1D        |
      | P1D        |
      | P1D        |
      +------------+
      10 rows selected (0.191 seconds)
      

      Attachments

        Issue Links

          Activity

            People

              dsbos Daniel Barclay
              vicky Victoria Markman
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: