-
Notifications
You must be signed in to change notification settings - Fork 281
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
Yingjianw/JDK 17 Upgrade #620
base: master
Are you sure you want to change the base?
Changes from all commits
d670f8c
67457df
721ee81
e0454b6
65bd823
54486ed
be80222
b1bea50
9693b10
221d279
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ | |
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import com.google.common.base.Preconditions; | ||
//import com.google.common.base.Preconditions; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious what is the issue with Preconditions on java 17? https://guava.dev/releases/17.0/api/docs/index.html?com/google/common/base/Preconditions.html |
||
import com.google.common.collect.ImmutableList; | ||
import com.google.common.collect.Lists; | ||
import lombok.EqualsAndHashCode; | ||
|
@@ -69,9 +69,10 @@ public TypeSignature( | |
) { | ||
if (literalParameters != null) { | ||
for (final Object literal : literalParameters) { | ||
Preconditions.checkArgument( | ||
literal instanceof String || literal instanceof Long, | ||
"Unsupported literal type: %s", literal.getClass()); | ||
if (!(literal instanceof String || literal instanceof Long)) { | ||
throw new IllegalArgumentException( | ||
String.format("Unsupported literal type: %s", literal.getClass())); | ||
} | ||
} | ||
this.literalParameters = ImmutableList.copyOf(literalParameters); | ||
} else { | ||
|
@@ -119,17 +120,28 @@ public static TypeSignature parseTypeSignature(final String signature) { | |
final char c = signature.charAt(i); | ||
if (c == '<') { | ||
if (bracketCount == 0) { | ||
Preconditions.checkArgument(baseName == null, "Expected baseName to be null"); | ||
Preconditions.checkArgument(parameterStart == -1, "Expected parameter start to be -1"); | ||
if (baseName != null) { | ||
throw new IllegalArgumentException("Expected baseName to be null"); | ||
} | ||
|
||
if (parameterStart != -1) { | ||
throw new IllegalArgumentException("Expected parameter start to be -1"); | ||
} | ||
|
||
baseName = signature.substring(0, i); | ||
parameterStart = i + 1; | ||
} | ||
bracketCount++; | ||
} else if (c == '>') { | ||
bracketCount--; | ||
Preconditions.checkArgument(bracketCount >= 0, "Bad type signature: '%s'", signature); | ||
if (bracketCount < 0) { | ||
throw new IllegalArgumentException(String.format("Bad type signature: '%s'", signature)); | ||
} | ||
|
||
if (bracketCount == 0) { | ||
Preconditions.checkArgument(parameterStart >= 0, "Bad type signature: '%s'", signature); | ||
if (parameterStart < 0) { | ||
throw new IllegalArgumentException(String.format("Bad type signature: '%s'", signature)); | ||
} | ||
parameters.add(parseTypeSignature(signature.substring(parameterStart, i))); | ||
parameterStart = i + 1; | ||
if (i == signature.length() - 1) { | ||
|
@@ -138,31 +150,55 @@ public static TypeSignature parseTypeSignature(final String signature) { | |
} | ||
} else if (c == ',') { | ||
if (bracketCount == 1 && !inLiteralParameters) { | ||
Preconditions.checkArgument(parameterStart >= 0, "Bad type signature: '%s'", signature); | ||
if (parameterStart < 0) { | ||
throw new IllegalArgumentException(String.format("Bad type signature: '%s'", signature)); | ||
} | ||
|
||
parameters.add(parseTypeSignature(signature.substring(parameterStart, i))); | ||
parameterStart = i + 1; | ||
} else if (bracketCount == 0 && inLiteralParameters) { | ||
Preconditions.checkArgument(parameterStart >= 0, "Bad type signature: '%s'", signature); | ||
if (parameterStart < 0) { | ||
throw new IllegalArgumentException(String.format("Bad type signature: '%s'", signature)); | ||
} | ||
|
||
literalParameters.add(parseLiteral(signature.substring(parameterStart, i))); | ||
parameterStart = i + 1; | ||
} | ||
} else if (c == '(') { | ||
Preconditions.checkArgument(!inLiteralParameters, "Bad type signature: '%s'", signature); | ||
if (inLiteralParameters) { | ||
throw new IllegalArgumentException(String.format("Bad type signature: '%s'", signature)); | ||
} | ||
|
||
inLiteralParameters = true; | ||
if (bracketCount == 0) { | ||
if (baseName == null) { | ||
Preconditions.checkArgument(parameters.isEmpty(), "Expected no parameters"); | ||
Preconditions.checkArgument(parameterStart == -1, "Expected parameter start to be -1"); | ||
if (!parameters.isEmpty()) { | ||
throw new IllegalArgumentException("Expected no parameters"); | ||
} | ||
|
||
if (parameterStart != -1) { | ||
throw new IllegalArgumentException("Expected parameter start to be -1"); | ||
} | ||
|
||
baseName = signature.substring(0, i); | ||
} | ||
parameterStart = i + 1; | ||
} | ||
} else if (c == ')') { | ||
Preconditions.checkArgument(inLiteralParameters, "Bad type signature: '%s'", signature); | ||
if (!inLiteralParameters) { | ||
throw new IllegalArgumentException(String.format("Bad type signature: '%s'", signature)); | ||
} | ||
|
||
inLiteralParameters = false; | ||
if (bracketCount == 0) { | ||
Preconditions.checkArgument(i == signature.length() - 1, "Bad type signature: '%s'", signature); | ||
Preconditions.checkArgument(parameterStart >= 0, "Bad type signature: '%s'", signature); | ||
if (i != signature.length() - 1) { | ||
throw new IllegalArgumentException(String.format("Bad type signature: '%s'", signature)); | ||
} | ||
|
||
if (parameterStart < 0) { | ||
throw new IllegalArgumentException(String.format("Bad type signature: '%s'", signature)); | ||
} | ||
|
||
literalParameters.add(parseLiteral(signature.substring(parameterStart, i))); | ||
return new TypeSignature(baseName, parameters, literalParameters); | ||
} | ||
|
@@ -173,7 +209,9 @@ public static TypeSignature parseTypeSignature(final String signature) { | |
|
||
private static Object parseLiteral(final String literal) { | ||
if (literal.startsWith("'") || literal.endsWith("'")) { | ||
Preconditions.checkArgument(literal.startsWith("'") && literal.endsWith("'"), "Bad literal: '%s'", literal); | ||
if (!(literal.startsWith("'") && literal.endsWith("'"))) { | ||
throw new IllegalArgumentException(String.format("Bad literal: '%s'", literal)); | ||
} | ||
return literal.substring(1, literal.length() - 1); | ||
} else { | ||
return Long.parseLong(literal); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,7 @@ public class HiveConnectorFactory extends SpringConnectorFactory { | |
connectorContext.getConfiguration() | ||
.getOrDefault(HiveConfigConstants.USE_EMBEDDED_METASTORE, "false") | ||
); | ||
final boolean useFastHiveService = useLocalMetastore && Boolean.parseBoolean( | ||
final boolean useFastHiveService = Boolean.parseBoolean( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need this anymore? I feel we should remove the embedded HMS entirely given it won't work anymore on SBN3. |
||
connectorContext.getConfiguration() | ||
.getOrDefault(HiveConfigConstants.USE_FASTHIVE_SERVICE, "false") | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want javax.annotation.Nullable (jakarta when we move to SBN3)