use of org.apache.calcite.config.CalciteConnectionConfig in project druid by druid-io.
the class DruidPlanner method getValidator.
/**
* Constructs an SQL validator, just like papa {@link #planner} uses.
*/
private SqlValidator getValidator() {
// this is sort of lame, planner won't cough up its validator, which is nice and seeded after validating a query,
// but it is private and has no accessors, so make another one so we can get the parameter types... but i suppose
// beats creating our own Prepare and Planner implementations
Preconditions.checkNotNull(planner.getTypeFactory());
final CalciteConnectionConfig connectionConfig;
if (frameworkConfig.getContext() != null) {
connectionConfig = frameworkConfig.getContext().unwrap(CalciteConnectionConfig.class);
} else {
Properties properties = new Properties();
properties.setProperty(CalciteConnectionProperty.CASE_SENSITIVE.camelName(), String.valueOf(PlannerFactory.PARSER_CONFIG.caseSensitive()));
connectionConfig = new CalciteConnectionConfigImpl(properties);
}
Prepare.CatalogReader catalogReader = new CalciteCatalogReader(CalciteSchema.from(frameworkConfig.getDefaultSchema().getParentSchema()), CalciteSchema.from(frameworkConfig.getDefaultSchema()).path(null), planner.getTypeFactory(), connectionConfig);
return SqlValidatorUtil.newValidator(frameworkConfig.getOperatorTable(), catalogReader, planner.getTypeFactory(), DruidConformance.instance());
}
Aggregations