[ 
https://issues.apache.org/jira/browse/HIVE-18494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16331891#comment-16331891
 ] 

Gopal V commented on HIVE-18494:
--------------------------------

Here's a temporary fix for the problem

{code}
--- 
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
@@ -392,7 +392,7 @@ public Database getDatabase(String dbName) throws 
MetaException{
    */
   public List<String> getTables(String db_name, TableType tableType) throws 
MetaException {
     List<String> ret = new ArrayList<String>();
-    String queryText = "SELECT " + TBLS + ".\"TBL_NAME\""
+    String queryText = "SELECT " + TBLS + ".\"TBL_NAME\", " + TBLS + 
".\"TBL_ID\""
       + " FROM " + TBLS + " "
       + " INNER JOIN " + DBS + " ON " + TBLS + ".\"DB_ID\" = " + DBS + 
".\"DB_ID\" "
       + " WHERE " + DBS + ".\"NAME\" = ? "
@@ -425,7 +425,7 @@ public Database getDatabase(String dbName) throws 
MetaException{
    */
   public List<String> getMaterializedViewsForRewriting(String db_name) throws 
MetaException {
     List<String> ret = new ArrayList<String>();
-    String queryText = "SELECT " + TBLS + ".\"TBL_NAME\""
+    String queryText = "SELECT " + TBLS + ".\"TBL_NAME\", " + TBLS + 
".\"TBL_ID\""
       + " FROM " + TBLS + " "
       + " INNER JOIN " + DBS + " ON " + TBLS + ".\"DB_ID\" = " + DBS + 
".\"DB_ID\" "
       + " WHERE " + DBS + ".\"NAME\" = ? AND " + TBLS + ".\"TBL_TYPE\" = ? " ;
{code}

> Regression: from HIVE-18069, the metastore directsql is getting disabled
> ------------------------------------------------------------------------
>
>                 Key: HIVE-18494
>                 URL: https://issues.apache.org/jira/browse/HIVE-18494
>             Project: Hive
>          Issue Type: Bug
>          Components: Standalone Metastore
>            Reporter: Gopal V
>            Priority: Major
>
> {code:java}
> 018-01-19T02:12:34,457  WARN [pool-10-thread-1] metastore.ObjectStore: 
> Falling back to ORM path due to direct SQL failure (this is not an error): 
> java.lang.String cannot be cast to [Ljava.lang.Object; at
> org.apache.hadoop.hive.metastore.MetaStoreDirectSql.getTables(MetaStoreDirectSql.java:412)
>  at 
> org.apache.hadoop.hive.metastore.ObjectStore$2.getSqlResult(ObjectStore.java:1336)
> 2018-01-19T02:12:34,457 DEBUG [pool-10-thread-1] metastore.ObjectStore: Full 
> DirectSQL callstack for debugging (note: this is not an error)
> java.lang.ClassCastException: java.lang.String cannot be cast to 
> [Ljava.lang.Object;
>         at 
> org.apache.hadoop.hive.metastore.MetaStoreDirectSql.getTables(MetaStoreDirectSql.java:412)
>  ~[hive-exec-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
>         at 
> org.apache.hadoop.hive.metastore.ObjectStore$2.getSqlResult(ObjectStore.java:1336)
>  ~[hive-exec-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
>         at 
> org.apache.hadoop.hive.metastore.ObjectStore$2.getSqlResult(ObjectStore.java:1332)
>  ~[hive-exec-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
>         at 
> org.apache.hadoop.hive.metastore.ObjectStore$GetHelper.run(ObjectStore.java:3200)
>  ~[hive-exec-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
>         at 
> org.apache.hadoop.hive.metastore.ObjectStore.getTablesInternal(ObjectStore.java:1344)
>  ~[hive-exec-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
>         at 
> org.apache.hadoop.hive.metastore.ObjectStore.getTables(ObjectStore.java:1323) 
> ~[hive-exec-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
> {code}
> The DataNucleus layer returns List<String> for this case, when exactly one 
> column has been selected.
> And MetastoreDirectSQL is disabled for all further queries.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to