Skip to content

Commit

Permalink
Merge branch 'main' into CLI_II
Browse files Browse the repository at this point in the history
  • Loading branch information
justinmclean authored Nov 6, 2024
2 parents e133aff + d20b535 commit 81bf84b
Show file tree
Hide file tree
Showing 587 changed files with 26,513 additions and 2,139 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/access-control-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ jobs:
- name: Authorization Integration Test (JDK${{ matrix.java-version }})
id: integrationTest
run: |
./gradlew -PtestMode=embedded -PjdbcBackend=h2 -PjdkVersion=${{ matrix.java-version }} -PskipDockerTests=false :authorizations:authorization-ranger:test --tests "org.apache.gravitino.authorization.ranger.**"
./gradlew -PtestMode=deploy -PjdbcBackend=mysql -PjdkVersion=${{ matrix.java-version }} -PskipDockerTests=false :authorizations:authorization-ranger:test --tests "org.apache.gravitino.authorization.ranger.**"
./gradlew -PtestMode=deploy -PjdbcBackend=postgresql -PjdkVersion=${{ matrix.java-version }} -PskipDockerTests=false :authorizations:authorization-ranger:test --tests "org.apache.gravitino.authorization.ranger.**"
./gradlew -PtestMode=embedded -PjdbcBackend=h2 -PjdkVersion=${{ matrix.java-version }} -PskipDockerTests=false :authorizations:authorization-ranger:test
./gradlew -PtestMode=deploy -PjdbcBackend=mysql -PjdkVersion=${{ matrix.java-version }} -PskipDockerTests=false :authorizations:authorization-ranger:test
./gradlew -PtestMode=deploy -PjdbcBackend=postgresql -PjdkVersion=${{ matrix.java-version }} -PskipDockerTests=false :authorizations:authorization-ranger:test
- name: Upload integrate tests reports
uses: actions/upload-artifact@v3
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
- core/**
- dev/**
- docs/open-api/**
- bundles/**
- docs/build.gradle.kts
- flink-connector/**
- gradle/**
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/trino-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
needs: changes
if: needs.changes.outputs.source_changes == 'true'
runs-on: ubuntu-latest
timeout-minutes: 30
timeout-minutes: 60
strategy:
matrix:
architecture: [linux/amd64]
Expand All @@ -76,7 +76,7 @@ jobs:
- name: Package Gravitino
run: |
./gradlew compileDistribution -x test -PjdkVersion=${{ matrix.java-version }}
./gradlew compileDistribution compileTrinoConnector -x test -PjdkVersion=${{ matrix.java-version }}
- name: Free up disk space
run: |
Expand All @@ -87,6 +87,7 @@ jobs:
run: |
./gradlew -PskipTests -PtestMode=embedded -PjdkVersion=${{ matrix.java-version }} -PskipDockerTests=false :trino-connector:integration-test:test
./gradlew -PskipTests -PtestMode=deploy -PjdkVersion=${{ matrix.java-version }} -PskipDockerTests=false :trino-connector:integration-test:test
trino-connector/integration-test/trino-test-tools/run_test.sh
- name: Upload integrate tests reports
uses: actions/upload-artifact@v3
Expand All @@ -95,10 +96,11 @@ jobs:
name: trino-connector-integrate-test-reports-${{ matrix.java-version }}
path: |
build/reports
trino-connector/integrate-test/build/*.log
trino-connector/integrate-test/build/*.tar
trino-connector/integration-test/build/*.log
trino-connector/integration-test/build/*.tar
trino-connector/integration-test/build/trino-cascading-env
integration-test-common/build/trino-ci-container-log
distribution/package/logs/gravitino-server.out
distribution/package/logs/gravitino-server.log
catalogs/**/*.log
catalogs/**/*.tar
catalogs/**/*.tar
4 changes: 4 additions & 0 deletions LICENSE.bin
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,13 @@
Apache Iceberg core
Apache Iceberg Hive metastore
Apache Iceberg GCP
Apache Iceberg GCP bundle
Apache Ivy
Apache Log4j 1.x Compatibility API
Apache Log4j API
Apache Log4j Core
Apache Log4j SLF4J 2.0 Binding
Apache Log4j Layout For Templated JSON Encoding
Apache ORC
Apache Parquet Hadoop Bundle
Apache Thrift
Expand Down Expand Up @@ -398,6 +400,8 @@
RE2/J
ZSTD JNI
fsspec
Google auth HTTP
Google auth Credentials

This product bundles various third-party components also under the
MIT license
Expand Down
6 changes: 3 additions & 3 deletions api/src/main/java/org/apache/gravitino/MetadataObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ enum Type {
String parent();

/**
* The name of th object.
* The name of the object.
*
* @return The name of the object.
*/
String name();

/**
* The full name of th object. Full name will be separated by "." to represent a string identifier
* of the object, like catalog, catalog.table, etc.
* The full name of the object. Full name will be separated by "." to represent a string
* identifier of the object, like catalog, catalog.table, etc.
*
* @return The name of the object.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.gravitino.authorization;

import com.google.common.base.Preconditions;
import java.util.Objects;
import org.apache.gravitino.MetadataObject;
import org.apache.gravitino.annotation.Evolving;

/**
* The MetadataObjectChange interface defines the public API for managing roles in an authorization.
*/
@Evolving
public interface MetadataObjectChange {
/**
* Rename a metadata entity MetadataObjectChange.
*
* @param metadataObject The metadata object.
* @param newMetadataObject The new metadata object.
* @return return a MetadataObjectChange for the rename metadata object.
*/
static MetadataObjectChange rename(
MetadataObject metadataObject, MetadataObject newMetadataObject) {
return new RenameMetadataObject(metadataObject, newMetadataObject);
}

/**
* Remove a metadata entity MetadataObjectChange.
*
* @param metadataObject The metadata object.
* @return return a MetadataObjectChange for the remove metadata object.
*/
static MetadataObjectChange remove(MetadataObject metadataObject) {
return new RemoveMetadataObject(metadataObject);
}

/** A RenameMetadataObject is to rename securable object's metadata entity. */
final class RenameMetadataObject implements MetadataObjectChange {
private final MetadataObject metadataObject;
private final MetadataObject newMetadataObject;

private RenameMetadataObject(MetadataObject metadataObject, MetadataObject newMetadataObject) {
Preconditions.checkArgument(
!metadataObject.fullName().equals(newMetadataObject.fullName()),
"The metadata object must be different!");
Preconditions.checkArgument(
metadataObject.type().equals(newMetadataObject.type()),
"The metadata object type must be same!");

this.metadataObject = metadataObject;
this.newMetadataObject = newMetadataObject;
}

/**
* Returns the metadataObject to be renamed.
*
* @return return a metadataObject.
*/
public MetadataObject metadataObject() {
return metadataObject;
}

/**
* Returns the new metadataObject object.
*
* @return return a metadataObject object.
*/
public MetadataObject newMetadataObject() {
return newMetadataObject;
}

/**
* Compares this RenameMetadataObject instance with another object for equality. The comparison
* is based on the old metadata entity and new metadata entity.
*
* @param o The object to compare with this instance.
* @return true if the given object represents the same rename metadata entity; false otherwise.
*/
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
RenameMetadataObject that = (RenameMetadataObject) o;
return metadataObject.equals(that.metadataObject)
&& newMetadataObject.equals(that.newMetadataObject);
}

/**
* Generates a hash code for this RenameMetadataObject instance. The hash code is based on the
* old metadata entity and new metadata entity.
*
* @return A hash code value for this update metadata entity operation.
*/
@Override
public int hashCode() {
return Objects.hash(metadataObject, newMetadataObject);
}

/**
* Returns a string representation of the RenameMetadataObject instance. This string format
* includes the class name followed by the update metadata entity object operation.
*
* @return A string representation of the RenameMetadataObject instance.
*/
@Override
public String toString() {
return "RENAMEMETADATAOBJECT " + metadataObject + " " + newMetadataObject;
}
}

/** A RemoveMetadataObject is to remove securable object's metadata entity. */
final class RemoveMetadataObject implements MetadataObjectChange {
private final MetadataObject metadataObject;

private RemoveMetadataObject(MetadataObject metadataObject) {
this.metadataObject = metadataObject;
}

/**
* Returns the metadataObject to be renamed.
*
* @return return a metadataObject.
*/
public MetadataObject metadataObject() {
return metadataObject;
}

/**
* Compares this RemoveMetadataObject instance with another object for equality. The comparison
* is based on the old metadata entity.
*
* @param o The object to compare with this instance.
* @return true if the given object represents the same rename metadata entity; false otherwise.
*/
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
RenameMetadataObject that = (RenameMetadataObject) o;
return metadataObject.equals(that.metadataObject);
}

/**
* Generates a hash code for this RemoveMetadataObject instance. The hash code is based on the
* old metadata entity.
*
* @return A hash code value for this update metadata entity operation.
*/
@Override
public int hashCode() {
return Objects.hash(metadataObject);
}

/**
* Returns a string representation of the RemoveMetadataObject instance. This string format
* includes the class name followed by the remove metadata entity object operation.
*
* @return A string representation of the RemoveMetadataObject instance.
*/
@Override
public String toString() {
return "REMOVEMETADATAOBJECT " + metadataObject;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.gravitino.credential;

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;

/** The GCS token credential to access GCS. */
public class GCSTokenCredential implements Credential {

/** GCS credential type. */
public static final String GCS_TOKEN_CREDENTIAL_TYPE = "gcs-token";

/** GCS credential property, token name. */
public static final String GCS_TOKEN_NAME = "token";

private final String token;
private final long expireMs;

/**
* @param token The GCS token.
* @param expireMs The GCS token expire time at ms.
*/
public GCSTokenCredential(String token, long expireMs) {
Preconditions.checkArgument(
StringUtils.isNotBlank(token), "GCS session token should not be null");
this.token = token;
this.expireMs = expireMs;
}

@Override
public String credentialType() {
return GCS_TOKEN_CREDENTIAL_TYPE;
}

@Override
public long expireTimeInMs() {
return expireMs;
}

@Override
public Map<String, String> credentialInfo() {
return (new ImmutableMap.Builder<String, String>()).put(GCS_TOKEN_NAME, token).build();
}

/**
* Get GCS token.
*
* @return The GCS token.
*/
public String token() {
return token;
}
}
Loading

0 comments on commit 81bf84b

Please sign in to comment.