public class DruidPlanner extends Object implements Closeable
The planner is designed to use once: it makes one trip through its lifecycle defined as:
start --> validate [--> prepare] --> plan
| Modifier and Type | Class and Description |
|---|---|
static class |
DruidPlanner.State |
| Modifier and Type | Field and Description |
|---|---|
static String |
UNNAMED_INGESTION_COLUMN_ERROR |
| Modifier and Type | Method and Description |
|---|---|
Access |
authorize(Function<Set<ResourceAction>,Access> authorizer,
boolean authorizeContextParams)
Authorizes the statement.
|
void |
close() |
PlannerContext |
getPlannerContext() |
PlannerResult |
plan()
Plan an SQL query for execution, returning a
PlannerResult which can be used to actually execute the query. |
PrepareResult |
prepare()
Prepare a SQL query for execution, including some initial parsing and
validation and any dynamic parameter type resolution, to support prepared
statements via JDBC.
|
PrepareResult |
prepareResult() |
Set<ResourceAction> |
resourceActions(boolean includeContext)
Return the resource actions corresponding to the datasources and views which
an authenticated request must be authorized for to process the
query.
|
void |
validate()
Validates a SQL query and populates
PlannerContext.getResourceActions(). |
public static final String UNNAMED_INGESTION_COLUMN_ERROR
public void validate()
throws org.apache.calcite.sql.parser.SqlParseException,
org.apache.calcite.tools.ValidationException
PlannerContext.getResourceActions().org.apache.calcite.sql.parser.SqlParseExceptionorg.apache.calcite.tools.ValidationExceptionpublic PrepareResult prepare()
validate() which must be
called first.
A query can be prepared on a data source without having permissions on
that data source. This odd state of affairs is necessary because
DruidViewMacro prepares
a view while having no information about the user of that view.public Access authorize(Function<Set<ResourceAction>,Access> authorizer, boolean authorizeContextParams)
authorizer - a function from resource actions to a Access result.public Set<ResourceAction> resourceActions(boolean includeContext)
null if the
planner has not yet advanced to the validation step. This may occur if
validation fails and the caller accesses the resource
actions as part of clean-up.public PlannerResult plan() throws org.apache.calcite.tools.ValidationException
PlannerResult which can be used to actually execute the query.
Ideally, the query can be planned into a native Druid query, using planWithDruidConvention(org.apache.calcite.rel.RelRoot, org.apache.calcite.sql.SqlExplain, org.apache.calcite.sql.SqlInsert), but will
fall-back to planWithBindableConvention(org.apache.calcite.rel.RelRoot, org.apache.calcite.sql.SqlExplain) if this is not possible.
Planning reuses the validation done in `validate()` which must be called first.org.apache.calcite.tools.ValidationExceptionpublic PlannerContext getPlannerContext()
public PrepareResult prepareResult()
public void close()
close in interface Closeableclose in interface AutoCloseableCopyright © 2011–2022 The Apache Software Foundation. All rights reserved.