You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Arina Ielchiieva (Jira)" <ji...@apache.org> on 2020/03/23 09:06:01 UTC

[jira] [Assigned] (DRILL-6993) VARBINARY length is ignored on cast

     [ https://issues.apache.org/jira/browse/DRILL-6993?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arina Ielchiieva reassigned DRILL-6993:
---------------------------------------

    Assignee:     (was: Bohdan Kazydub)

> VARBINARY length is ignored on cast
> -----------------------------------
>
>                 Key: DRILL-6993
>                 URL: https://issues.apache.org/jira/browse/DRILL-6993
>             Project: Apache Drill
>          Issue Type: Bug
>            Reporter: Bohdan Kazydub
>            Priority: Major
>
> {{VARBINARY}} precision is not set when casting to {{VARBINARY}} with specified length.
> For example, test case 
> {code}
>       String query = "select cast(r_name as varbinary(31)) as vb from cp.`tpch/region.parquet`;"
>       MaterializedField field = new ColumnBuilder("vb", TypeProtos.MinorType.VARBINARY)
>           .setMode(TypeProtos.DataMode.OPTIONAL)
>           .setWidth(31)
>           .build();
>       BatchSchema expectedSchema = new SchemaBuilder()
>           .add(field)
>           .build();
>       // Validate schema
>       testBuilder()
>           .sqlQuery(q)
>           .schemaBaseLine(expectedSchema)
>           .go();
> {code}
> will fail with
> {code}
> java.lang.Exception: Schema path or type mismatch for column #0:
> Expected schema path: vb
> Actual   schema path: vb
> Expected type: MajorType[minor_type: VARBINARY mode: OPTIONAL precision: 31 scale: 0]
> Actual   type: MajorType[minor_type: VARBINARY mode: OPTIONAL]
> {code}
> while for other types, like {{VARCHAR}}, it seems to work.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)