use of org.apache.flink.table.planner.plan.FlinkCalciteCatalogReader in project flink by apache.
the class PlannerContext method createCatalogReader.
public FlinkCalciteCatalogReader createCatalogReader(boolean lenientCaseSensitivity, String currentCatalog, String currentDatabase) {
SqlParser.Config sqlParserConfig = getSqlParserConfig();
final boolean caseSensitive;
if (lenientCaseSensitivity) {
caseSensitive = false;
} else {
caseSensitive = sqlParserConfig.caseSensitive();
}
SqlParser.Config newSqlParserConfig = SqlParser.configBuilder(sqlParserConfig).setCaseSensitive(caseSensitive).build();
SchemaPlus rootSchema = getRootSchema(this.rootSchema.plus());
return new FlinkCalciteCatalogReader(CalciteSchema.from(rootSchema), asList(asList(currentCatalog, currentDatabase), singletonList(currentCatalog)), typeFactory, CalciteConfig$.MODULE$.connectionConfig(newSqlParserConfig));
}
use of org.apache.flink.table.planner.plan.FlinkCalciteCatalogReader in project flink by apache.
the class PlannerContext method createRelBuilder.
/**
* Creates a configured {@link FlinkRelBuilder} for a planning session.
*
* @param currentCatalog the current default catalog to look for first during planning.
* @param currentDatabase the current default database to look for first during planning.
* @return configured rel builder
*/
public FlinkRelBuilder createRelBuilder(String currentCatalog, String currentDatabase) {
FlinkCalciteCatalogReader relOptSchema = createCatalogReader(false, currentCatalog, currentDatabase);
Context chain = Contexts.of(context, // Sets up the ViewExpander explicitly for FlinkRelBuilder.
createFlinkPlanner(currentCatalog, currentDatabase).createToRelContext());
return new FlinkRelBuilder(chain, cluster, relOptSchema);
}
Aggregations