Skip to content

Commit

Permalink
Merge branch 'main' into CLI_III
Browse files Browse the repository at this point in the history
# Conflicts:
#	clients/cli/src/main/java/org/apache/gravitino/cli/ErrorMessages.java
#	clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java
#	clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoOptions.java
#	clients/cli/src/main/java/org/apache/gravitino/cli/Properties.java
#	clients/cli/src/test/java/org/apache/gravitino/cli/PropertiesTest.java
#	docs/cli.md
  • Loading branch information
justinmclean committed Nov 6, 2024
2 parents 6255901 + fabdbc9 commit 2b22e09
Show file tree
Hide file tree
Showing 40 changed files with 4,373 additions and 1,014 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ enum Name {
USE_SCHEMA(0L, 1L << 4),
/** The privilege to create a table. */
CREATE_TABLE(0L, 1L << 5),
/** The privilege to execute SQL `ALTER`, `INSERT`, `UPDATE`, or `DELETE` for a table. */
/** The privilege to write data to a table or modify the table schema. */
MODIFY_TABLE(0L, 1L << 6),
/** The privilege to select data from a table. */
SELECT_TABLE(0L, 1L << 7),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ public boolean canBindTo(MetadataObject.Type type) {
}
}

/** The privilege to execute SQL `ALTER`, `INSERT`, `UPDATE`, or `DELETE` for a table. */
/** The privilege to write data to a table or modify the table schema. */
public static class ModifyTable extends GenericPrivilege<ModifyTable> {
private static final ModifyTable ALLOW_INSTANCE =
new ModifyTable(Condition.ALLOW, Name.MODIFY_TABLE);
Expand Down
5 changes: 4 additions & 1 deletion authorizations/authorization-ranger/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ plugins {
val scalaVersion: String = project.properties["scalaVersion"] as? String ?: extra["defaultScalaVersion"].toString()
val sparkVersion: String = libs.versions.spark35.get()
val kyuubiVersion: String = libs.versions.kyuubi4spark35.get()
val sparkMajorVersion: String = sparkVersion.substringBeforeLast(".")
val icebergVersion: String = libs.versions.iceberg4spark.get()

dependencies {
implementation(project(":api")) {
Expand Down Expand Up @@ -97,6 +99,7 @@ dependencies {
exclude("javax.servlet", "servlet-api")
exclude("io.netty")
}
testImplementation("org.apache.iceberg:iceberg-spark-runtime-${sparkMajorVersion}_$scalaVersion:$icebergVersion")
}

tasks {
Expand Down Expand Up @@ -126,7 +129,7 @@ tasks {

tasks.test {
doFirst {
environment("HADOOP_USER_NAME", "test")
environment("HADOOP_USER_NAME", "gravitino")
}
dependsOn(":catalogs:catalog-hive:jar", ":catalogs:catalog-hive:runtimeJars")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public String shortName() {
protected AuthorizationPlugin newPlugin(String catalogProvider, Map<String, String> config) {
switch (catalogProvider) {
case "hive":
return RangerAuthorizationHivePlugin.getInstance(config);
case "lakehouse-iceberg":
return RangerAuthorizationHadoopSQLPlugin.getInstance(config);
default:
throw new IllegalArgumentException("Unknown catalog provider: " + catalogProvider);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,21 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class RangerAuthorizationHivePlugin extends RangerAuthorizationPlugin {
private static final Logger LOG = LoggerFactory.getLogger(RangerAuthorizationHivePlugin.class);
private static volatile RangerAuthorizationHivePlugin instance = null;
public class RangerAuthorizationHadoopSQLPlugin extends RangerAuthorizationPlugin {
private static final Logger LOG =
LoggerFactory.getLogger(RangerAuthorizationHadoopSQLPlugin.class);
private static volatile RangerAuthorizationHadoopSQLPlugin instance = null;

private RangerAuthorizationHivePlugin(Map<String, String> config) {
private RangerAuthorizationHadoopSQLPlugin(Map<String, String> config) {
super(config);
}

public static synchronized RangerAuthorizationHivePlugin getInstance(Map<String, String> config) {
public static synchronized RangerAuthorizationHadoopSQLPlugin getInstance(
Map<String, String> config) {
if (instance == null) {
synchronized (RangerAuthorizationHivePlugin.class) {
synchronized (RangerAuthorizationHadoopSQLPlugin.class) {
if (instance == null) {
instance = new RangerAuthorizationHivePlugin(config);
instance = new RangerAuthorizationHadoopSQLPlugin(config);
}
}
}
Expand Down
Loading

0 comments on commit 2b22e09

Please sign in to comment.