You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by st...@apache.org on 2022/02/12 07:02:23 UTC

[impala] 01/03: IMPALA-10648 addendum: Handle null return value from catalog's renameTable() api

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

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

commit b02dba74d8f072c206c3da2eca1b492c7b44a839
Author: Sourabh Goyal <so...@cloudera.com>
AuthorDate: Thu Feb 10 10:44:34 2022 -0800

    IMPALA-10648 addendum: Handle null return value from catalog's
    renameTable() api
    
    CatalogServiceCatalog.renameTable(oldTable, newTable) api
    sometimes return null if oldTable's db does not exist
    in cache. The caller of this api should check for null
    return value.
    
    Change-Id: Ia3661b351cad16ead22608dcef33789f0ba2fb6f
    Reviewed-on: http://gerrit.cloudera.org:8080/18221
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 .../apache/impala/catalog/metastore/CatalogMetastoreServiceHandler.java | 2 +-
 .../org/apache/impala/catalog/metastore/MetastoreServiceHandler.java    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fe/src/main/java/org/apache/impala/catalog/metastore/CatalogMetastoreServiceHandler.java b/fe/src/main/java/org/apache/impala/catalog/metastore/CatalogMetastoreServiceHandler.java
index cdd4226..c5c66d8 100644
--- a/fe/src/main/java/org/apache/impala/catalog/metastore/CatalogMetastoreServiceHandler.java
+++ b/fe/src/main/java/org/apache/impala/catalog/metastore/CatalogMetastoreServiceHandler.java
@@ -1322,7 +1322,7 @@ public class CatalogMetastoreServiceHandler extends MetastoreServiceHandler {
         // ALTER TABLE/VIEW RENAME is implemented as an ADD + DROP.
         Pair<org.apache.impala.catalog.Table, org.apache.impala.catalog.Table> result =
             catalog_.renameTable(oldTTable, newTTable);
-        if (result.first == null && result.second == null) {
+        if (result == null || result.first == null || result.second == null) {
           throw new CatalogException("failed to rename table " + oldTTable + " to " +
               newTTable + " for " + apiName);
         }
diff --git a/fe/src/main/java/org/apache/impala/catalog/metastore/MetastoreServiceHandler.java b/fe/src/main/java/org/apache/impala/catalog/metastore/MetastoreServiceHandler.java
index 0b624c7..0db30cc 100644
--- a/fe/src/main/java/org/apache/impala/catalog/metastore/MetastoreServiceHandler.java
+++ b/fe/src/main/java/org/apache/impala/catalog/metastore/MetastoreServiceHandler.java
@@ -3127,7 +3127,7 @@ public abstract class MetastoreServiceHandler extends AbstractThriftHiveMetastor
     LOG.debug("Renaming " + tableInfo);
     Pair<org.apache.impala.catalog.Table, org.apache.impala.catalog.Table> result =
         catalog_.renameTable(oldTable, newTable);
-    if (result.first == null || result.second == null) {
+    if (result == null || result.first == null || result.second == null) {
       LOG.debug("Couldn't rename " + tableInfo);
     } else {
       LOG.info("Successfully renamed " + tableInfo);