Skip to content

Conversation

@emmyzhou-db
Copy link
Contributor

@emmyzhou-db emmyzhou-db commented May 19, 2025

What changes are proposed in this pull request?

Direct Dataplane Access for Databricks Java SDK

This PR adds the required classes for direct dataplane access in the Databricks Java SDK.

DataPlaneTokenSource

  • Manages and caches EndpointTokenSource instances.
  • Ensures a single EndpointTokenSource per unique endpoint and set of authorization details.
  • Provides a thread-safe cache to avoid redundant token source creation.

EndpointTokenSource

  • Handles the OAuth token exchange process.
  • Exchanges a control plane token for a dataplane token.
  • Caches the dataplane token and manages its refresh and expiry.

TokenEndpointClient

  • Utility for making HTTP requests to OAuth token endpoints.
  • Handles request formatting, response parsing, and error handling.

How is this tested?

  • Unit tests have been added for all the aforementioned classes.

NO_CHANGELOG=true

Comment on lines +42 to +56
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
TokenSourceKey that = (TokenSourceKey) o;
return Objects.equals(endpoint, that.endpoint)
&& Objects.equals(authDetails, that.authDetails);
}

@Override
public int hashCode() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we’re using objects of this class as HashMap keys, we need to override the equals() method to define when two keys are considered equal, and the hashCode() method so the HashMap can efficiently store and retrieve the values by keys.

Copy link
Contributor

@parthban-db parthban-db left a comment

Choose a reason for hiding this comment

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

One thing that we can test more in dataplaneTokenSource is whether we are using the cached endpointTokenSource or not for the same key (the number of times we are calling the endpointTokenSource constructor). It may not need to be fit on the same parameterized tests as this is a different kind of test.

Rest is LGTM!

@parthban-db
Copy link
Contributor

Also, can you change the PR title to something more relevant to the change, like "Add DataPlaneTokenSource?"

@emmyzhou-db emmyzhou-db changed the title Implement direct dataplane access Add DataPlaneTokenSource, EndpointTokenSource, and TokenEndpointClient May 19, 2025
@emmyzhou-db emmyzhou-db changed the title Add DataPlaneTokenSource, EndpointTokenSource, and TokenEndpointClient Add DataPlaneTokenSource and EndpointTokenSource May 19, 2025
@emmyzhou-db emmyzhou-db temporarily deployed to test-trigger-is May 25, 2025 20:54 — with GitHub Actions Inactive
@github-actions
Copy link

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-java

Inputs:

  • PR number: 449
  • Commit SHA: ba40e9492b6d5f07fd20b0692656477d463279fc

Checks will be approved automatically on success.

@emmyzhou-db emmyzhou-db temporarily deployed to test-trigger-is May 25, 2025 20:56 — with GitHub Actions Inactive
@emmyzhou-db emmyzhou-db added this pull request to the merge queue May 26, 2025
Merged via the queue into main with commit a8187d6 May 26, 2025
15 checks passed
@emmyzhou-db emmyzhou-db deleted the emmyzhou-db/direct-dataplane branch May 26, 2025 08:51
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.

4 participants