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

Drill incorrectly ignore length parameter when cast into varchar/varbinary

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.7.0
    • None
    • None

    Description

      cast(parm1 as varchar) should return a string with up to n characters. However, currently Drill will ignore the length parameter. For example,

      select first_name, cast(first_name as varchar(2)) from cp.`employee.json` limit 2;
      ----------------------+

      first_name EXPR$1

      ----------------------+

      Sheri Sheri
      Derrick Derrick

      ----------------------+
      2 rows selected (0.285 seconds)

      In comparison, here is the result run on postgres.

      select cast('abcdef' as varchar(2)) from t1 limit 1;
      varchar
      ---------
      ab
      (1 row)

      Attachments

        Activity

          People

            jni Jinfeng Ni
            jni Jinfeng Ni
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: