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


The following commit(s) were added to refs/heads/master by this push:
     new 9af97895f IMPALA-12526: Fix NullPointerException in 
testResetMetadataDesc
9af97895f is described below

commit 9af97895f891c465e3723be9140001ebd60d747b
Author: stiga-huang <[email protected]>
AuthorDate: Tue Nov 7 16:09:43 2023 +0800

    IMPALA-12526: Fix NullPointerException in testResetMetadataDesc
    
    BackendConfig.INSTANCE could be null when running
    CatalogOpUtilTest#testResetMetadataDesc(). This patch adds a setup
    method to make sure it's initialized.
    
    Tests
     - Verified the issue is resolved by running the test individually:
       (pushd fe && mvn test -Dtest=CatalogOpUtilTest#testResetMetadataDesc)
    
    Change-Id: Ic5c1c75ec92f4833caf1380a55a0bfd5056ef0cd
    Reviewed-on: http://gerrit.cloudera.org:8080/20674
    Reviewed-by: Impala Public Jenkins <[email protected]>
    Tested-by: Michael Smith <[email protected]>
---
 .../test/java/org/apache/impala/util/CatalogOpUtilTest.java   | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/fe/src/test/java/org/apache/impala/util/CatalogOpUtilTest.java 
b/fe/src/test/java/org/apache/impala/util/CatalogOpUtilTest.java
index 11d8a9f62..ab1759054 100644
--- a/fe/src/test/java/org/apache/impala/util/CatalogOpUtilTest.java
+++ b/fe/src/test/java/org/apache/impala/util/CatalogOpUtilTest.java
@@ -23,9 +23,11 @@ import org.apache.impala.analysis.PrivilegeSpec;
 import org.apache.impala.analysis.ResetMetadataStmt;
 import org.apache.impala.analysis.TableName;
 import org.apache.impala.authorization.User;
+import org.apache.impala.service.BackendConfig;
 import org.apache.impala.thrift.TAlterDbParams;
 import org.apache.impala.thrift.TAlterDbType;
 import org.apache.impala.thrift.TAlterTableParams;
+import org.apache.impala.thrift.TBackendGflags;
 import org.apache.impala.thrift.TColumnName;
 import org.apache.impala.thrift.TCommentOnParams;
 import org.apache.impala.thrift.TCreateDbParams;
@@ -47,6 +49,7 @@ import org.apache.impala.thrift.TPrincipalType;
 import org.apache.impala.thrift.TPrivilegeLevel;
 import org.apache.impala.thrift.TResetMetadataRequest;
 import org.apache.impala.thrift.TTableName;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 import java.util.Collections;
@@ -55,6 +58,14 @@ import static org.junit.Assert.assertEquals;
 
 public class CatalogOpUtilTest {
 
+  @BeforeClass
+  public static void setup() {
+    // Make sure BackendConfig.INSTANCE is initialized.
+    if (BackendConfig.INSTANCE == null) {
+      BackendConfig.create(new TBackendGflags());
+    }
+  }
+
   private void testResetStmt(ResetMetadataStmt stmt, User user, String 
expected)
       throws Exception {
     stmt.setRequestingUser(user);

Reply via email to