Skip to content

[#8892] feat(Lance-REST-Server): implement namespace operation APIs for LRS#8902

Merged
mchades merged 8 commits intoapache:branch-lance-namepspace-devfrom
mchades:ns-ops
Oct 24, 2025
Merged

[#8892] feat(Lance-REST-Server): implement namespace operation APIs for LRS#8902
mchades merged 8 commits intoapache:branch-lance-namepspace-devfrom
mchades:ns-ops

Conversation

@mchades
Copy link
Copy Markdown
Contributor

@mchades mchades commented Oct 23, 2025

What changes were proposed in this pull request?

implement namespace operation APIs for LRS

Why are the changes needed?

Fix: #8892

Does this PR introduce any user-facing change?

yes, new REST APIs added

How was this patch tested?

not now

@mchades mchades self-assigned this Oct 23, 2025
@mchades mchades marked this pull request as ready for review October 24, 2025 02:49
@mchades
Copy link
Copy Markdown
Contributor Author

mchades commented Oct 24, 2025

@beinan cc

public DescribeNamespaceResponse describeNamespace(String namespaceId, String delimiter) {
ObjectIdentifier nsId = ObjectIdentifier.of(namespaceId, delimiter);
Preconditions.checkArgument(
nsId.levels() <= 2, "Expected at most 2-level namespace but got: %s", namespaceId);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shall we check that the namespace exactly match 2 levels?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because there is also a location property on catalog, if it is limited to exact match of 2 levels, then the property on catalog cannot be viewed through this API.

break;
case 1:
String schemaName = nsId.levelAtListPos(1);
Schema schema = catalog.asSchemas().loadSchema(schemaName);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shall we handle the exception like schema not found.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The class org.apache.gravitino.lance.service.LanceExceptionMapper has already handled this

}
if (!isLakehouseCatalog(catalog)) {
throw LanceNamespaceException.notFound(
"Catalog not found: " + catalogName,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The exception log is not correct.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

My initial thought is that we assume only the Lakehouse catalog is visible to the Lance Rest Server. So, if a catalog exists but is not a Lakehouse catalog, it would be considered a nonexistent catalog by the LRS.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we can treat as not found exception, but the detailed message should be clarified, otherwise it is a little misleading.

response.setProperties(
createdSchema.properties() == null ? Maps.newHashMap() : createdSchema.properties());
return response;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shall we catch other expcetions here and above?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

unnecessary, they will be handled in the server layer

default:
throw new IllegalArgumentException("Unknown mode: " + mode);
}
} catch (NoSuchSchemaException e) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We'd also change the code structure like above for catalog.

@jerryshao
Copy link
Copy Markdown
Contributor

LGTM, just one comment.

@mchades mchades merged commit 662097a into apache:branch-lance-namepspace-dev Oct 24, 2025
26 checks passed
jerryshao pushed a commit to jerryshao/gravitino that referenced this pull request Nov 11, 2025
…APIs for LRS (apache#8902)

### What changes were proposed in this pull request?

implement namespace operation APIs for LRS

### Why are the changes needed?

Fix: apache#8892 

### Does this PR introduce _any_ user-facing change?

yes, new REST APIs added

### How was this patch tested?

not now
youngyjd pushed a commit to youngyjd/gravitino that referenced this pull request Nov 19, 2025
…APIs for LRS (apache#8902)

implement namespace operation APIs for LRS

Fix: apache#8892

yes, new REST APIs added

not now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants