You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by "Bohdan Kazydub (JIRA)" <ji...@apache.org> on 2019/01/22 18:14:00 UTC

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

Bohdan Kazydub created DRILL-6993:
-------------------------------------

             Summary: 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
            Assignee: Bohdan Kazydub


{{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
(v7.6.3#76005)