OmniSciDB  b24e664e58
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
org.apache.calcite.prepare.MapDPlanner Class Reference
+ Inheritance diagram for org.apache.calcite.prepare.MapDPlanner:
+ Collaboration diagram for org.apache.calcite.prepare.MapDPlanner:

Classes

class  CompletionResult
 

Public Member Functions

 MapDPlanner (FrameworkConfig config)
 
void ready ()
 
CompletionResult getCompletionHints (final String sql, final int cursor, final List< String > visibleTables)
 
RelRoot rel (SqlNode sql) throws RelConversionException
 
void setFilterPushDownInfo (final List< MapDParserOptions.FilterPushDownInfo > filterPushDownInfo)
 

Package Attributes

FrameworkConfig config
 

Private Member Functions

CalciteCatalogReader createCatalogReader ()
 
RelRoot applyFilterPushdown (RelRoot root)
 

Static Private Member Functions

static SchemaPlus rootSchema (SchemaPlus schema)
 

Private Attributes

List
< MapDParserOptions.FilterPushDownInfo > 
filterPushDownInfo
 

Detailed Description

Customised version of the PlannerImpl for MapD. Used to be a copy of PlannerImpl, refactored now to use inheritance to minimize maintenance efforts. Implementation of org.apache.calcite.tools.Planner.

Definition at line 53 of file MapDPlanner.java.

Constructor & Destructor Documentation

org.apache.calcite.prepare.MapDPlanner.MapDPlanner ( FrameworkConfig  config)
inline

Definition at line 58 of file MapDPlanner.java.

References org.apache.calcite.prepare.MapDPlanner.config.

58  {
59  super(config);
60  this.config = config;
61  }

Member Function Documentation

RelRoot org.apache.calcite.prepare.MapDPlanner.applyFilterPushdown ( RelRoot  root)
inlineprivate

Definition at line 143 of file MapDPlanner.java.

References org.apache.calcite.prepare.MapDPlanner.filterPushDownInfo.

Referenced by org.apache.calcite.prepare.MapDPlanner.rel().

143  {
144  if (filterPushDownInfo.isEmpty()) {
145  return root;
146  }
147  final DynamicFilterJoinRule dynamicFilterJoinRule = new DynamicFilterJoinRule(true,
148  RelFactories.LOGICAL_BUILDER,
149  FilterJoinRule.TRUE_PREDICATE,
151  final HepProgram program =
152  HepProgram.builder().addRuleInstance(dynamicFilterJoinRule).build();
153  HepPlanner prePlanner = new HepPlanner(program);
154  prePlanner.setRoot(root.rel);
155  final RelNode rootRelNode = prePlanner.findBestExp();
156  filterPushDownInfo.clear();
157  return root.withRel(rootRelNode);
158  }
List< MapDParserOptions.FilterPushDownInfo > filterPushDownInfo

+ Here is the caller graph for this function:

CalciteCatalogReader org.apache.calcite.prepare.MapDPlanner.createCatalogReader ( )
inlineprivate

Definition at line 82 of file MapDPlanner.java.

References org.apache.calcite.prepare.MapDPlanner.config, org.apache.calcite.prepare.MapDPlanner.rootSchema(), and Experimental.String.

Referenced by org.apache.calcite.prepare.MapDPlanner.getCompletionHints().

82  {
83  final SchemaPlus rootSchema = rootSchema(config.getDefaultSchema());
84  final Context context = config.getContext();
85  final CalciteConnectionConfig connectionConfig;
86 
87  if (context != null) {
88  connectionConfig = context.unwrap(CalciteConnectionConfig.class);
89  } else {
90  Properties properties = new Properties();
91  properties.setProperty(CalciteConnectionProperty.CASE_SENSITIVE.camelName(),
92  String.valueOf(config.getParserConfig().caseSensitive()));
93  connectionConfig = new CalciteConnectionConfigImpl(properties);
94  }
95 
96  return new CalciteCatalogReader(CalciteSchema.from(rootSchema),
97  CalciteSchema.from(config.getDefaultSchema()).path(null),
98  getTypeFactory(),
99  connectionConfig);
100  }
static SchemaPlus rootSchema(SchemaPlus schema)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CompletionResult org.apache.calcite.prepare.MapDPlanner.getCompletionHints ( final String  sql,
final int  cursor,
final List< String >  visibleTables 
)
inline

Definition at line 120 of file MapDPlanner.java.

References org.apache.calcite.prepare.MapDPlanner.config, org.apache.calcite.prepare.MapDPlanner.createCatalogReader(), org.apache.calcite.prepare.MapDPlanner.ready(), and Experimental.String.

121  {
122  ready();
123  MapDSqlAdvisorValidator advisor_validator = new MapDSqlAdvisorValidator(visibleTables,
124  config.getOperatorTable(),
126  getTypeFactory(),
127  SqlConformanceEnum.LENIENT);
128  SqlAdvisor advisor = new MapDSqlAdvisor(advisor_validator);
129  String[] replaced = new String[1];
130  int adjusted_cursor = cursor < 0 ? sql.length() : cursor;
131  java.util.List<SqlMoniker> hints =
132  advisor.getCompletionHints(sql, adjusted_cursor, replaced);
133  return new CompletionResult(hints, replaced[0]);
134  }
CalciteCatalogReader createCatalogReader()

+ Here is the call graph for this function:

void org.apache.calcite.prepare.MapDPlanner.ready ( )
inline

Definition at line 102 of file MapDPlanner.java.

Referenced by org.apache.calcite.prepare.MapDPlanner.getCompletionHints().

102  {
103  // need to call ready on the super class, but that method is marked private
104  // circumventing via reflection for now
105  try {
106  Method readyMethod = getClass().getSuperclass().getDeclaredMethod("ready");
107  readyMethod.setAccessible(true);
108  readyMethod.invoke(this);
109  } catch (InvocationTargetException e) {
110  if (e.getCause() instanceof RuntimeException) {
111  throw(RuntimeException) e.getCause();
112  } else {
113  throw new RuntimeException(e.getCause());
114  }
115  } catch (Exception e) {
116  throw new RuntimeException(e);
117  }
118  }

+ Here is the caller graph for this function:

RelRoot org.apache.calcite.prepare.MapDPlanner.rel ( SqlNode  sql) throws RelConversionException
inline

Definition at line 137 of file MapDPlanner.java.

References org.apache.calcite.prepare.MapDPlanner.applyFilterPushdown().

137  {
138  RelRoot root = super.rel(sql);
139  root = applyFilterPushdown(root);
140  return root;
141  }
RelRoot applyFilterPushdown(RelRoot root)

+ Here is the call graph for this function:

static SchemaPlus org.apache.calcite.prepare.MapDPlanner.rootSchema ( SchemaPlus  schema)
inlinestaticprivate

Definition at line 63 of file MapDPlanner.java.

Referenced by org.apache.calcite.prepare.MapDPlanner.createCatalogReader().

63  {
64  for (;;) {
65  if (schema.getParentSchema() == null) {
66  return schema;
67  }
68  schema = schema.getParentSchema();
69  }
70  }

+ Here is the caller graph for this function:

void org.apache.calcite.prepare.MapDPlanner.setFilterPushDownInfo ( final List< MapDParserOptions.FilterPushDownInfo >  filterPushDownInfo)
inline

Definition at line 160 of file MapDPlanner.java.

References org.apache.calcite.prepare.MapDPlanner.filterPushDownInfo.

161  {
162  this.filterPushDownInfo = filterPushDownInfo;
163  }
List< MapDParserOptions.FilterPushDownInfo > filterPushDownInfo

Member Data Documentation

List<MapDParserOptions.FilterPushDownInfo> org.apache.calcite.prepare.MapDPlanner.filterPushDownInfo
private

The documentation for this class was generated from the following file: