[ 
https://issues.apache.org/jira/browse/HIVE-25091?focusedWorklogId=755904&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-755904
 ]

ASF GitHub Bot logged work on HIVE-25091:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 12/Apr/22 17:23
            Start Date: 12/Apr/22 17:23
    Worklog Time Spent: 10m 
      Work Description: nrg4878 commented on code in PR #3167:
URL: https://github.com/apache/hive/pull/3167#discussion_r848677371


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/dataconnector/jdbc/AbstractJDBCConnectorProvider.java:
##########
@@ -27,6 +27,7 @@
 import org.apache.hadoop.hive.metastore.api.hive_metastoreConstants;
 import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
 import 
org.apache.hadoop.hive.metastore.dataconnector.AbstractDataConnectorProvider;
+import org.apache.hadoop.hive.metastore.dataconnector.IDataConnectorProvider;

Review Comment:
   nit: Unnecessary import?



##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/dataconnector/jdbc/MSSQLConnectorProvider.java:
##########
@@ -0,0 +1,97 @@
+/*
+ * 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.hadoop.hive.metastore.dataconnector.jdbc;
+
+import org.apache.hadoop.hive.metastore.ColumnType;
+import org.apache.hadoop.hive.metastore.api.DataConnector;
+import org.apache.hadoop.hive.metastore.api.MetaException;
+import org.apache.hadoop.hive.metastore.api.Table;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class MSSQLConnectorProvider extends AbstractJDBCConnectorProvider {
+    private static Logger LOG = 
LoggerFactory.getLogger(MySQLConnectorProvider.class);
+    private static final String DRIVER_CLASS = 
"com.microsoft.sqlserver.jdbc.SQLServerDriver".intern();
+
+    public MSSQLConnectorProvider(String dbName, DataConnector dataConn) {
+        super(dbName, dataConn, DRIVER_CLASS);
+        driverClassName = DRIVER_CLASS;
+    }
+
+    @Override protected ResultSet fetchTableMetadata(String tableName) throws 
MetaException {
+        ResultSet rs = null;
+        try {
+            rs = getConnection().getMetaData().getColumns(null, scoped_db, 
tableName, null);
+        } catch (Exception ex) {
+            LOG.warn("Could not retrieve table names from remote datasource, 
cause:" + ex.getMessage());
+            throw new MetaException("Could not retrieve table names from 
remote datasource, cause:" + ex);
+        }
+        return rs;
+    }
+
+    @Override protected ResultSet fetchTableNames() throws MetaException {
+        ResultSet rs = null;
+        try {
+            rs = getConnection().getMetaData().getTables(null, scoped_db, 
null, new String[] { "TABLE" });
+        } catch (SQLException sqle) {
+            LOG.warn("Could not retrieve table names from remote datasource, 
cause:" + sqle.getMessage());
+            throw new MetaException("Could not retrieve table names from 
remote datasource, cause:" + sqle);
+        }
+        return rs;
+    }
+
+    @Override protected String getCatalogName() {
+        return null;
+    }
+
+    @Override protected String getDatabaseName() {
+        return scoped_db;
+    }
+
+    protected String getDataType(String dbDataType, int size) {
+        String mappedType = super.getDataType(dbDataType, size);
+        if (!mappedType.equalsIgnoreCase(ColumnType.VOID_TYPE_NAME)) {
+            return mappedType;
+        }
+
+        // map any db specific types here.
+        //TODO: bit data types of oracle needs to be supported.

Review Comment:
   nit: TODO comment references oracle but this is MSSQL



##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/dataconnector/jdbc/OracleConnectorProvider.java:
##########
@@ -0,0 +1,99 @@
+/*
+ * 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.hadoop.hive.metastore.dataconnector.jdbc;
+
+import org.apache.hadoop.hive.metastore.ColumnType;
+import org.apache.hadoop.hive.metastore.api.DataConnector;
+import org.apache.hadoop.hive.metastore.api.MetaException;
+import org.apache.hadoop.hive.metastore.api.Table;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.List;
+import java.util.ArrayList;
+
+public class OracleConnectorProvider extends AbstractJDBCConnectorProvider {
+    private static Logger LOG = 
LoggerFactory.getLogger(MySQLConnectorProvider.class);

Review Comment:
   nit: Incorrect classname in the logger instantiation





Issue Time Tracking
-------------------

    Worklog Id:     (was: 755904)
    Time Spent: 1h 20m  (was: 1h 10m)

> Implement connector provider for MSSQL and Oracle
> -------------------------------------------------
>
>                 Key: HIVE-25091
>                 URL: https://issues.apache.org/jira/browse/HIVE-25091
>             Project: Hive
>          Issue Type: Sub-task
>            Reporter: Sai Hemanth Gantasala
>            Assignee: Sai Hemanth Gantasala
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> Provide an implementation of Connector provider for MSSQL and Oracle



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to