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

[#5051] GravitinoClient needs metalake to obtain version #5060

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
public class GravitinoClient extends GravitinoClientBase
implements SupportsCatalogs, TagOperations {

private final GravitinoMetalake metalake;
private static GravitinoMetalake metalake = null;

/**
* Constructs a new GravitinoClient with the given URI, authenticator and AuthDataProvider.
Expand All @@ -84,6 +84,24 @@ private GravitinoClient(
this.metalake = loadMetalake(metalakeName);
}

/**
* Constructs a new GravitinoClient with the given URI, authenticator and AuthDataProvider.
*
* @param uri The base URI for the Gravitino API.
* @param authDataProvider The provider of the data which is used for authentication.
* @param checkVersion Whether to check the version of the Gravitino server. Gravitino does not
* support the case that the client-side version is higher than the server-side version.
* @param headers The base header for Gravitino API.
* @throws NoSuchMetalakeException if the metalake with specified name does not exist.
*/
private GravitinoClient(
String uri,
AuthDataProvider authDataProvider,
boolean checkVersion,
Map<String, String> headers) {
super(uri, authDataProvider, checkVersion, headers);
}

/**
* Get the current metalake object
*
Expand Down Expand Up @@ -537,7 +555,7 @@ public GravitinoClient build() {
metalakeName != null && !metalakeName.isEmpty(),
"The argument 'metalakeName' must be a valid name");

return new GravitinoClient(uri, metalakeName, authDataProvider, checkVersion, headers);
return new GravitinoClient(uri, authDataProvider, checkVersion, headers);
}
}
}