drill-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Dunning <ted.dunn...@gmail.com>
Subject Re: Building a LogicalPlan
Date Fri, 02 Dec 2016 10:21:49 GMT
It might be easier to start by stealing a plan from a normal SQL query and
then trying to build that.  Not that this is a long-term solution, but it
gets you going with the many unstated assumptions about a plan that might
be present.

That would give you something in JSON, however, rather than Java code.
That still might be very useful.



On Fri, Dec 2, 2016 at 1:59 AM, Chris Baynes <chris@contiamo.com> wrote:

> Hi,
>
> We have a use case in which we want to construct queries programmatically
> which Drill would then execute.
>
> So far I've been able to configure a Jdbc StorageEngine, and initialize a
> LogicalPlan (using the builder) with that. I am having difficulty trying to
> configure scan, project, and filters. I know I need to construct a
> LogicalOperator, and these are implemented in
> org.apache.drill.common.logical.data
>
> However to construct an operator instance I need one or more of:
> JSONOptions, NamedExpression, LogicalExpression, FieldReference.
>
> So right now I have something like this, but don't know how to fill in the
> missing pieces...
>
> // scan
> JSONOptions opts = new JSONOptions(...);
> builder.addLogicalOperator(Scan.builder().storageEngine("
> pg").selection(opts).build());
>
> // project
> NamedExpression nex = new NamedExpression(...);
> builder.addLogicalOperator(Project.builder().addExpr(nex));
>
> LogicalPlan plan = builder.build();
>
> Is there any documentation yet, similar to what calcite has for the
> RelBuilder (https://calcite.apache.org/docs/algebra.html)?
>
> I suppose I could also construct a RelNode and then try to convert that to
> a LogicalPlan, would I be missing out on any drill features this way?
>
> Thanks in advance
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message