xuefuz commented on a change in pull request #8404: [FLINK-11476][table] Create
CatalogManager to manage multiple catalogs
URL: https://github.com/apache/flink/pull/8404#discussion_r284928417
##########
File path:
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/PlanningConfigurationBuilder.java
##########
@@ -129,16 +142,48 @@ public Context getContext() {
}
/**
- * Creates a configured {@link FrameworkConfig} for a planning session.
- *
- * @param defaultSchema the default schema to look for first during
planning
- * @return configured framework config
+ * Returns the SQL parser config for this environment including a
custom Calcite configuration.
*/
- public FrameworkConfig createFrameworkConfig(SchemaPlus defaultSchema) {
+ public SqlParser.Config getSqlParserConfig() {
+ return
JavaScalaConversionUtil.toJava(calciteConfig(tableConfig).sqlParserConfig()).orElseGet(()
->
+ // we use Java lex because back ticks are easier than
double quotes in programming
+ // and cases are preserved
+ SqlParser
+ .configBuilder()
+ .setLex(Lex.JAVA)
+ .build());
+ }
+
+ private CatalogReader createCatalogReader(
+ boolean lenientCaseSensitivity,
+ String currentCatalog,
+ String currentDatabase) {
+ SqlParser.Config sqlParserConfig = getSqlParserConfig();
+ final boolean caseSensitive;
+ if (lenientCaseSensitivity) {
+ caseSensitive = false;
+ } else {
+ caseSensitive = sqlParserConfig.caseSensitive();
+ }
+
+ SqlParser.Config parserConfig =
SqlParser.configBuilder(sqlParserConfig)
+ .setCaseSensitive(caseSensitive)
+ .build();
+
+ return new CatalogReader(
Review comment:
Maybe this is taken care of somewhere else, but I'm wondering how we tell
Calcite to look up in new catalogs that are registered later on in user's
session.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services