You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ng...@apache.org on 2022/08/10 04:06:30 UTC

[hive] branch master updated: HIVE-26192: JDBC data connector queries occur exception at cbo stage (#3260)

This is an automated email from the ASF dual-hosted git repository.

ngangam pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new 5c872d4d4c0 HIVE-26192: JDBC data connector queries occur exception at cbo stage (#3260)
5c872d4d4c0 is described below

commit 5c872d4d4c0e8623b8010552c7aaf0fc484f05b6
Author: Butao Zhang <97...@users.noreply.github.com>
AuthorDate: Wed Aug 10 12:06:19 2022 +0800

    HIVE-26192: JDBC data connector queries occur exception at cbo stage (#3260)
---
 .../queries/clientpositive/dataconnector_mysql.q   |  3 ++
 .../clientpositive/llap/dataconnector_mysql.q.out  | 33 ++++++++++++++++++++++
 .../jdbc/AbstractJDBCConnectorProvider.java        |  3 +-
 3 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/ql/src/test/queries/clientpositive/dataconnector_mysql.q b/ql/src/test/queries/clientpositive/dataconnector_mysql.q
index edab15c2452..757c2f77387 100644
--- a/ql/src/test/queries/clientpositive/dataconnector_mysql.q
+++ b/ql/src/test/queries/clientpositive/dataconnector_mysql.q
@@ -14,6 +14,9 @@ SHOW DATABASES;
 USE db_mysql;
 SHOW TABLES;
 
+SHOW CREATE TABLE country;
+SELECT * FROM country;
+
 -- clean up so it won't affect other tests
 DROP DATABASE db_mysql;
 DROP CONNECTOR mysql_qtest;
diff --git a/ql/src/test/results/clientpositive/llap/dataconnector_mysql.q.out b/ql/src/test/results/clientpositive/llap/dataconnector_mysql.q.out
index c771d29d98a..351f6d2fea7 100644
--- a/ql/src/test/results/clientpositive/llap/dataconnector_mysql.q.out
+++ b/ql/src/test/results/clientpositive/llap/dataconnector_mysql.q.out
@@ -50,6 +50,39 @@ POSTHOOK: Input: database:db_mysql
 city
 country
 state
+PREHOOK: query: SHOW CREATE TABLE country
+PREHOOK: type: SHOW_CREATETABLE
+PREHOOK: Input: db_mysql@country
+POSTHOOK: query: SHOW CREATE TABLE country
+POSTHOOK: type: SHOW_CREATETABLE
+POSTHOOK: Input: db_mysql@country
+CREATE EXTERNAL TABLE `country`(
+  `name` varchar(255) COMMENT 'from deserializer')
+ROW FORMAT SERDE 
+  'org.apache.hive.storage.jdbc.JdbcSerDe' 
+STORED BY 
+  'org.apache.hive.storage.jdbc.JdbcStorageHandler' 
+WITH SERDEPROPERTIES ( 
+  'serialization.format'='1')
+TBLPROPERTIES (
+  'hive.sql.database.type'='MYSQL', 
+  'hive.sql.dbcp.password'='qtestpassword', 
+  'hive.sql.dbcp.username'='root', 
+  'hive.sql.jdbc.driver'='com.mysql.jdbc.Driver', 
+  'hive.sql.jdbc.url'='jdbc:mysql://localhost:3306/qtestDB', 
+  'hive.sql.schema'='qtestDB', 
+  'hive.sql.table'='country')
+PREHOOK: query: SELECT * FROM country
+PREHOOK: type: QUERY
+PREHOOK: Input: db_mysql@country
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT * FROM country
+POSTHOOK: type: QUERY
+POSTHOOK: Input: db_mysql@country
+#### A masked pattern was here ####
+India
+Russia
+USA
 PREHOOK: query: DROP DATABASE db_mysql
 PREHOOK: type: DROPDATABASE
 PREHOOK: Input: database:db_mysql
diff --git a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/dataconnector/jdbc/AbstractJDBCConnectorProvider.java b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/dataconnector/jdbc/AbstractJDBCConnectorProvider.java
index 09d0784b929..d392a2567ae 100644
--- a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/dataconnector/jdbc/AbstractJDBCConnectorProvider.java
+++ b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/dataconnector/jdbc/AbstractJDBCConnectorProvider.java
@@ -241,7 +241,8 @@ public abstract class AbstractJDBCConnectorProvider extends AbstractDataConnecto
       //Setting the table properties.
       table.getParameters().put(JDBC_DATABASE_TYPE, this.type);
       table.getParameters().put(JDBC_DRIVER, this.driverClassName);
-      table.getParameters().put(JDBC_TABLE, scoped_db+"."+tableName);
+      table.getParameters().put(JDBC_TABLE, tableName);
+      table.getParameters().put(JDBC_SCHEMA, scoped_db);
       table.getParameters().put(JDBC_URL, this.jdbcUrl);
       table.getParameters().put(hive_metastoreConstants.META_TABLE_STORAGE, JDBC_HIVE_STORAGE_HANDLER_ID);
       table.getParameters().put("EXTERNAL", "TRUE");