Repository navigation
[Server][OpenSharing 4/6] Serve OpenSharing's share API from Unity Catalog - #2146
Open
littlegrasscao wants to merge 6 commits into
Open
littlegrasscao wants to merge 6 commits into
littlegrasscao wants to merge 6 commits into
Conversation
This was referenced Nov 6, 2026
littlegrasscao
force-pushed
the
sharing/provider-shares
branch
2 times, most recently
from
November 8, 2026 00:02
c0d1f16 to
24fdad2
Compare
This was referenced Nov 8, 2026
littlegrasscao
force-pushed
the
sharing/provider-shares
branch
5 times, most recently
from
November 11, 2026 17:11
d070cdf to
f8dbeaf
Compare
littlegrasscao
force-pushed
the
sharing/provider-shares
branch
14 times, most recently
from
November 17, 2026 21:47
64a39f1 to
3c34540
Compare
littlegrasscao
force-pushed
the
sharing/provider-shares
branch
from
November 17, 2026 22:13
3c34540 to
8c978a6
Compare
The connector is how embedded OpenSharing reads Unity Catalog: it resolves a table only for a user UC lets read its data, and vends that table's read-only credentials with UC's credential vendor, refusing any other operation instead of downgrading it. Nothing serves OpenSharing yet. opensharing-server-core is an ordinary dependency of the server module, like Iceberg, and the connector lives in the server's service/sharing package, so every packaging path that collects the server's classpath carries it. Its Hadoop modules stay on hadoopVersion, Delta Kernel's defaults stay on the server's Delta version, and the published unitycatalog-client and unitycatalog-hadoop that delta-storage brings in are excluded. hadoop-client-runtime registers its relocated Woodstox for StAX, which breaks Jackson's XML mapper (S3Mock, the Azure SDK), so the server sets the StAX factory system properties to Woodstox's own. The shaded server that the Spark connector tests use leaves out the modules that only OpenSharing adds, by module name. Signed-off-by: Sun Cao <[email protected]> Consume OpenSharing 0.1.1 Bump opensharing-server-core to 0.1.1. OpenSharing now matches the AWS SDK and Delta Kernel versions this server uses, so those pins are gone. It builds against a newer Hadoop, so the server keeps overriding the Hadoop modules to hadoopVersion. Its core excludes the published Unity Catalog jars from delta-storage itself, so the exclusion here is gone. The connector reports whether the caller owns the metastore in the user context's admin flag, which lets them transfer the ownership of any share or recipient. Co-authored-by: Isaac <[email protected]>
Keep OpenSharing's Delta and Hadoop versions in the POM and initialize Woodstox for builder-started servers. Signed-off-by: Sun Cao <[email protected]> Co-authored-by: Isaac <[email protected]>
OpenSharing reads the admin flag only to let a caller transfer the ownership of a share or recipient. UC checks that with the AuthorizeExpression on the provider endpoints, and OpenSharingProviderService sets the flag on the context it passes in, so the connector's authorize has nothing to decide. Signed-off-by: Sun Cao <[email protected]> Co-authored-by: Isaac <[email protected]>
OpenSharing's six tables (os_shares, os_share_properties, os_shared_data_objects, os_recipients, os_share_permissions and os_recipient_tokens) are Unity Catalog schema steps, V4 through V11, for H2, PostgreSQL and MySQL: one statement per step, the tables in foreign-key order, then the owner_id indexes. They are created whether or not embedded OpenSharing is enabled, and the steps build the schema Hibernate builds from OpenSharing's entities, which UC's own session factory now maps. Each step ships its H2 effect file; the PostgreSQL and MySQL ones follow from a run with Docker. HibernateTransactions runs OpenSharing's store work in sessions of that factory, and joins a transaction the thread already has, so a caller can make several OpenSharing calls and its own steps one unit of work. The schema migrator and the schema snapshot treat os_* tables as Unity Catalog's own, so the steps' index names are not blamed on another application and the snapshots see the tables the steps create. Signed-off-by: Sun Cao <[email protected]> Match OpenSharing 0.1.1's schema OpenSharing 0.1.1 stores ids as the database's native uuid (binary(16) on MySQL), its enums as plain varchar through converters, and names its foreign keys. The steps build the same columns, types and names its V1 does on each dialect, and the owner_id indexes its entities declare. Co-authored-by: Isaac <[email protected]>
Shares and recipients become securable types, with CREATE SHARE, USE SHARE, CREATE RECIPIENT and USE RECIPIENT as privileges on the metastore. UC grants nothing on a share or recipient itself, so validation of grants, the authorization hierarchy and the OPA input treat them as roots, and the permissions API refuses them. The key mapper resolves a share or recipient by name from OpenSharing's tables, and answers a missing one with the NOT_FOUND that UC gives for any missing object, not OpenSharing's own exception. It reads those tables only when asked for such a key, which only OpenSharing's provider API, once enabled, produces. The result filter reads the ids of OpenSharing's share and recipient responses. Signed-off-by: Sun Cao <[email protected]> Read OpenSharing 0.1.1's UUID ids OpenSharing 0.1.1 keys its entities by UUID, so the OPA input and the key mapper look them up directly instead of by their string form, and the JSON still carries the string form. Co-authored-by: Isaac <[email protected]>
With server.opensharing.enabled=true, the server serves OpenSharing's provider API for shares at /api/2.1/unity-catalog/opensharing/provider, behind UC's authentication and authorization. It is registered as the OPENSHARING protocol of ArmeriaServerBuilder next to Iceberg and Delta, with OpenSharing's JSON mapper and error dialect. UC records each share's owner in its authorizer, in the same transaction as the share itself. A share that does not exist is OpenSharing's 404 on these routes. With the flag off, none of this is registered and none of OpenSharing's tables is read or written. A sharing docs page describes the provider API, its privileges, how shared tables are read, and the database tables. Signed-off-by: Sun Cao <[email protected]> Consume OpenSharing 0.1.1 and support admin ownership transfers The provider service answers with OpenSharing's JSON, so its methods carry ProducesJson: without it Armeria found no response converter and answered 500. The caller's context now says whether they own the metastore, and PATCH /shares/{share} takes a catalog admin transferring the ownership to the body's ownerId, on its own, with UC's owner record moving to the new owner in the same transaction. Co-authored-by: Isaac <[email protected]>
littlegrasscao
force-pushed
the
sharing/provider-shares
branch
from
November 17, 2026 22:42
8c978a6 to
440d7c9
Compare
littlegrasscao
marked this pull request as ready for review
November 17, 2026 22:56
littlegrasscao
requested review from
dennyglee,
openinx,
tdas,
timothyw553 and
yili-db
as code owners
November 17, 2026 22:56
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🥞 Stacked PR
Each PR builds on the one before it. Until the earlier PRs merge, a later PR's "Files changed" tab also shows their changes, so use these links to review one PR's own change:
PR Checklist
docsis updated:docs/server/opensharing.mdis a new page, linked frommkdocs.yml, andetc/conf/server.propertieslists the new settings.Description of changes
Part 4 of 6 of embedded OpenSharing, which lets one Unity Catalog server share the Delta tables it governs with Delta Sharing recipients.
The six PRs, each building on the one before:
SHAREsecurable, theCREATE SHAREandUSE SHAREprivileges, OPA input, grant validation, the key mapper's share lookup andResultFilter)With
server.opensharing.enabled=true, this PR serves OpenSharing's provider API for shares at/api/2.1/unity-catalog/opensharing/provider, behind UC's own authentication and authorization. It creates, lists, gets, updates (adding and removing tables, or transferring ownership) and deletes shares. Request and response bodies use OpenSharing's wire format.Startup
server(opensharing-server-core0.1.1, added in [Server][OpenSharing 1/6] Add the Unity Catalog connector for OpenSharing #2145).UnityCatalogServerbuilds it throughOpenSharingLifecycle.startonly when the flag is on.server.authorization=enableis required, since UC users own the shares. Without it, the server doesn't start, and the error names the setting.server.opensharing.public-urlis required: it's the address recipients reach this server at. If it's missing or blank, the server doesn't start, and the error names the setting.ArmeriaServerBuilderas a newOPENSHARINGprotocol, with OpenSharing's JSON mapper for request and response bodies.OpenSharingExceptionHandlerrenders every failure on these routes as OpenSharing's{errorCode, message}body:UNAUTHENTICATEDandPERMISSION_DENIEDrejections become OpenSharing's equivalents.RESOURCE_DOES_NOT_EXIST). The key mapper lets OpenSharing's not-found error through to that handler.os_) are part of UC's schema ([Server][OpenSharing 2/6] Add OpenSharing's tables as schema steps #2151), and use UC's session factory and connection pool.docs/server/opensharing.md, added tomkdocs.yml. The new settings are inetc/conf/server.properties, commented out like the file's other optional settings.Authorization
UC authorizes each provider method by its
@AuthorizeExpression. The connector'sauthorizeonly checks that the caller is an enabled UC user.POST /sharesCREATE SHAREorOWNERon the metastoreGET /shares/{share}OWNERorUSE SHAREon the metastore, orOWNERof the shareGET /sharesPATCH /shares/{share}OWNERof the share, orOWNERon the metastore when the request setsownerIdDELETE /shares/{share}OWNERof the shareOWNERcan transfer a share by sendingownerIdwith no other change in the request. UC then moves itsOWNERrecord from the old owner to the new one. OpenSharing rejects:OWNER(403).OpenSharingProviderServicebuilds OpenSharing'sUserContextfrom the caller UC authenticated. Its admin flag is true when the caller isOWNERof the metastore, which is what lets OpenSharing accept a transfer.OWNERof a new share, and removes the records when the share is deleted.@ResponseAuthorizeFilter.listAll.USE SHAREcan get short or empty pages with more to follow.USE CATALOG,USE SCHEMAandSELECT, or ownership.Tests
OpenSharingEmbeddedTestdrives the API over HTTP on a server with authorization on.providerApiRequiresUnityCatalogPrivileges:UNAUTHENTICATEDbody.CREATE SHARE, and adding a table needsUSE CATALOG,USE SCHEMAandSELECT.USE SHARElets a user list and read other users' shares, but not change or delete them.unityCatalogRecordsShareOwners:adminTransfersASharesOwnership:listingsAreFilteredPerItemAfterPaging: with one share per page, a user who owns one of three shares gets two empty pages, then their share.OpenSharingLifecycleTest: the server doesn't start withoutserver.authorization=enable, or withoutserver.opensharing.public-url.OpenSharingDisabledTest: with the flag off, the provider path is answered like any unrouted path, and the server keeps serving catalogs and permissions after allos_*tables are dropped.I ran
server/testOnly io.unitycatalog.server.service.sharing.*on JDK 17 and H2, with OpenSharing 0.1.1: 21 tests, all pass. CI runs the full server suite on H2, PostgreSQL and MySQL.Known gaps
USE SHAREcan read it;OWNERrecord with the new owner, while OpenSharing still has the old one.Compatibility
api/all.yaml: the new securable and privileges come with [Server][OpenSharing 3/6] Authorize shares and recipients #2152, and the provider API isn't part of the UC API spec.server.opensharing.enabled(defaultfalse) andserver.opensharing.public-url.This pull request and its description were written by Isaac.