You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jc...@apache.org on 2018/01/23 16:04:14 UTC
[2/2] hive git commit: HIVE-18494: Regression: from HIVE-18069,
the metastore directsql is getting disabled (Jesus Camacho Rodriguez,
reviewed by Gopal V)
HIVE-18494: Regression: from HIVE-18069, the metastore directsql is getting disabled (Jesus Camacho Rodriguez, reviewed by Gopal V)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/f0b824ad
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/f0b824ad
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/f0b824ad
Branch: refs/heads/master
Commit: f0b824adeff21c0e63abf42ed7da3b460b3a5423
Parents: 9797619
Author: Jesus Camacho Rodriguez <jc...@apache.org>
Authored: Fri Jan 19 10:11:17 2018 -0800
Committer: Jesus Camacho Rodriguez <jc...@apache.org>
Committed: Tue Jan 23 07:41:53 2018 -0800
----------------------------------------------------------------------
.../hive/metastore/MetaStoreDirectSql.java | 33 +++++---------------
1 file changed, 8 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/f0b824ad/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
index 47e2e6f..dad2d35 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
@@ -390,8 +390,7 @@ class MetaStoreDirectSql {
* @param tableType Table type, or null if we want to get all tables
* @return list of table names
*/
- public List<String> getTables(String db_name, TableType tableType) throws MetaException {
- List<String> ret = new ArrayList<String>();
+ public List<String> getTables(String dbName, TableType tableType) throws MetaException {
String queryText = "SELECT " + TBLS + ".\"TBL_NAME\""
+ " FROM " + TBLS + " "
+ " INNER JOIN " + DBS + " ON " + TBLS + ".\"DB_ID\" = " + DBS + ".\"DB_ID\" "
@@ -399,51 +398,35 @@ class MetaStoreDirectSql {
+ (tableType == null ? "" : "AND " + TBLS + ".\"TBL_TYPE\" = ? ") ;
List<String> pms = new ArrayList<String>();
- pms.add(db_name);
+ pms.add(dbName);
if (tableType != null) {
pms.add(tableType.toString());
}
Query<?> queryParams = pm.newQuery("javax.jdo.query.SQL", queryText);
- List<Object[]> sqlResult = ensureList(executeWithArray(
- queryParams, pms.toArray(), queryText));
-
- if (!sqlResult.isEmpty()) {
- for (Object[] line : sqlResult) {
- ret.add(extractSqlString(line[0]));
- }
- }
- return ret;
+ return executeWithArray(
+ queryParams, pms.toArray(), queryText);
}
/**
* Get table names by using direct SQL queries.
*
* @param dbName Metastore database namme
- * @param tableType Table type, or null if we want to get all tables
* @return list of table names
*/
- public List<String> getMaterializedViewsForRewriting(String db_name) throws MetaException {
- List<String> ret = new ArrayList<String>();
+ public List<String> getMaterializedViewsForRewriting(String dbName) throws MetaException {
String queryText = "SELECT " + TBLS + ".\"TBL_NAME\""
+ " FROM " + TBLS + " "
+ " INNER JOIN " + DBS + " ON " + TBLS + ".\"DB_ID\" = " + DBS + ".\"DB_ID\" "
+ " WHERE " + DBS + ".\"NAME\" = ? AND " + TBLS + ".\"TBL_TYPE\" = ? " ;
List<String> pms = new ArrayList<String>();
- pms.add(db_name);
+ pms.add(dbName);
pms.add(TableType.MATERIALIZED_VIEW.toString());
Query<?> queryParams = pm.newQuery("javax.jdo.query.SQL", queryText);
- List<Object[]> sqlResult = ensureList(executeWithArray(
- queryParams, pms.toArray(), queryText));
-
- if (!sqlResult.isEmpty()) {
- for (Object[] line : sqlResult) {
- ret.add(extractSqlString(line[0]));
- }
- }
- return ret;
+ return executeWithArray(
+ queryParams, pms.toArray(), queryText);
}
/**