Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-364

Casting to VarChar throws error CompileException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 0.4.0
    • None
    • 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.

      Attachments

        1. Drill-364.patch.2.txt
          13 kB
          Jinfeng Ni

        Activity

          People

            jni Jinfeng Ni
            mehant Mehant Baid
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: