[
https://issues.apache.org/jira/browse/DRILL-1470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14202501#comment-14202501
]
Jinfeng Ni commented on DRILL-1470:
-----------------------------------
Good points. I'll add varbinary->varbinay, and update the patch.
> 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: Mehant Baid
> Attachments:
> 0001-DRILL-1470-cast-into-varchar-should-recognize-the-le.patch
>
>
> 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)