Skip to content

Remove ShardingKey methods incompatible with Java 8 - #1266

Merged
samikshya-db merged 16 commits into
databricks:jdk-8from
samikshya-db:jdk-8
Mar 11, 2026
Merged

samikshya-db merged 16 commits into
databricks:jdk-8from
samikshya-db:jdk-8

Conversation

@samikshya-db

@samikshya-db samikshya-db commented Mar 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Test plan

  • Github action run for JDK8

Additional notes

  • No unit tests in jdk-8 branch (tests will be added when merging with main branch)

SKIP_COVERAGE_CHECK=No unit tests in jdk-8 branch
NO_CHANGELOG=true

@samikshya-db
samikshya-db changed the base branch from main to jdk-8 March 10, 2026 05:27
@samikshya-db
samikshya-db requested a review from gopalldb March 10, 2026 18:44
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>
samikshya-db and others added 14 commits March 11, 2026 14:43
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>
@samikshya-db
samikshya-db merged commit 6424da2 into databricks:jdk-8 Mar 11, 2026
1 of 2 checks passed
@samikshya-db
samikshya-db deleted the jdk-8 branch March 11, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants