Skip to content

[Server][OpenSharing 1/6] Add the Unity Catalog connector for OpenSharing - #2145

Open
littlegrasscao wants to merge 4 commits into
unitycatalog:mainfrom
littlegrasscao:sharing/connector
Open

littlegrasscao wants to merge 4 commits into
unitycatalog:mainfrom
littlegrasscao:sharing/connector

Conversation

@littlegrasscao

@littlegrasscao littlegrasscao commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

🥞 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:

  • Own change: that PR's own commits, inside the PR, so you can comment. The link is updated after each push.
  • Branch compare: the same diff between the fork's branches. It never goes stale, but it is read-only.
# PR Own change Branch compare
1 #2145 Unity Catalog connector and dependencies ← this PR Files changed main...sharing/connector
2 #2151 OpenSharing's tables in UC's schema steps Files changed sharing/connector...sharing/schema
3 #2152 Authorization for shares and recipients Files changed sharing/schema...sharing/auth
4 #2146 Share API Files changed sharing/auth...sharing/provider-shares
5 #2147 Recipient API and share grants Files changed sharing/provider-shares...sharing/provider-recipients
6 #1825 Sharing protocol and recipient activation Files changed sharing/provider-recipients...opensharing-embedded

PR Checklist

Description of changes

This is part 1 of 6 of embedded OpenSharing. OpenSharing lets a Unity Catalog server share the Delta tables it governs with Delta Sharing recipients. It stays off unless server.opensharing.enabled=true.

  1. [Server][OpenSharing 1/6] Add the Unity Catalog connector for OpenSharing #2145: the Unity Catalog connector for OpenSharing, and its dependencies (this PR)
  2. [Server][OpenSharing 2/6] Add OpenSharing's tables as schema steps #2151: OpenSharing's tables in UC's schema migrations
  3. [Server][OpenSharing 3/6] Authorize shares and recipients #2152: authorization for sharing
  4. [Server][OpenSharing 4/6] Serve OpenSharing's share API from Unity Catalog #2146: the share API
  5. [Server][OpenSharing 5/6] Serve OpenSharing's recipient API and share grants from Unity Catalog #2147: the recipient API and share grants
  6. [Server][OpenSharing 6/6] Serve the Delta Sharing protocol and recipient activation from Unity Catalog #1825: the sharing protocol and recipient activation

Each PR builds on the one before. GitHub can't stack PRs from a fork, so the "Files changed" links above show each PR's own change.

This PR adds the connector to server and the dependency on io.opensharing:opensharing-server-core:0.1.1. Nothing starts or serves OpenSharing yet.

The connector

UnityCatalogCatalogConnector is how OpenSharing reads Unity Catalog. It uses UC's repositories, its access expressions and its credential vendor.

  • Tables. It resolves a table only for a user whom UC lets read the table's data. That is the check UC makes before vending read credentials: USE CATALOG, USE SCHEMA and SELECT, or ownership. READ METADATA alone isn't enough. It refuses tables that aren't Delta or have no storage location.
  • Credentials. It vends credentials with UC's credential vendor, for the table's own location only. S3 credentials carry the region configured for the bucket in server.properties.
  • Users. authorize only checks that the caller is an enabled UC user, and never marks them as an admin. The provider API in later PRs checks sharing privileges, including who may transfer a share's or recipient's ownership, with AuthorizeExpression annotations before calling OpenSharing, and sets the admin flag itself.

Dependencies

  • Delta Kernel. delta-kernel-defaults and delta-storage are direct dependencies, and also overrides, at deltaVersion, so they move with delta-kernel-api. Both exclude unitycatalog-client and unitycatalog-hadoop, as OpenSharing's own POM does. Those are older published UC jars that would shadow the server's own classes.
  • Hadoop. OpenSharing builds against Hadoop 3.4.3. The server stays on UC's 3.4.2 and declares hadoop-client-runtime, hadoop-aws and hadoop-azure directly. That way the published unitycatalog-server POM pins them too; sbt's dependencyOverrides don't reach the POM. In UC's resolved classpath, the libraries 3.4.3 upgraded are already at newer versions or absent.
  • Legacy Azure jars. hadoop-azure excludes Jetty 9.4 (jetty-util, jetty-util-ajax) and the WASB SDK (azure-storage, azure-keyvault-core). OpenSharing reads only abfs/abfss, and the ABFS classes don't reference these jars. Exclude hadoop-azure's unused WASB and Jetty 9.4 jars from core OpenSharing-IO/OpenSharing#183, now merged, makes the same exclusions in opensharing-server-core. commons-pool stays, because Parquet uses it.
  • StAX. hadoop-client-runtime registers a relocated Woodstox that Jackson XML can't use. That includes Azure credential vending. UnityCatalogServer now points StAX at Woodstox when the class loads, so servers started with the builder get the fix too, not only main. A -D set by the operator still wins.
  • Shaded server. serverShaded leaves out the modules only OpenSharing brings. These are the Hadoop file systems, Parquet and the cloud connectors, which would clash with Spark's. The list is maintained by hand. The shaded jar has the same entries as before this PR.

Tests

  • UnityCatalogCatalogConnectorTest covers several cases:
    • a table the user may read resolves, and one they may not is denied;
    • an enabled user is accepted and an unknown one refused;
    • lookup failures, malformed names and invalid stored data.
  • StaxProviderTest checks that StAX resolves to Woodstox's own factories, and that a factory the operator set is kept.
  • On JDK 17 and H2, server/test with UC_TEST_MIGRATION_CHECKS=true passed on the top of the stack, and the sharing tests pass again after the authorize change. CI runs the suite on H2, PostgreSQL and MySQL.
  • It depends on the published opensharing-server-core 0.1.1, which includes Exclude hadoop-azure's unused WASB and Jetty 9.4 jars from core OpenSharing-IO/OpenSharing#183 and Add netty explicitly as dependency #184.
  • I didn't run a live ADLS read, because it needs Azure credentials.

This pull request and its description were written by Isaac.

Comment thread build.sbt Resolved
@littlegrasscao
littlegrasscao force-pushed the sharing/connector branch 4 times, most recently from 9f202d8 to d9b8c92 Compare November 11, 2026 17:11
@littlegrasscao littlegrasscao changed the title [Server] Add server-sharing with the Unity Catalog connector for OpenSharing [Server][OpenSharing 1/6] Add the Unity Catalog connector for OpenSharing Nov 11, 2026
@littlegrasscao
littlegrasscao force-pushed the sharing/connector branch 4 times, most recently from cdd6fa7 to acd6905 Compare November 12, 2026 05:57
private MetricsRegistries.PrometheusMetrics metrics;

static {
useWoodstoxForStax();

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.

can we make sure that anything needed for sharing is behind a server property (basically a feature flag, default off)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This one is needed for code compilation due to new dependency introduced. Let me explore if it can be guard behind a flag.

Later stack has a flag to guard OpenSharing itself.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Update: this can't go behind the flag, but not because of compilation. OpenSharing is embedded, so its hadoop-client-runtime dependency is on the server's classpath even when sharing is off. That jar registers a relocated Woodstox as the StAX provider, and the JVM can pick it up at runtime, which breaks Jackson XML, which the server already uses. useWoodstoxForStax() pins StAX to Woodstox's own factories, the same ones main uses today, so with the flag off the server behaves as it does on main. Gating it would cause exactly the flag-off change we want to avoid. Keeping those jars off the classpath when sharing is off would need a separately loaded module, which is a larger change.

What the flag does gate: starting OpenSharing, its routes and the provider API. The os_* schema steps run either way: Flyway steps are numbered, so skipping them would break upgrades for anyone who turns sharing on later.

@yili-db yili-db Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yes I agree that things not directly enabling sharing can avoid this flag guarding:

  • Flyway table schema versioning of os_ tables
  • Dependency and compilation
  • Any setup can't be easily turned off, but doesn't enable any sharing functionality

Sun Cao and others added 2 commits November 17, 2026 22:15
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]>
Signed-off-by: Sun Cao <[email protected]>
Co-authored-by: Isaac <[email protected]>
@yili-db

yili-db commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

/review

This branch has not been deployed

No deployments
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.

3 participants