Skip to content

Commit

Permalink
Merge branch '1.19.1-develop' into rel/1.19.1_arenadata1
Browse files Browse the repository at this point in the history
  • Loading branch information
Asmoday committed Sep 9, 2024
2 parents d39d38c + 61709d0 commit 6e1b505
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.security.PrivilegedExceptionAction;
import java.time.Clock;
Expand Down Expand Up @@ -160,7 +162,7 @@ public ObtainedDelegationTokens obtainDelegationTokens() throws Exception {
credentials.addToken(hive2Token.getKind(), hive2Token);

HiveServer2DelegationTokenIdentifier tokenIdentifier =
hive2Token.decodeIdentifier();
extractTokenIdentifier(hive2Token);

if (tokenRenewalInterval == null) {
tokenRenewalInterval =
Expand Down Expand Up @@ -231,4 +233,18 @@ Optional<Long> getTokenRenewalDate(
throw new FlinkRuntimeException(e);
}
}

private HiveServer2DelegationTokenIdentifier extractTokenIdentifier(
Token<HiveServer2DelegationTokenIdentifier> token) throws IOException {

HiveServer2DelegationTokenIdentifier tokenIdentifier =
new HiveServer2DelegationTokenIdentifier();

try (DataInputStream in =
new DataInputStream(new ByteArrayInputStream(token.getIdentifier()))) {
tokenIdentifier.readFields(in);
}

return tokenIdentifier;
}
}

0 comments on commit 6e1b505

Please sign in to comment.