Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#5220] improvment(hadoop-catalog): Optimize the name properties keys for Hadoop catalog. #5244

Merged
merged 174 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 165 commits
Commits
Show all changes
174 commits
Select commit Hold shift + click to select a range
ce3b19f
Fix minor in docker image.
yuqi1129 Aug 26, 2024
cd69c33
Merge branch 'apache:main' into main
yuqi1129 Sep 3, 2024
d2447a2
Add a framework to support multi-storage in a pluginized manner for …
yuqi1129 Sep 25, 2024
7e5a8b5
Fix compile distribution error.
yuqi1129 Sep 25, 2024
f53c5ef
fix
yuqi1129 Sep 25, 2024
36fedcd
fix
yuqi1129 Sep 25, 2024
e93fba5
fix
yuqi1129 Sep 25, 2024
b1e04b6
fix
yuqi1129 Sep 26, 2024
db00e65
Changed according to comments.
yuqi1129 Sep 29, 2024
c793582
fix
yuqi1129 Sep 29, 2024
013f5cb
fix
yuqi1129 Sep 30, 2024
dba5753
Merge branch 'main' of github.com:datastrato/graviton into issue_5019
yuqi1129 Oct 8, 2024
16dfc73
resolve comments.
yuqi1129 Oct 8, 2024
278fcd8
Polish code.
yuqi1129 Oct 9, 2024
3fb55ad
fix
yuqi1129 Oct 9, 2024
cd04666
fix
yuqi1129 Oct 9, 2024
d0bf13e
Support GCS fileset.
yuqi1129 Oct 9, 2024
ffaa064
Change gvfs accordingly.
yuqi1129 Oct 11, 2024
32d7f3d
Merge remote-tracking branch 'me/issue_5019' into issue_5019
yuqi1129 Oct 11, 2024
81a36ba
Merge branch 'apache:main' into main
yuqi1129 Oct 11, 2024
d82bf76
Update Java doc for FileSystemProvider
yuqi1129 Oct 11, 2024
dfdb772
Fix
yuqi1129 Oct 11, 2024
8708a8a
Fix
yuqi1129 Oct 11, 2024
ba9f8fa
Fix test error.
yuqi1129 Oct 11, 2024
dae99f7
Polish.
yuqi1129 Oct 11, 2024
e22053b
Polish
yuqi1129 Oct 12, 2024
4fb89e0
Polish
yuqi1129 Oct 12, 2024
e5746c0
Rename `AbstractIT` to `BaseIT`
yuqi1129 Oct 12, 2024
b2d7bed
Fix
yuqi1129 Oct 14, 2024
380717b
Merge branch 'apache:main' into issue_5019
yuqi1129 Oct 14, 2024
f4041ec
Fix python ut error again.
yuqi1129 Oct 14, 2024
66247ab
Merge branch 'issue_5019' of github.com:yuqi1129/gravitino into issue…
yuqi1129 Oct 14, 2024
3cfb94f
Fix test error again.
yuqi1129 Oct 14, 2024
7d1150f
Fix minor.
yuqi1129 Oct 14, 2024
608081b
fix
yuqi1129 Oct 14, 2024
9edfe82
Fix
yuqi1129 Oct 14, 2024
3079bf0
Fix
yuqi1129 Oct 14, 2024
da49e60
Fix
yuqi1129 Oct 14, 2024
b621d89
Fix
yuqi1129 Oct 14, 2024
05dd006
Merge branch 'issue_5019' into issue_5074
yuqi1129 Oct 15, 2024
9d5b8dc
rebase issue_5019
yuqi1129 Oct 15, 2024
e58f9a0
Fix
yuqi1129 Oct 15, 2024
c521daf
resolve comments
yuqi1129 Oct 15, 2024
46e996a
Resolve comments again.
yuqi1129 Oct 15, 2024
da0b7ca
Polish again.
yuqi1129 Oct 15, 2024
e9ccda4
Merge branch 'issue_5019' of github.com:yuqi1129/gravitino into issue…
yuqi1129 Oct 15, 2024
ba1fe5f
Rebase branch issue_5019
yuqi1129 Oct 15, 2024
4ffe389
Merge branch 'main' of github.com:datastrato/graviton into issue_5139
yuqi1129 Oct 15, 2024
7c44a57
Support python gvfs
yuqi1129 Oct 15, 2024
992ba0a
fix
yuqi1129 Oct 15, 2024
5dbca5f
fix
yuqi1129 Oct 15, 2024
f27520a
Update code.
yuqi1129 Oct 15, 2024
e29e47b
Merge branch 'issue_5019' into issue_5074
yuqi1129 Oct 15, 2024
bc1e76f
Rebase branch issue_5019
yuqi1129 Oct 15, 2024
8a9d3bf
Merge branch 'issue_5074' of github.com:yuqi1129/gravitino into issue…
yuqi1129 Oct 15, 2024
2115e31
fix
yuqi1129 Oct 15, 2024
c2e55d4
fix
yuqi1129 Oct 15, 2024
557aa02
fix
yuqi1129 Oct 15, 2024
5c3fa5c
fix
yuqi1129 Oct 15, 2024
408eca7
fix
yuqi1129 Oct 15, 2024
a02065d
fix
yuqi1129 Oct 15, 2024
8762bae
fix
yuqi1129 Oct 15, 2024
dc7a915
fix
yuqi1129 Oct 15, 2024
c230991
fix
yuqi1129 Oct 15, 2024
dc54880
skip some test.
yuqi1129 Oct 15, 2024
7ecc040
fix
yuqi1129 Oct 15, 2024
da46321
fix
yuqi1129 Oct 15, 2024
27bc2ab
Fix
yuqi1129 Oct 16, 2024
017c42e
Merge branch 'issue_5019' into issue_5074
yuqi1129 Oct 16, 2024
9dc0f5a
Fix
yuqi1129 Oct 16, 2024
41ff00d
Merge branch 'issue_5019' of github.com:yuqi1129/gravitino into issue…
yuqi1129 Oct 16, 2024
1fee1e4
Fix
yuqi1129 Oct 16, 2024
1789bd2
fix
yuqi1129 Oct 16, 2024
2ee1709
Fix
yuqi1129 Oct 16, 2024
05e5d20
Fix
yuqi1129 Oct 16, 2024
8f28211
Fix
yuqi1129 Oct 16, 2024
35cba1e
Fix
yuqi1129 Oct 16, 2024
bcf2f12
Fix
yuqi1129 Oct 16, 2024
f25a37d
Fix a problem
yuqi1129 Oct 16, 2024
a3da011
Merge branch 'issue_5019' into issue_5074
yuqi1129 Oct 16, 2024
3517996
Merge branch 'main' of github.com:apache/gravitino into issue_5074
yuqi1129 Oct 16, 2024
27a911a
fix
yuqi1129 Oct 16, 2024
e34dbea
Merge branch 'main' of github.com:apache/gravitino into issue_5074
yuqi1129 Oct 16, 2024
6bae7e5
Fix a problem
yuqi1129 Oct 16, 2024
fe13f5e
Fix a problem
yuqi1129 Oct 16, 2024
0181632
Fix a problem
yuqi1129 Oct 16, 2024
3ff9eef
Fix
yuqi1129 Oct 16, 2024
2ce660c
Fix
yuqi1129 Oct 16, 2024
f0fa87b
Fix
yuqi1129 Oct 16, 2024
d2921a8
Fix
yuqi1129 Oct 16, 2024
dc68dd1
Fix
yuqi1129 Oct 16, 2024
6431e2f
Fix
yuqi1129 Oct 16, 2024
242888f
Fix
yuqi1129 Oct 16, 2024
3ec2dcc
Merge branch 'issue_5074' of github.com:yuqi1129/gravitino into issue…
yuqi1129 Oct 16, 2024
f754997
Fix
yuqi1129 Oct 16, 2024
2cdfb35
Fix
yuqi1129 Oct 16, 2024
67dbc3a
Resolve comments.
yuqi1129 Oct 17, 2024
70a545e
Fix the java doc problem.
yuqi1129 Oct 17, 2024
4d54acf
Merge branch 'issue_5074' into issue_5139
yuqi1129 Oct 17, 2024
15bbf99
rebase issue_5074
yuqi1129 Oct 17, 2024
cfcc544
Optimize code.
yuqi1129 Oct 17, 2024
acf51e1
Merge branch 'issue_5074' of github.com:yuqi1129/gravitino into issue…
yuqi1129 Oct 17, 2024
11f9992
Merge branch 'main' of github.com:datastrato/graviton into issue_5139
yuqi1129 Oct 17, 2024
4f00a2f
Remove s3 related code.
yuqi1129 Oct 17, 2024
b9ef8f0
fix
yuqi1129 Oct 17, 2024
9f65fb5
try to import lazily.
yuqi1129 Oct 18, 2024
4defcc6
format code.
yuqi1129 Oct 18, 2024
3a907f4
fix
yuqi1129 Oct 18, 2024
76912b7
fix
yuqi1129 Oct 18, 2024
4478673
fix
yuqi1129 Oct 18, 2024
5a194df
Merge branch 'main' of github.com:datastrato/graviton into issue_5139
yuqi1129 Oct 18, 2024
c8b5c7c
Merge branch 'main' of github.com:datastrato/graviton into issue_5139
yuqi1129 Oct 21, 2024
6ff9353
Resolve comments
yuqi1129 Oct 21, 2024
1dac0f0
Merge branch 'main' of github.com:datastrato/graviton into issue_5188
yuqi1129 Oct 21, 2024
f592289
Support python client for S3.
yuqi1129 Oct 21, 2024
7069b6b
fix
yuqi1129 Oct 21, 2024
1281e72
fix
yuqi1129 Oct 21, 2024
f022d6e
fix
yuqi1129 Oct 21, 2024
0d2ccab
fix
yuqi1129 Oct 22, 2024
55633e8
Merge branch 'main' of github.com:datastrato/graviton into issue_5188
yuqi1129 Oct 22, 2024
217cc5f
fix
yuqi1129 Oct 22, 2024
6958aa8
fix
yuqi1129 Oct 22, 2024
b6837bb
fix
yuqi1129 Oct 22, 2024
92961ea
fix
yuqi1129 Oct 22, 2024
8ed6298
fix
yuqi1129 Oct 22, 2024
e256c8d
fix
yuqi1129 Oct 22, 2024
73e00f0
fix
yuqi1129 Oct 23, 2024
d56cf30
fix
yuqi1129 Oct 23, 2024
8b9b8d7
Replace pyarrow gvfs with gcsfs.
yuqi1129 Oct 23, 2024
b4d5728
fix
yuqi1129 Oct 23, 2024
0306ac5
fix
yuqi1129 Oct 23, 2024
a35a40d
fix
yuqi1129 Oct 23, 2024
cfd8a89
fix
yuqi1129 Oct 23, 2024
a131564
fix
yuqi1129 Oct 23, 2024
34e3ff4
Replace ArrowFSWrapper with s3fs.S3FileSystem.
yuqi1129 Oct 23, 2024
2cc234a
fix
yuqi1129 Oct 23, 2024
ba0237e
fix
yuqi1129 Oct 23, 2024
4df5ea1
fix
yuqi1129 Oct 23, 2024
4e49e6e
fix
yuqi1129 Oct 23, 2024
354418f
Merge branch 'issue_5188' into issue_5211
yuqi1129 Oct 23, 2024
d22c2f6
fix
yuqi1129 Oct 23, 2024
fc3c40a
fix
yuqi1129 Oct 23, 2024
015b788
fix comments.
yuqi1129 Oct 23, 2024
c414b4d
fix test error.
yuqi1129 Oct 23, 2024
895937c
Merge branch 'issue_5188' into issue_5211
yuqi1129 Oct 23, 2024
d261b70
fix test error.
yuqi1129 Oct 23, 2024
798b4d1
fix
yuqi1129 Oct 23, 2024
aa96f63
fix
yuqi1129 Oct 23, 2024
456ba31
Merge branch 'issue_5188' into issue_5211
yuqi1129 Oct 23, 2024
8d04cd4
fix
yuqi1129 Oct 23, 2024
804622c
fix
yuqi1129 Oct 23, 2024
b399365
fix
yuqi1129 Oct 24, 2024
120adc3
Merge branch 'issue_5188' into issue_5211
yuqi1129 Oct 24, 2024
72e8822
rebase main.
yuqi1129 Oct 24, 2024
e7b4da7
minor polish
yuqi1129 Oct 24, 2024
20360b0
Merge branch 'main' of github.com:datastrato/graviton into issue_5220
yuqi1129 Oct 24, 2024
87dbb60
Improvement: Optimize the key names of Hadoop catalog properties.
yuqi1129 Oct 24, 2024
d5ac7d4
Merge branch 'main' of github.com:datastrato/graviton into issue_5220
yuqi1129 Oct 24, 2024
a187080
Fix format.
yuqi1129 Oct 24, 2024
ca57d3f
Merge branch 'main' of github.com:datastrato/graviton into issue_5220
yuqi1129 Oct 25, 2024
10b6267
fix
yuqi1129 Oct 25, 2024
03bc296
change python keys to make it align with java
yuqi1129 Oct 25, 2024
32d6553
Update.
yuqi1129 Oct 29, 2024
11c9f41
Merge branch 'main' of github.com:yuqi1129/gravitino into issue_5220
yuqi1129 Oct 29, 2024
6192586
Merge branch 'main' of github.com:apache/gravitino into issue_5220
yuqi1129 Oct 29, 2024
67ac175
Merge branch 'main' of github.com:apache/gravitino into issue_5220
yuqi1129 Oct 29, 2024
268831d
fix
yuqi1129 Oct 29, 2024
27393e5
Optimize.
yuqi1129 Oct 29, 2024
b0d45f1
Optimize method `toHadoopConfigMap` and other fix.
yuqi1129 Oct 29, 2024
11a3146
Add UT for `FileSystemUtils.toHadoopConfigMap`
yuqi1129 Oct 29, 2024
218acae
Add UT for `FileSystemUtils.toHadoopConfigMap`
yuqi1129 Oct 29, 2024
8ff278f
Add VisibleForTesting annotation for public fields in xxxxFileSystemP…
yuqi1129 Oct 29, 2024
4f90525
Fix java docs problem.
yuqi1129 Oct 29, 2024
bf65415
Fix
yuqi1129 Oct 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bundles/aliyun-bundle/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dependencies {
// org.apache.hadoop.fs.aliyun.oss.AliyunOSSFileSystem.initialize(AliyunOSSFileSystem.java:323)
// org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:3611)
implementation(libs.commons.lang)
implementation(project(":catalogs:catalog-common"))
}

tasks.withType(ShadowJar::class.java) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,41 @@
*/
package org.apache.gravitino.oss.fs;

import com.google.common.collect.ImmutableMap;
import java.io.IOException;
import java.util.Map;
import org.apache.gravitino.catalog.hadoop.fs.FileSystemProvider;
import org.apache.gravitino.storage.OSSProperties;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.aliyun.oss.AliyunOSSFileSystem;
import org.apache.hadoop.fs.aliyun.oss.Constants;

public class OSSFileSystemProvider implements FileSystemProvider {

private static final String OSS_FILESYSTEM_IMPL = "fs.oss.impl";

public static final Map<String, String> GRAVITINO_KEY_TO_OSS_HADOOP_KEY =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we want to make this public?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, why do we turn it back to public?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value will be used in GravitinoVirtualFileSystemOSSIT test and others are similar.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because you don't put IT and code together, so you have to make it public, can you please add a visible for test tag on it?

ImmutableMap.of(
OSSProperties.GRAVITINO_OSS_ENDPOINT, Constants.ENDPOINT_KEY,
OSSProperties.GRAVITINO_OSS_ACCESS_KEY_ID, Constants.ACCESS_KEY_ID,
OSSProperties.GRAVITINO_OSS_ACCESS_KEY_SECRET, Constants.ACCESS_KEY_SECRET);

@Override
public FileSystem getFileSystem(Path path, Map<String, String> config) throws IOException {
Configuration configuration = new Configuration();
config.forEach(
(k, v) -> {
configuration.set(k.replace("gravitino.bypass.", ""), v);
if (k.startsWith(GRAVITINO_BYPASS)) {
configuration.set(k.replace(GRAVITINO_BYPASS, ""), v);
} else configuration.set(GRAVITINO_KEY_TO_OSS_HADOOP_KEY.getOrDefault(k, k), v);
yuqi1129 marked this conversation as resolved.
Show resolved Hide resolved
});

// OSS do not use service loader to load the file system, so we need to set the impl class
if (!config.containsKey(OSS_FILESYSTEM_IMPL)) {
configuration.set(OSS_FILESYSTEM_IMPL, AliyunOSSFileSystem.class.getCanonicalName());
}
return AliyunOSSFileSystem.newInstance(path.toUri(), configuration);
}

Expand Down
1 change: 1 addition & 0 deletions bundles/aws-bundle/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ dependencies {
compileOnly(project(":catalogs:catalog-hadoop"))
compileOnly(libs.hadoop3.common)
implementation(libs.hadoop3.aws)
implementation(project(":catalogs:catalog-common"))
}

tasks.withType(ShadowJar::class.java) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,37 @@

package org.apache.gravitino.s3.fs;

import com.google.common.collect.ImmutableMap;
import java.io.IOException;
import java.util.Map;
import org.apache.gravitino.catalog.hadoop.fs.FileSystemProvider;
import org.apache.gravitino.storage.S3Properties;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.s3a.Constants;
import org.apache.hadoop.fs.s3a.S3AFileSystem;

public class S3FileSystemProvider implements FileSystemProvider {

public static final Map<String, String> GRAVITINO_KEY_TO_S3_HADOOP_KEY =
ImmutableMap.of(
S3Properties.GRAVITINO_S3_ENDPOINT, Constants.ENDPOINT,
S3Properties.GRAVITINO_S3_ACCESS_KEY_ID, Constants.ACCESS_KEY,
S3Properties.GRAVITINO_S3_SECRET_ACCESS_KEY, Constants.SECRET_KEY);

@Override
public FileSystem getFileSystem(Path path, Map<String, String> config) throws IOException {
Configuration configuration = new Configuration();
config.forEach(
(k, v) -> {
configuration.set(k.replace("gravitino.bypass.", ""), v);
if (k.startsWith(GRAVITINO_BYPASS)) {
configuration.set(k.replace(GRAVITINO_BYPASS, ""), v);
} else configuration.set(GRAVITINO_KEY_TO_S3_HADOOP_KEY.getOrDefault(k, k), v);
});

configuration.set(
Constants.AWS_CREDENTIALS_PROVIDER, Constants.ASSUMED_ROLE_CREDENTIALS_DEFAULT);
return S3AFileSystem.newInstance(path.toUri(), configuration);
}

Expand Down
1 change: 1 addition & 0 deletions bundles/gcp-bundle/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dependencies {

implementation(libs.commons.lang3)
implementation(libs.hadoop3.gcs)
implementation(project(":catalogs:catalog-common"))
yuqi1129 marked this conversation as resolved.
Show resolved Hide resolved
implementation(libs.google.auth.http)
implementation(libs.google.auth.credentials)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
package org.apache.gravitino.gcs.fs;

import com.google.cloud.hadoop.fs.gcs.GoogleHadoopFileSystem;
import com.google.common.collect.ImmutableMap;
import java.io.IOException;
import java.util.Map;
import org.apache.gravitino.catalog.hadoop.fs.FileSystemProvider;
import org.apache.gravitino.storage.GCSProperties;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
Expand All @@ -31,12 +33,18 @@
public class GCSFileSystemProvider implements FileSystemProvider {
private static final Logger LOGGER = LoggerFactory.getLogger(GCSFileSystemProvider.class);

public static final Map<String, String> GRAVITINO_KEY_TO_GCS_HADOOP_KEY =
ImmutableMap.of(
GCSProperties.GCS_SERVICE_ACCOUNT_JSON_PATH, "fs.gs.auth.service.account.json.keyfile");
yuqi1129 marked this conversation as resolved.
Show resolved Hide resolved

@Override
public FileSystem getFileSystem(Path path, Map<String, String> config) throws IOException {
Configuration configuration = new Configuration();
config.forEach(
(k, v) -> {
configuration.set(k.replace("gravitino.bypass.", ""), v);
if (k.startsWith(GRAVITINO_BYPASS)) {
configuration.set(k.replace(GRAVITINO_BYPASS, ""), v);
} else configuration.set(GRAVITINO_KEY_TO_GCS_HADOOP_KEY.getOrDefault(k, k), v);
});

LOGGER.info("Creating GCS file system with config: {}", config);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* 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.storage;

public class GCSProperties {

// The path of service account JSON file of Google Cloud Storage.
public static final String GCS_SERVICE_ACCOUNT_JSON_PATH = "gcs-service-account-file";

private GCSProperties() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class OSSProperties {
// The static access key ID used to access OSS data.
public static final String GRAVITINO_OSS_ACCESS_KEY_ID = "oss-access-key-id";
// The static access key secret used to access OSS data.
public static final String GRAVITINO_OSS_ACCESS_KEY_SECRET = "oss-access-key-secret";
public static final String GRAVITINO_OSS_ACCESS_KEY_SECRET = "oss-secret-access-key";

private OSSProperties() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,8 @@ public class S3Properties {
// The region of the S3 service.
public static final String GRAVITINO_S3_REGION = "s3-region";

// The S3 credentials provider class name.
public static final String GRAVITINO_S3_CREDS_PROVIDER = "s3-creds-provider";

private S3Properties() {}
}
yuqi1129 marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 4 additions & 0 deletions catalogs/catalog-hadoop/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ dependencies {
exclude(group = "*")
}

implementation(project(":catalogs:catalog-common")) {
exclude(group = "*")
}

compileOnly(libs.guava)

implementation(libs.hadoop3.common) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
*/
public interface FileSystemProvider {

String GRAVITINO_BYPASS = "gravitino.bypass.";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add some comments to this variable, to let users know how to leverage this variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added


/**
* Get the FileSystem instance according to the configuration map and file path.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.Map;
import org.apache.gravitino.Catalog;
import org.apache.gravitino.integration.test.util.GravitinoITUtils;
import org.apache.gravitino.storage.GCSProperties;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
Expand Down Expand Up @@ -95,10 +96,8 @@ protected String defaultBaseLocation() {

protected void createCatalog() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move these ITs to each bundle?

Copy link
Contributor Author

@yuqi1129 yuqi1129 Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I can try it but I will not do it in this PR, It will make this PR large and hard to test the changes introduced by this PR, so I created #5325 to follow it.

Map<String, String> map = Maps.newHashMap();
map.put("gravitino.bypass.fs.gs.auth.service.account.enable", "true");
map.put("gravitino.bypass.fs.gs.auth.service.account.json.keyfile", SERVICE_ACCOUNT_FILE);
map.put(GCSProperties.GCS_SERVICE_ACCOUNT_JSON_PATH, SERVICE_ACCOUNT_FILE);
map.put(FILESYSTEM_PROVIDERS, "gcs");

metalake.createCatalog(catalogName, Catalog.Type.FILESET, provider, "comment", map);

catalog = metalake.loadCatalog(catalogName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Map;
import org.apache.gravitino.Catalog;
import org.apache.gravitino.integration.test.util.GravitinoITUtils;
import org.apache.gravitino.storage.OSSProperties;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
Expand All @@ -38,7 +39,8 @@

@Disabled(
"Disabled due to we don't have a real OSS account to test. If you have a GCP account,"
+ "please change the configuration(BUCKET_NAME, OSS_ACCESS_KEY, OSS_SECRET_KEY, OSS_ENDPOINT) and enable this test.")
+ "please change the configuration(BUCKET_NAME, OSS_ACCESS_KEY, OSS_SECRET_KEY, "
+ "OSS_ENDPOINT) and enable this test.")
public class HadoopOSSCatalogIT extends HadoopCatalogIT {
private static final Logger LOG = LoggerFactory.getLogger(HadoopOSSCatalogIT.class);
public static final String BUCKET_NAME = "YOUR_BUCKET";
Expand Down Expand Up @@ -81,8 +83,8 @@ public void setup() throws IOException {
public void stop() throws IOException {
Catalog catalog = metalake.loadCatalog(catalogName);
catalog.asSchemas().dropSchema(schemaName, true);
metalake.dropCatalog(catalogName);
client.dropMetalake(metalakeName);
metalake.dropCatalog(catalogName, true);
client.dropMetalake(metalakeName, true);

try {
closer.close();
Expand Down Expand Up @@ -114,10 +116,9 @@ protected String defaultBaseLocation() {

protected void createCatalog() {
Map<String, String> map = Maps.newHashMap();
map.put("gravitino.bypass.fs.oss.accessKeyId", OSS_ACCESS_KEY);
map.put("gravitino.bypass.fs.oss.accessKeySecret", OSS_SECRET_KEY);
map.put("gravitino.bypass.fs.oss.endpoint", OSS_ENDPOINT);
map.put("gravitino.bypass.fs.oss.impl", "org.apache.hadoop.fs.aliyun.oss.AliyunOSSFileSystem");
map.put(OSSProperties.GRAVITINO_OSS_ACCESS_KEY_ID, OSS_ACCESS_KEY);
map.put(OSSProperties.GRAVITINO_OSS_ACCESS_KEY_SECRET, OSS_SECRET_KEY);
map.put(OSSProperties.GRAVITINO_OSS_ENDPOINT, OSS_ENDPOINT);
map.put(FILESYSTEM_PROVIDERS, "oss");

metalake.createCatalog(catalogName, Catalog.Type.FILESET, provider, "comment", map);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.apache.gravitino.Catalog;
import org.apache.gravitino.integration.test.container.GravitinoLocalStackContainer;
import org.apache.gravitino.integration.test.util.GravitinoITUtils;
import org.apache.gravitino.storage.S3Properties;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
Expand Down Expand Up @@ -170,12 +171,9 @@ protected String defaultBaseLocation() {

protected void createCatalog() {
Map<String, String> map = Maps.newHashMap();
map.put("gravitino.bypass.fs.s3a.access.key", accessKey);
map.put("gravitino.bypass.fs.s3a.secret.key", secretKey);
map.put("gravitino.bypass.fs.s3a.endpoint", s3Endpoint);
map.put(
"gravitino.bypass.fs.s3a.aws.credentials.provider",
"org.apache.hadoop.fs.s3a.SimpleAWSCredentialsProvider");
map.put(S3Properties.GRAVITINO_S3_ENDPOINT, s3Endpoint);
map.put(S3Properties.GRAVITINO_S3_ACCESS_KEY_ID, accessKey);
map.put(S3Properties.GRAVITINO_S3_SECRET_ACCESS_KEY, secretKey);
map.put(FILESYSTEM_PROVIDERS, "s3");

metalake.createCatalog(catalogName, Catalog.Type.FILESET, provider, "comment", map);
Expand Down
10 changes: 5 additions & 5 deletions clients/client-python/gravitino/filesystem/gvfs_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ class GVFSConfig:
OAUTH2_PATH = "oauth2_path"
OAUTH2_SCOPE = "oauth2_scope"

GVFS_FILESYSTEM_GCS_SERVICE_KEY_FILE = "gcs_service_account_key_path"
GVFS_FILESYSTEM_GCS_SERVICE_KEY_FILE = "gcs_service_account_file"

GVFS_FILESYSTEM_S3_ACCESS_KEY = "s3_access_key"
GVFS_FILESYSTEM_S3_SECRET_KEY = "s3_secret_key"
GVFS_FILESYSTEM_S3_ACCESS_KEY = "s3_access_key_id"
GVFS_FILESYSTEM_S3_SECRET_KEY = "s3_secret_access_key"
GVFS_FILESYSTEM_S3_ENDPOINT = "s3_endpoint"

GVFS_FILESYSTEM_OSS_ACCESS_KEY = "oss_access_key"
GVFS_FILESYSTEM_OSS_SECRET_KEY = "oss_secret_key"
GVFS_FILESYSTEM_OSS_ACCESS_KEY = "oss_access_key_id"
GVFS_FILESYSTEM_OSS_SECRET_KEY = "oss_secret_access_key"
GVFS_FILESYSTEM_OSS_ENDPOINT = "oss_endpoint"
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ def _init_test_entities(cls):
comment="",
properties={
"filesystem-providers": "gcs",
"gravitino.bypass.fs.gs.auth.service.account.enable": "true",
"gravitino.bypass.fs.gs.auth.service.account.json.keyfile": cls.key_file,
"gcs-service-account-file": cls.key_file,
},
)
catalog.as_schemas().create_schema(
Expand Down
7 changes: 3 additions & 4 deletions clients/client-python/tests/integration/test_gvfs_with_oss.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,9 @@ def _init_test_entities(cls):
comment="",
properties={
"filesystem-providers": "oss",
"gravitino.bypass.fs.oss.accessKeyId": cls.oss_access_key,
"gravitino.bypass.fs.oss.accessKeySecret": cls.oss_secret_key,
"gravitino.bypass.fs.oss.endpoint": cls.oss_endpoint,
"gravitino.bypass.fs.oss.impl": "org.apache.hadoop.fs.aliyun.oss.AliyunOSSFileSystem",
"oss-access-key-id": cls.oss_access_key,
"oss-secret-access-key": cls.oss_secret_key,
"oss-endpoint": cls.oss_endpoint,
},
)
catalog.as_schemas().create_schema(
Expand Down
6 changes: 3 additions & 3 deletions clients/client-python/tests/integration/test_gvfs_with_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ def _init_test_entities(cls):
comment="",
properties={
"filesystem-providers": "s3",
"gravitino.bypass.fs.s3a.access.key": cls.s3_access_key,
"gravitino.bypass.fs.s3a.secret.key": cls.s3_secret_key,
"gravitino.bypass.fs.s3a.endpoint": cls.s3_endpoint,
"s3-access-key-id": cls.s3_access_key,
"s3-secret-access-key": cls.s3_secret_key,
"s3-endpoint": cls.s3_endpoint,
},
)
catalog.as_schemas().create_schema(
Expand Down
3 changes: 3 additions & 0 deletions clients/filesystem-hadoop3/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ dependencies {
implementation(project(":catalogs:catalog-hadoop")) {
exclude(group = "*")
}
implementation(project(":catalogs:catalog-common")) {
exclude(group = "*")
}

implementation(libs.caffeine)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import static org.apache.gravitino.filesystem.hadoop.GravitinoVirtualFileSystemConfiguration.FS_FILESYSTEM_PROVIDERS;
import static org.apache.gravitino.filesystem.hadoop.GravitinoVirtualFileSystemConfiguration.GVFS_CONFIG_PREFIX;
import static org.apache.gravitino.filesystem.hadoop.GravitinoVirtualFileSystemConfiguration.GVFS_KEY_TO_HADOOP_KEY;

import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
Expand Down Expand Up @@ -410,6 +411,8 @@ private Map<String, String> getConfigMap(Configuration configuration) {
String key = entry.getKey();
if (key.startsWith(GRAVITINO_BYPASS_PREFIX)) {
maps.put(key.substring(GRAVITINO_BYPASS_PREFIX.length()), entry.getValue());
} else if (GVFS_KEY_TO_HADOOP_KEY.containsKey(key)) {
maps.put(GVFS_KEY_TO_HADOOP_KEY.get(key), entry.getValue());
} else if (!key.startsWith(GVFS_CONFIG_PREFIX)) {
maps.put(key, entry.getValue());
}
Expand Down
Loading
Loading