[ 
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)

Reply via email to