You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by yu...@apache.org on 2025/01/22 08:56:24 UTC

(gravitino) branch issue_6349 created (now 49eb3bb988)

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

yuqi4733 pushed a change to branch issue_6349
in repository https://gitbox.apache.org/repos/asf/gravitino.git


      at 49eb3bb988 Fix bugs in `AuthorizationUtils` and remove `protobuf-java` from catalog Hive

This branch includes the following new commits:

     new 49eb3bb988 Fix bugs in `AuthorizationUtils` and remove `protobuf-java` from catalog Hive

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(gravitino) 01/01: Fix bugs in `AuthorizationUtils` and remove `protobuf-java` from catalog Hive

Posted by yu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yuqi4733 pushed a commit to branch issue_6349
in repository https://gitbox.apache.org/repos/asf/gravitino.git

commit 49eb3bb988ebbbd6ddf5329b4db52f81c96e9b72
Author: yuqi <yu...@datastrato.com>
AuthorDate: Wed Jan 22 16:55:55 2025 +0800

    Fix bugs in `AuthorizationUtils` and remove `protobuf-java` from catalog Hive
---
 catalogs/hive-metastore-common/build.gradle.kts                      | 3 +++
 .../java/org/apache/gravitino/authorization/AuthorizationUtils.java  | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/catalogs/hive-metastore-common/build.gradle.kts b/catalogs/hive-metastore-common/build.gradle.kts
index 539c8291dd..26ec123c78 100644
--- a/catalogs/hive-metastore-common/build.gradle.kts
+++ b/catalogs/hive-metastore-common/build.gradle.kts
@@ -61,6 +61,9 @@ dependencies {
     exclude("org.eclipse.jetty.orbit", "javax.servlet")
     exclude("org.openjdk.jol")
     exclude("org.slf4j")
+    // protobuf-java is not needed for Hive Metastore, and it will conflict with gcp authorizations
+    // library
+    exclude("com.google.protobuf", "protobuf-java")
   }
   implementation(libs.hadoop2.common) {
     exclude("*")
diff --git a/core/src/main/java/org/apache/gravitino/authorization/AuthorizationUtils.java b/core/src/main/java/org/apache/gravitino/authorization/AuthorizationUtils.java
index 499ba5cbf1..60ffe3e83c 100644
--- a/core/src/main/java/org/apache/gravitino/authorization/AuthorizationUtils.java
+++ b/core/src/main/java/org/apache/gravitino/authorization/AuthorizationUtils.java
@@ -29,6 +29,7 @@ import java.util.Set;
 import java.util.function.BiConsumer;
 import java.util.function.Consumer;
 import java.util.stream.Collectors;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.gravitino.Catalog;
 import org.apache.gravitino.Entity;
 import org.apache.gravitino.GravitinoEnv;
@@ -476,7 +477,7 @@ public class AuthorizationUtils {
               Schema schema = GravitinoEnv.getInstance().schemaDispatcher().loadSchema(ident);
               if (schema.properties().containsKey(HiveConstants.LOCATION)) {
                 String schemaLocation = schema.properties().get(HiveConstants.LOCATION);
-                if (schemaLocation != null && schemaLocation.isEmpty()) {
+                if (StringUtils.isNotBlank(schemaLocation)) {
                   locations.add(schemaLocation);
                 } else {
                   LOG.warn("Schema %s location is not found", ident);
@@ -497,7 +498,7 @@ public class AuthorizationUtils {
               Table table = GravitinoEnv.getInstance().tableDispatcher().loadTable(ident);
               if (table.properties().containsKey(HiveConstants.LOCATION)) {
                 String tableLocation = table.properties().get(HiveConstants.LOCATION);
-                if (tableLocation != null && tableLocation.isEmpty()) {
+                if (StringUtils.isNotBlank(tableLocation)) {
                   locations.add(tableLocation);
                 } else {
                   LOG.warn("Table %s location is not found", ident);