Here is the logical plan for the following query:

SELECT employee_id , full_name FROM cp.`employee.json` where department_id
= 16 order by last_name limit 50;

{
  "head" : {
    "version" : 1,
    "generator" : {
      "type" : "org.apache.drill.exec.planner.logical.DrillImplementor",
      "info" : ""
    },
    "type" : "APACHE_DRILL_LOGICAL",
    "options" : null,
    "queue" : 0,
    "resultMode" : "LOGICAL"
  },
  "storage" : {
    "cp" : {
      "type" : "file",
      "enabled" : true,
      "connection" : "classpath:///",
      "workspaces" : null,
      "formats" : {
        "csv" : {
          "type" : "text",
          "extensions" : [ "csv" ],
          "delimiter" : ","
        },
        "json" : {
          "type" : "json"
        },
        "parquet" : {
          "type" : "parquet"
        }
      }
    }
  },
  "query" : [ {
    "op" : "scan",
    "@id" : 1,
    "storageengine" : "cp",
    "selection" : {
      "format" : {
        "type" : "named",
        "name" : "json"
      },
      "files" : [ "/employee.json" ]
    }
  }, {
    "op" : "project",
    "@id" : 2,
    "input" : 1,
    "projections" : [ {
      "ref" : "`department_id`",
      "expr" : "`department_id`"
    }, {
      "ref" : "`employee_id`",
      "expr" : "`employee_id`"
    }, {
      "ref" : "`full_name`",
      "expr" : "`full_name`"
    }, {
      "ref" : "`last_name`",
      "expr" : "`last_name`"
    } ]
  }, {
    "op" : "filter",
    "@id" : 3,
    "input" : 2,
    "expr" : "equal(cast( (`department_id` ) as INT ), 16) "
  }, {
    "op" : "project",
    "@id" : 4,
    "input" : 3,
    "projections" : [ {
      "ref" : "`employee_id`",
      "expr" : "`employee_id`"
    }, {
      "ref" : "`full_name`",
      "expr" : "`full_name`"
    }, {
      "ref" : "`last_name`",
      "expr" : "`last_name`"
    } ]
  }, {
    "op" : "order",
    "@id" : 5,
    "input" : 4,
    "within" : null,
    "orderings" : [ {
      "order" : "ASC",
      "expr" : "`last_name`",
      "nullDirection" : "UNSPECIFIED"
    } ]
  }, {
    "op" : "limit",
    "@id" : 6,
    "input" : 5,
    "first" : 0,
    "last" : 50
  }, {
    "op" : "project",
    "@id" : 7,
    "input" : 6,
    "projections" : [ {
      "ref" : "`employee_id`",
      "expr" : "`employee_id`"
    }, {
      "ref" : "`full_name`",
      "expr" : "`full_name`"
    } ]
  }, {
    "op" : "store",
    "@id" : 8,
    "input" : 7,
    "target" : null,
    "storageEngine" : "--SCREEN--"
  } ]
}

I couldn't find a way to print this but I think could be useful. Can you
please create a JIRA?


On Tue, Oct 7, 2014 at 11:31 AM, Yash Sharma <[email protected]> wrote:

> Hi All,
> I see that all the logical plans in project are of old version and I am not
> able to use these  logical plans on the Drill Web interface.
>
> Could any one please share a simple logical plan which I can use to test on
> the web interface.
>
> I need to use very simple operations like :
> - read/scan from file
> - project few columns
> - store out on console/web interface
>
> Also is there any way to view the logical plan directly from sql query as
> well (similar to explain plan for <query>) ?
>
> Thanks.
>
>
>
> Here is my logical plan. Have tried using the new syntax but not completely
> successful. Removed project operator since it was referring to old _MAP
> syntax -
>
> > {
> >   "head" : {
> >     "version" : 1,
> >     "generator" : {
> >       "type" : "manual",
> >       "info" : "manual"
> >     },
> >     "type" : "APACHE_DRILL_LOGICAL",
> >     "options" : null,
> >     "queue" : 0,
> >     "resultMode" : "EXEC"
> >   },
> >   "storage" : {
> >     "fs" : {
> >       "type" : "file",
> >       "enabled" : true,
> >       "connection" : "file:///",
> >       "workspaces" : null,
> >       "formats" : null
> >     }
> >   },
> >   "query" : [ {
> >     "op" : "scan",
> >     "@id" : 1,
> >     "storageengine" : "fs",
> >     "selection" : [ {
> >       "path" : "text/data/nations.csv"
> >     } ]
> >   }, {
> >     "op" : "store",
> >     "@id" : 2,
> >     "input" : 1,
> >     "target" : null,
> >     "storageEngine" : "fs"
> >   } ]
> > }
> >
> >
> > QueryResultBatch [header=query_state: FAILED
> > query_id {
> >   part1: -4067623478689576886
> >   part2: -7119567730027840928
> > }
> > is_last_chunk: true
> > error {
> >   error_id: "d6b91e72-8f58-4327-91ec-c6ef9d2fc86a"
> >   endpoint {
> >     address: "L-yash-tech"
> >     user_port: 31013
> >     control_port: 31014
> >     data_port: 31015
> >   }
> >   error_type: 0
> >   message: "Failure while setting up Foreman. Can not deserialize
> instance
> > of org.apache.drill.exec.store.dfs.FormatSelection out of START_ARRAY
> > token\n at [Source: N/A; line: -1, column: -1]
> > [d6b91e72-8f58-4327-91ec-c6ef9d2fc86a]"
> > }
> > , data=null]
>

Reply via email to