Repository navigation
Remove ShardingKey methods incompatible with Java 8 - #1266
Merged
Merged
Conversation
gopalldb
reviewed
Mar 11, 2026
java.sql.ShardingKey was introduced in Java 9 (JDBC 4.3) and does not exist in Java 8. Remove the four setShardingKey*/setShardingKeyIfValid* overrides from DatabricksConnection and corresponding test assertions to fix compilation under JDK 8. Signed-off-by: samikshya-chand_data <samikshya.chand@databricks.com>
…with Guava equivalents Map.of(), Set.of(), and List.of() were introduced in Java 9. Replace with ImmutableMap/ImmutableSet/ImmutableList from Guava or Arrays.asList/Collections.emptyList/emptyMap in both main and test sources. Signed-off-by: samikshya-chand_data <samikshya.chand@databricks.com>
Remove Java 9+ API usage to ensure JDK 8 compatibility: - Remove beginRequest/endRequest (JDBC 4.3, Java 9+) from DatabricksConnection - Remove supportsSharding (JDBC 4.3, Java 9+) from DatabricksDatabaseMetaData - Remove enquoteLiteral/enquoteIdentifier/enquoteNCharLiteral/isSimpleIdentifier (JDBC 4.3) from DatabricksStatement - Replace Optional.isEmpty() with !isPresent() in DBFSVolumeClient, VolumeOperationProcessor, DatabricksTokenFederationProvider - Replace CompletableFuture.delayedExecutor (Java 9+) with ScheduledExecutorService in DBFSVolumeClient and VolumeUploadCallback - Replace String.repeat() with StringBuilder loop in InsertStatementParser - Replace Stream.dropWhile() with for-loop in JulLogger - Replace ProcessHandle with ManagementFactory.getRuntimeMXBean() in ProcessNameUtil - Replace 3-arg Stream.iterate() with for-loop in DatabricksSdkClient - Replace Matcher.appendReplacement/appendTail(StringBuilder) with StringBuffer in SQLInterpolator - Replace URLDecoder.decode(String, Charset) with decode(String, String) in UserAgentManager - Replace ByteArrayOutputStream.toString(Charset) with toString(String) in DatabricksPreparedStatement - Replace Objects.requireNonNullElse with ternary in JsonChunkProvider - Replace List.of/Map.of/Set.of with Guava equivalents in test files and MetadataResultConstants Signed-off-by: Samikshya Chand <samikshya.chand@databricks.com> Signed-off-by: samikshya-chand_data <samikshya.chand@databricks.com>
Signed-off-by: samikshya-chand_data <samikshya.chand@databricks.com>
Signed-off-by: samikshya-chand_data <samikshya.chand@databricks.com>
…load on JDK 8) Signed-off-by: samikshya-chand_data <samikshya.chand@databricks.com>
Signed-off-by: samikshya-chand_data <samikshya.chand@databricks.com>
… Java 11+ WireMock) Signed-off-by: samikshya-chand_data <samikshya.chand@databricks.com>
…Mock) Signed-off-by: samikshya-chand_data <samikshya.chand@databricks.com>
….of, String.repeat) Signed-off-by: samikshya-chand_data <samikshya.chand@databricks.com>
…ional.isEmpty, Files.writeString, readAllBytes) Signed-off-by: samikshya-chand_data <samikshya.chand@databricks.com>
…LocalDate.EPOCH, InputStream.nullInputStream, record.setInstant, ProcessHandle, enquote methods) Signed-off-by: samikshya-chand_data <samikshya.chand@databricks.com>
…re fork) Signed-off-by: samikshya-chand_data <samikshya.chand@databricks.com>
Signed-off-by: samikshya-chand_data <samikshya.chand@databricks.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: samikshya-chand_data <samikshya.chand@databricks.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
java.sql.ShardingKeywas introduced in Java 9 (JDBC 4.3) and does not exist in Java 8. This PR fixes it.Test plan
Additional notes
SKIP_COVERAGE_CHECK=No unit tests in jdk-8 branch
NO_CHANGELOG=true