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

[#5019] feat: (hadoop-catalog): Add a framework to support multi-storage in a pluggable manner for fileset catalog #5020

Merged
merged 48 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
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
ffaa064
Change gvfs accordingly.
yuqi1129 Oct 11, 2024
32d7f3d
Merge remote-tracking branch 'me/issue_5019' into issue_5019
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
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
5dbca5f
fix
yuqi1129 Oct 15, 2024
f27520a
Update code.
yuqi1129 Oct 15, 2024
27bc2ab
Fix
yuqi1129 Oct 16, 2024
9dc0f5a
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
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@ include clients/client-python/.gitignore
**/metastore_db
**/spark-warehouse
derby.log

web/node_modules
web/dist
web/.next
6 changes: 4 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,8 @@ tasks {
if (!it.name.startsWith("catalog") &&
!it.name.startsWith("authorization") &&
!it.name.startsWith("client") && !it.name.startsWith("filesystem") && !it.name.startsWith("spark") && !it.name.startsWith("iceberg") && it.name != "trino-connector" &&
it.name != "integration-test" && it.name != "hive-metastore-common" && !it.name.startsWith("flink")
it.name != "integration-test" && it.name != "hive-metastore-common" && !it.name.startsWith("flink") &&
it.name != "hadoop-gcs-bundle" && it.name != "hadoop-s3-bundle"
) {
from(it.configurations.runtimeClasspath)
into("distribution/package/libs")
Expand All @@ -763,7 +764,8 @@ tasks {
!it.name.startsWith("integration-test") &&
!it.name.startsWith("flink") &&
!it.name.startsWith("trino-connector") &&
it.name != "hive-metastore-common"
it.name != "hive-metastore-common" &&
it.name != "hadoop-gcs-bundle" && it.name != "hadoop-s3-bundle"
) {
dependsOn("${it.name}:build")
from("${it.name}/build/libs")
Expand Down
22 changes: 22 additions & 0 deletions bundles/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* 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.
*/

tasks.all {
enabled = false
}
46 changes: 46 additions & 0 deletions bundles/hadoop-gcs-bundle/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* 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.
*/
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
`maven-publish`
id("java")
alias(libs.plugins.shadow)
}

dependencies {
compileOnly(project(":catalogs:catalog-hadoop"))
compileOnly(libs.hadoop3.common)
implementation(libs.hadoop3.gcs)
}

tasks.withType(ShadowJar::class.java) {
isZip64 = true
configurations = listOf(project.configurations.runtimeClasspath.get())
archiveClassifier.set("")
}

tasks.jar {
dependsOn(tasks.named("shadowJar"))
archiveClassifier.set("empty")
}

tasks.compileJava {
dependsOn(":catalogs:catalog-hadoop:runtimeJars")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* 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.fileset.gcs;

import java.util.Map;
import org.apache.gravitino.catalog.hadoop.DefaultConfigurationProvider;
import org.apache.hadoop.conf.Configuration;

public class GCSConfigurationProvider extends DefaultConfigurationProvider {
// Add your own implementation here
@Override
public Configuration getConfiguration(Map<String, String> conf) {
return super.getConfiguration(conf);
}
}
46 changes: 46 additions & 0 deletions bundles/hadoop-s3-bundle/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* 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.
*/
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
`maven-publish`
id("java")
alias(libs.plugins.shadow)
}

dependencies {
compileOnly(project(":catalogs:catalog-hadoop"))
compileOnly(libs.hadoop3.common)
implementation(libs.hadoop3.s3)
}

tasks.withType(ShadowJar::class.java) {
isZip64 = true
configurations = listOf(project.configurations.runtimeClasspath.get())
archiveClassifier.set("")
}

tasks.jar {
dependsOn(tasks.named("shadowJar"))
archiveClassifier.set("empty")
}

tasks.compileJava {
dependsOn(":catalogs:catalog-hadoop:runtimeJars")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* 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.fileset.s3;

import java.util.Map;
import org.apache.gravitino.catalog.hadoop.DefaultConfigurationProvider;
import org.apache.hadoop.conf.Configuration;

public class S3ConfigurationProvider extends DefaultConfigurationProvider {
// Add your own implementation here
@Override
public Configuration getConfiguration(Map<String, String> conf) {
return super.getConfiguration(conf);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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.catalog.hadoop;

import java.util.Map;
import org.apache.hadoop.conf.Configuration;

public interface ConfigurationProvider {

default void initialize(Map<String, String> conf) {
// Do nothing;
}
/**
* Get the configuration from the given properties.
*
* @param conf The properties to get the configuration from.
* @return The configuration.
*/
Configuration getConfiguration(Map<String, String> conf);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* 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.catalog.hadoop;

import java.util.Map;
import org.apache.hadoop.conf.Configuration;

public class DefaultConfigurationProvider implements ConfigurationProvider {
@Override
public Configuration getConfiguration(Map<String, String> conf) {
Configuration configuration = new Configuration();
conf.forEach(configuration::set);
return configuration;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,20 @@ public void initialize(
Map.Entry::getValue));
bypassConfigs.forEach(hadoopConf::set);

String configProviderClass =
config.getOrDefault(
HadoopCatalogPropertiesMetadata.CONFIGURATION_PROVIDER,
DefaultConfigurationProvider.class.getCanonicalName());
try {
Class<?> providerClass = Class.forName(configProviderClass);
ConfigurationProvider provider =
(ConfigurationProvider) providerClass.getDeclaredConstructor().newInstance();
provider.initialize(bypassConfigs);
this.hadoopConf = provider.getConfiguration(bypassConfigs);
} catch (Exception e) {
throw new RuntimeException("Failed to initialize Hadoop configuration", e);
}

String catalogLocation =
(String)
propertiesMetadata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public class HadoopCatalogPropertiesMetadata extends BaseCatalogPropertiesMetada
// If not, users have to specify the storage location in the Schema or Fileset level.
public static final String LOCATION = "location";

/**
* The configuration provider class name, default value is {@link DefaultConfigurationProvider}.
*/
public static final String CONFIGURATION_PROVIDER = "configuration.provider";

private static final Map<String, PropertyEntry<?>> HADOOP_CATALOG_PROPERTY_ENTRIES =
ImmutableMap.<String, PropertyEntry<?>>builder()
.put(
Expand All @@ -44,6 +49,14 @@ public class HadoopCatalogPropertiesMetadata extends BaseCatalogPropertiesMetada
false /* immutable */,
null,
false /* hidden */))
.put(
CONFIGURATION_PROVIDER,
PropertyEntry.stringOptionalPropertyEntry(
CONFIGURATION_PROVIDER,
"The configuration provider class name",
false /* immutable */,
DefaultConfigurationProvider.class.getCanonicalName(),
false /* hidden */))
// The following two are about authentication.
.putAll(KerberosConfig.KERBEROS_PROPERTY_ENTRIES)
.putAll(AuthenticationConfig.AUTHENTICATION_PROPERTY_ENTRIES)
Expand Down
3 changes: 3 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ airlift-resolver = "1.6"
hive2 = "2.3.9"
hadoop2 = "2.10.2"
hadoop3 = "3.1.0"
hadoop3-gcs = "3.0.0"
hadoop-minikdc = "3.3.6"
htrace-core4 = "4.1.0-incubating"
httpclient5 = "5.2.1"
Expand Down Expand Up @@ -151,6 +152,8 @@ hadoop3-hdfs = { group = "org.apache.hadoop", name = "hadoop-hdfs", version.ref
hadoop3-common = { group = "org.apache.hadoop", name = "hadoop-common", version.ref = "hadoop3"}
hadoop3-client = { group = "org.apache.hadoop", name = "hadoop-client", version.ref = "hadoop3"}
hadoop3-minicluster = { group = "org.apache.hadoop", name = "hadoop-minicluster", version.ref = "hadoop-minikdc"}
hadoop3-s3 = { group = "org.apache.hadoop", name = "hadoop-aws", version.ref = "hadoop3"}
hadoop3-gcs = { group = "com.google.cloud.bigdataoss", name = "gcs-connector", version.ref = "hadoop3-gcs"}
htrace-core4 = { group = "org.apache.htrace", name = "htrace-core4", version.ref = "htrace-core4" }
airlift-json = { group = "io.airlift", name = "json", version.ref = "airlift-json"}
airlift-resolver = { group = "io.airlift.resolver", name = "resolver", version.ref = "airlift-resolver"}
Expand Down
3 changes: 3 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,6 @@ project(":spark-connector:spark-runtime-3.5").projectDir = file("spark-connector
include("web:web", "web:integration-test")
include("docs")
include("integration-test-common")
include("bundles:hadoop-s3-bundle")
include("bundles:hadoop-gcs-bundle")
findProject(":bundles:hadoop-gcs-bundle")?.name = "hadoop-gcs-bundle"
Loading