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

[WIP] Multipart namespaces support (Nessie and Rest catalogs) #23453

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

sftwrdvlpr
Copy link

Description

Add multipart namespaces support for Nessie and Rest iceberg catalogs.

Additional context and related issues

#22916

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text:

# Iceberg
* Add multipart namespaces support (Nessie and Rest catalogs). ({issue}`22916`)

Copy link

cla-bot bot commented Sep 17, 2024

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

…estTrinoNessieCatalog & TestTrinoRestCatalog
Copy link

cla-bot bot commented Sep 17, 2024

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

Copy link

cla-bot bot commented Sep 17, 2024

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

Copy link

cla-bot bot commented Sep 17, 2024

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

Copy link
Contributor

@mayankvadariya mayankvadariya left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution.

firstLevel + dotSeparator + secondLevel + dotSeparator + thirdLevel);

for (String namespace : namespacesList) {
catalog.createNamespace(SESSION, namespace, ImmutableMap.of(), new TrinoPrincipal(PrincipalType.USER, SESSION.getUser()));
Copy link
Contributor

Choose a reason for hiding this comment

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

please use stram apis where applicable. namespacesList.forEach(..)

@Test
public void testMultipartNamespace()
{
String dotSeparator = ".";
Copy link
Contributor

@mayankvadariya mayankvadariya Sep 18, 2024

Choose a reason for hiding this comment

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

I think we inherently assume that .(dot) in the name represents a nested namespace. ie if user creates ns1.ns2.ns3 namespace then it will be created in a nested fashion. Do we want to support a ns with . in the name without creating a nested namespace meaning ns1.n2.ns3 will created at first level.

return restSessionCatalog.listNamespaces(convert(session)).stream()
.map(Namespace::toString)
.collect(toImmutableList());
return collectNamespaces(session, Namespace.empty());
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 similar changes for other object management methods like create/drop/rename a table/view/mvs etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Add multipart namespace support to TrinoRestCatalog (with test) -> Add multipart namespace support to TrinoRestCatalog

you may want to keep only two commits one for rest and another for nessie and squash the commits.

}

@Override
public void dropNamespace(ConnectorSession session, String namespace)
{
try {
restSessionCatalog.dropNamespace(convert(session), Namespace.of(namespace));
restSessionCatalog.dropNamespace(convert(session), toNamespace(namespace));
Copy link
Contributor

Choose a reason for hiding this comment

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

we should list and delete all the child namespaces and then the requested namespace.

Comment on lines 225 to 231
for (String namespace : namespacesList) {
try {
catalog.dropNamespace(SESSION, namespace);
}
catch (Exception e) {
LOG.warn("Failed to clean up namespace: %s", namespace);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Use stream api. Remove catch clause as it shouldn't be required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iceberg Iceberg connector
Development

Successfully merging this pull request may close these issues.

2 participants