dawidwys 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_r284995835
 
 

 ##########
 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:
   I would say this is the core difference from the previous PR.
   
   We do not create a separate Calcite schema, but we use the 
`CatalogManagerCalciteSchema` as the root one (that's why we had to create the 
`CalciteSchemaBuilder`). At the same time `CatalogManagerCalciteSchema` is just 
a thin adapter around `CatalogManager`. That means any changes to 
`CatalogManager` are directly visible by Calcite.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to