[GitHub] [flink] xuefuz commented on a change in pull request #8541: [FLINK-9172][sql-client] Support catalogs in SQL-Client yaml config file

2019-05-27 Thread GitBox
xuefuz commented on a change in pull request #8541: [FLINK-9172][sql-client] 
Support catalogs in SQL-Client yaml config file
URL: https://github.com/apache/flink/pull/8541#discussion_r287926431
 
 

 ##
 File path: 
flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/CatalogFactory.java
 ##
 @@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.factories;
+
+import org.apache.flink.annotation.PublicEvolving;
+import org.apache.flink.table.catalog.Catalog;
+
+import java.util.Map;
+
+/**
+ * A factory to create configured catalog instances based on string-based 
properties. See
+ * also {@link TableFactory} for more information.
+ */
+@PublicEvolving
+public interface CatalogFactory extends TableFactory {
 
 Review comment:
   It's a little weird that CatalogFactory extends from TableFactory. Any 
thoughts?


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


[GitHub] [flink] xuefuz commented on a change in pull request #8541: [FLINK-9172][sql-client] Support catalogs in SQL-Client yaml config file

2019-05-27 Thread GitBox
xuefuz commented on a change in pull request #8541: [FLINK-9172][sql-client] 
Support catalogs in SQL-Client yaml config file
URL: https://github.com/apache/flink/pull/8541#discussion_r287918350
 
 

 ##
 File path: 
flink-table/flink-sql-client/src/test/java/org/apache/flink/table/client/gateway/local/EnvironmentTest.java
 ##
 @@ -70,4 +79,24 @@ public void testMerging() throws Exception {
assertTrue(merged.getExecution().isStreamingExecution());
assertEquals(16, merged.getExecution().getMaxParallelism());
}
+
+   @Test
+   public void testDuplicateCatalog() {
+   exception.expect(SqlClientException.class);
+   exception.expectMessage("Cannot create catalog 'catalog2' 
because a catalog with this name is already registered.");
+   Environment env = new Environment();
+   env.setCatalogs(Arrays.asList(
+   getCatalog("catalog1", "test"),
+   getCatalog("catalog2", "test"),
+   getCatalog("catalog2", "test")));
+   }
+
+   private static Map getCatalog(String name, String type) 
{
 
 Review comment:
   rename to createCatalog or instantiateCatalog?


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


[GitHub] [flink] xuefuz commented on a change in pull request #8541: [FLINK-9172][sql-client] Support catalogs in SQL-Client yaml config file

2019-05-27 Thread GitBox
xuefuz commented on a change in pull request #8541: [FLINK-9172][sql-client] 
Support catalogs in SQL-Client yaml config file
URL: https://github.com/apache/flink/pull/8541#discussion_r287912450
 
 

 ##
 File path: 
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/gateway/local/ExecutionContext.java
 ##
 @@ -227,6 +241,12 @@ private static ClusterSpecification 
createClusterSpecification(CustomCommandLine
}
}
 
+   private Catalog createCatalog(String name, Map 
catalogProperties, ClassLoader classLoader) {
+   final CatalogFactory factory =
+   TableFactoryService.find(CatalogFactory.class, 
catalogProperties, classLoader);
 
 Review comment:
   Shall we rename the factory service, coz we are here creating catalogs 
rather than tables.


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