fsk119 commented on code in PR #21776:
URL: https://github.com/apache/flink/pull/21776#discussion_r1090118401
##########
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/gateway/ExecutorImpl.java:
##########
@@ -429,4 +453,46 @@ private CompletableFuture<OperationStatusResponseBody>
closeOperationAsync(
private OperationHandle getOperationHandle(Supplier<String>
handleSupplier) {
return new OperationHandle(UUID.fromString(handleSupplier.get()));
}
+
+ private SqlGatewayRestAPIVersion negotiateVersion() {
+ List<SqlGatewayRestAPIVersion> gatewayVersions =
+ getResponse(
+ sendRequest(
+ GetApiVersionHeaders.getInstance(),
+ EmptyMessageParameters.getInstance(),
+ EmptyRequestBody.getInstance(),
+ // Currently, RestClient always uses
the latest REST API
+ // version to build the targetUrl.
However, it's possible
+ // that the client REST API version is
higher than the
+ // server REST API version. In this
case, the gateway will
+ // report Not Found Error to notify
the client.
+ //
+ // So, here use the lowest REST API
version to get the
+ // remote gateway version list and
then determine the
+ // connection version.
+ // TODO: Remove this after the REST
Client should allow
+ // to build the target URL without API
version.
+ Collections.min(
+
Arrays.stream(SqlGatewayRestAPIVersion.values())
+ .filter(
+
SqlGatewayRestAPIVersion
+
::isStableVersion)
+
.collect(Collectors.toList()))))
+ .getVersions().stream()
+ .map(SqlGatewayRestAPIVersion::valueOf)
+ .collect(Collectors.toList());
Review Comment:
Considering current implementation is a little hacky, I think it's better we
can keep it inside. I think others will not use `getInitialStableVersion`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]