Apache Drill
  1. Apache Drill
  2. DRILL-364

Casting to VarChar throws error CompileException

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.4.0
    • Component/s: None
    • Labels:
      None

      Description

      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.

        Activity

        Hide
        Jacques Nadeau added a comment -

        Added in 153c727

        Show
        Jacques Nadeau added a comment - Added in 153c727
        Hide
        Jinfeng Ni added a comment -

        Revised patch based on review comment.

        Show
        Jinfeng Ni added a comment - Revised patch based on review comment.
        Hide
        Jinfeng Ni added a comment -

        This patch contains the fix for issue Drill-364.

        Show
        Jinfeng Ni added a comment - This patch contains the fix for issue Drill-364.

          People

          • Assignee:
            Jinfeng Ni
            Reporter:
            Mehant Baid
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development