-
Notifications
You must be signed in to change notification settings - Fork 154
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
[590] Add Iceberg Glue Catalog Sync implementation #599
Open
kroushan-nit
wants to merge
6
commits into
apache:590-CatalogSync
Choose a base branch
from
kroushan-nit:590-IcebergGlueSync
base: 590-CatalogSync
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a90cd43
[590] Add RFC template for XTable
vinishjail97 9b090e3
Hadoop and AWS sdk version upgrade
kroushan-nit f1570fe
[590] Add Iceberg Glue Catalog Sync implementation
kroushan-nit 7c29aa1
Address comments [1]
kroushan-nit 1478c6c
rebase with main and Address comments [2]
kroushan-nit 81ac338
pom changes
kroushan-nit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<!-- | ||
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. | ||
--> | ||
# RFC-[number]: [Title] | ||
|
||
## Proposers | ||
|
||
- @<proposer1 github username> | ||
- @<proposer2 github username> | ||
|
||
## Approvers | ||
- @<approver1 github username> | ||
- @<approver2 github username> | ||
|
||
## Status | ||
|
||
GH Feature Request: <link to umbrella JIRA> | ||
|
||
> Please keep the status updated in `rfc/README.md`. | ||
|
||
## Abstract | ||
|
||
Describe the problem you are trying to solve and a brief description of why it’s needed. | ||
|
||
## Background | ||
Introduce any background context which is relevant or necessary to understand the feature and design choices. | ||
|
||
## Implementation | ||
Describe the new thing you want to do in appropriate detail, how it fits into the project architecture.<br> | ||
Provide a detailed description of how you intend to implement this feature, this may be fairly extensive and have large subsections of its own or it may be a few sentences.<br> | ||
Use judgement to decide on how detailed the description needs to be based on the scope of the change. If unclear, you can ask questions in [email protected]. | ||
|
||
## Rollout/Adoption Plan | ||
|
||
- Are there any breaking changes as part of this new feature/functionality? | ||
- What impact (if any) will there be on existing users? | ||
- If we are changing behavior how will we phase out the older behavior? When will we remove the existing behavior? | ||
- If we need special migration tools, describe them here. | ||
|
||
## Test Plan | ||
|
||
Describe in few sentences how the RFC will be tested. How will we know that the implementation works as expected? How will we know nothing breaks? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...le-api/src/test/java/org/apache/xtable/model/catalog/TestHierarchicalTableIdentifier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* 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.xtable.model.catalog; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class TestHierarchicalTableIdentifier { | ||
|
||
@Test | ||
void testToString() { | ||
HierarchicalTableIdentifier catalogTableIdentifier = | ||
ThreePartHierarchicalTableIdentifier.fromDotSeparatedIdentifier( | ||
"catalogName.databaseName.tableName"); | ||
assertEquals("catalogName.databaseName.tableName", catalogTableIdentifier.getId()); | ||
} | ||
|
||
@Test | ||
void testConstructorForHierarchicalTableIdentifier() { | ||
Assertions.assertDoesNotThrow( | ||
() -> | ||
ThreePartHierarchicalTableIdentifier.fromDotSeparatedIdentifier( | ||
"catalogName.databaseName.tableName")); | ||
Assertions.assertDoesNotThrow( | ||
() -> | ||
ThreePartHierarchicalTableIdentifier.fromDotSeparatedIdentifier( | ||
"databaseName.tableName")); | ||
Assertions.assertThrows( | ||
IllegalArgumentException.class, | ||
() -> ThreePartHierarchicalTableIdentifier.fromDotSeparatedIdentifier("tableName")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ 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. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.apache.xtable</groupId> | ||
<artifactId>xtable</artifactId> | ||
<version>0.2.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>xtable-aws</artifactId> | ||
<name>XTable AWS</name> | ||
|
||
<dependencies> | ||
|
||
<dependency> | ||
<groupId>org.apache.xtable</groupId> | ||
<artifactId>xtable-core_${scala.binary.version}</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.xtable</groupId> | ||
<artifactId>xtable-core_${scala.binary.version}</artifactId> | ||
<version>${project.version}</version> | ||
<classifier>tests</classifier> | ||
<type>test-jar</type> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<!-- Hadoop dependencies --> | ||
<dependency> | ||
<groupId>org.apache.hadoop</groupId> | ||
<artifactId>hadoop-common</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<!-- AWS Glue dependencies --> | ||
<dependency> | ||
<groupId>software.amazon.awssdk</groupId> | ||
<artifactId>glue</artifactId> | ||
</dependency> | ||
|
||
<!-- Junit --> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-params</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<!-- Mockito --> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-junit-jupiter</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-deploy-plugin</artifactId> | ||
<version>${maven-deploy-plugin.version}</version> | ||
<configuration> | ||
<skip>true</skip> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
80 changes: 80 additions & 0 deletions
80
xtable-aws/src/main/java/org/apache/xtable/glue/DefaultGlueClientFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* 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.xtable.glue; | ||
|
||
import java.util.Map; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
|
||
import org.apache.xtable.exception.ConfigurationException; | ||
import org.apache.xtable.reflection.ReflectionUtils; | ||
|
||
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider; | ||
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider; | ||
import software.amazon.awssdk.regions.Region; | ||
import software.amazon.awssdk.services.glue.GlueClient; | ||
import software.amazon.awssdk.services.glue.GlueClientBuilder; | ||
|
||
/** | ||
* Factory class for creating and configuring instances of {@link GlueClient} with settings provided | ||
* by {@link GlueCatalogConfig}. | ||
* | ||
* <p>This factory is responsible for setting the AWS region and credentials for the Glue client. If | ||
* a custom credentials provider class is specified in {@code GlueCatalogConfig}, it will use | ||
* reflection to instantiate the provider; otherwise, it defaults to the standard AWS credentials | ||
* provider. | ||
*/ | ||
public class DefaultGlueClientFactory extends GlueClientFactory { | ||
|
||
public DefaultGlueClientFactory(GlueCatalogConfig glueConfig) { | ||
super(glueConfig); | ||
} | ||
|
||
public GlueClient getGlueClient() { | ||
GlueClientBuilder builder = GlueClient.builder(); | ||
if (!StringUtils.isEmpty(glueConfig.getRegion())) { | ||
builder.region(Region.of(glueConfig.getRegion())); | ||
} | ||
|
||
AwsCredentialsProvider credentialsProvider; | ||
if (!StringUtils.isEmpty(glueConfig.getClientCredentialsProviderClass())) { | ||
String className = glueConfig.getClientCredentialsProviderClass(); | ||
try { | ||
credentialsProvider = | ||
ReflectionUtils.createInstanceOfClassFromStaticMethod( | ||
className, | ||
"create", | ||
new Class<?>[] {Map.class}, | ||
new Object[] {glueConfig.getClientCredentialConfigs()}); | ||
} catch (ConfigurationException e) { | ||
// retry credentialsProvider creation without arguments if not a ClassNotFoundException | ||
if (e.getCause() instanceof ClassNotFoundException) { | ||
throw e; | ||
} | ||
credentialsProvider = | ||
ReflectionUtils.createInstanceOfClassFromStaticMethod(className, "create"); | ||
} | ||
} else { | ||
credentialsProvider = DefaultCredentialsProvider.create(); | ||
} | ||
|
||
builder.credentialsProvider(credentialsProvider); | ||
return builder.build(); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should define the
glue
artifact and version here in the dependencyManagement section as well