Hi Mehant,

You are right that vv6 should be declared as a NullableVarCharVector.  The
cause of this bug is in the OutputTypeDeterminer for the cast function
definition;  we should not use fixed type as the output of cast function.
In stead, we should use a Null-if-Null output type determiner.

I added a new OutputTypeDeterminer when I worked on other SQL functions.
We may fix this cast function bug after we have this new
OutputTypeDeterminer.




On Mon, Feb 10, 2014 at 10:43 PM, Mehant Baid (JIRA) <[email protected]>wrote:

> Mehant Baid created DRILL-364:
> ---------------------------------
>
>              Summary: Casting to VarChar throws error CompileException
>                  Key: DRILL-364
>                  URL: https://issues.apache.org/jira/browse/DRILL-364
>              Project: Apache Drill
>           Issue Type: Bug
>             Reporter: Mehant Baid
>             Assignee: Mehant Baid
>             Priority: Minor
>
>
> This can be reproduced using the below physical plan:
>
> {
>     head:{
>         type:"APACHE_DRILL_PHYSICAL",
>         version:"1",
>         generator:{
>             type:"manual"
>         }
>     },
>         graph:[
>         {
>             @id:1,
>             pop:"json-scan",
>             entries: [
>                 {
>                     path : "/tmp/scan.json"
>                 }
>             ],
>             storageengine: {
>                 "type": "json",
>                 "dfsName": "file:///"
>             }
>         },
>         {
>             pop:"project",
>             @id:2,
>             child: 1,
>             exprs: [ {
>               ref: "VarCharCast",
>               expr: "cast(integer as varchar(30))"
>             } ]
>         },
>         {
>             @id: 3,
>             child: 2,
>             pop: "screen"
>         }
>     ]
> }
>
> The input file, "/tmp/scan.json" is as follows
> {
>   "integer" : 2008
> }
>
> It fails with the error: "org.codehaus.commons.compiler.CompileException
> Line 55, Column 38: No applicable constructor/method found for actual
> parameters"
>
> From the error, its clear that its not able to find a method. The line its
> complaining about is:
> vv6 .getMutator().set((outIndex), out5);
>
> vv6 is a VarCharVector and out5 is a NullableVarCharHolder. So its unable
> to find a set() function with parameters (int, NullableVarCharHolder). We
> do have a function in VarCharVector that matches the required signature but
> its 'protected' hence cannot be called from here. The only way to call that
> function is from within the set function of NullableVarCharVector.
>
> Looks like a minor bug in the generated code for project, vv6 should be
> declared a NullableVarCharVector.
>
>
>
> --
> This message was sent by Atlassian JIRA
> (v6.1.5#6160)
>

Reply via email to