You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Jinfeng Ni (JIRA)" <ji...@apache.org> on 2014/09/30 03:13:33 UTC

[jira] [Created] (DRILL-1470) Drill incorrectly ignore length parameter when cast into varchar/varbinary

Jinfeng Ni created DRILL-1470:
---------------------------------

             Summary: Drill incorrectly ignore length parameter when cast into varchar/varbinary 
                 Key: DRILL-1470
                 URL: https://issues.apache.org/jira/browse/DRILL-1470
             Project: Apache Drill
          Issue Type: Bug
            Reporter: Jinfeng Ni
            Assignee: Jinfeng Ni


cast(parm1 as varchar(n)) 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)




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)