Skip to content

Commit

Permalink
Refactor getCachingKey in CachingHiveMetastore for simplicity
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaygeorge committed Feb 12, 2024
1 parent e1b1ccf commit 64d2230
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1096,8 +1096,19 @@ public String toString()

private <T> KeyAndContext<T> getCachingKey(MetastoreContext context, T key)
{
MetastoreContext metastoreContext = metastoreImpersonationEnabled ? new MetastoreContext(context.getUsername(), context.getQueryId(), context.getClientInfo(), context.getSource(), true, context.getMetastoreHeaders(), context.isUserDefinedTypeEncodingEnabled(), context.getColumnConverterProvider(), context.getWarningCollector()) : context;
return new KeyAndContext<>(metastoreContext, key);
if (metastoreImpersonationEnabled) {
context = new MetastoreContext(
context.getUsername(),
context.getQueryId(),
context.getClientInfo(),
context.getSource(),
true,
context.getMetastoreHeaders(),
context.isUserDefinedTypeEncodingEnabled(),
context.getColumnConverterProvider(),
context.getWarningCollector());
}
return new KeyAndContext<>(context, key);
}

private static CacheBuilder<Object, Object> newCacheBuilder(OptionalLong expiresAfterWriteMillis, OptionalLong refreshMillis, long maximumSize)
Expand Down

0 comments on commit 64d2230

Please sign in to comment.