arina-ielchiieva commented on a change in pull request #1940: DRILL-7406: 
Update Calcite to 1.21.0
URL: https://github.com/apache/drill/pull/1940#discussion_r361323447
 
 

 ##########
 File path: 
contrib/storage-jdbc/src/main/java/org/apache/drill/exec/store/jdbc/JdbcCatalogSchema.java
 ##########
 @@ -0,0 +1,169 @@
+/*
+ * 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.drill.exec.store.jdbc;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.calcite.schema.Schema;
+import org.apache.calcite.schema.SchemaPlus;
+import org.apache.calcite.schema.Table;
+import org.apache.calcite.sql.SqlDialect;
+import org.apache.drill.exec.store.AbstractSchema;
+import org.apache.drill.exec.store.SchemaFactory;
+
+class JdbcCatalogSchema extends AbstractSchema {
+
+  private final Map<String, CapitalizingJdbcSchema> schemaMap;
+  private final CapitalizingJdbcSchema defaultSchema;
+
+  JdbcCatalogSchema(String name, DataSource source, SqlDialect dialect, 
DrillJdbcConvention convention, boolean caseSensitive) {
+    super(Collections.emptyList(), name);
+    this.schemaMap = new HashMap<>();
+    String connectionSchemaName = null;
+    try (Connection con = source.getConnection();
+         ResultSet set = con.getMetaData().getCatalogs()) {
+      connectionSchemaName = con.getSchema();
+      while (set.next()) {
+        final String catalogName = set.getString(1);
+        CapitalizingJdbcSchema schema = new CapitalizingJdbcSchema(
+            getSchemaPath(), catalogName, source, dialect, convention, 
catalogName, null, caseSensitive);
+        schemaMap.put(schema.getName(), schema);
+      }
+    } catch (SQLException e) {
+      JdbcStoragePlugin.logger.warn("Failure while attempting to load JDBC 
schema.", e);
 
 Review comment:
   Why are using logger from different class?

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