Skip to content

[PECOBLR-620] Fixed byteBufferToString function and added unit tests - #908

Merged
msrathore-db merged 4 commits into
mainfrom
PECOBLR-620
Jul 25, 2025
Merged

msrathore-db merged 4 commits into
mainfrom
PECOBLR-620

Conversation

@msrathore-db

@msrathore-db msrathore-db commented Jul 23, 2025 •

Copy link
Copy Markdown
Collaborator

Description

Fixed byteBufferToString function: The function assumed the byteBuffer size to be a Long and resulted in buggy output for size 16. This resulted in buggy value of sessionId and some logging statements.
Removed the extra logged statementId.

Testing

  • Tested locally

Related tickets:
PECOBLR-620

NO_CHANGELOG=true


throw new DatabricksSQLFeatureNotImplementedException(
"Not implemented in DatabricksConnection - createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)");
if (resultSetType != ResultSet.TYPE_FORWARD_ONLY

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this PR, create a new PR

@@ -56,8 +56,14 @@ public static TNamespace getNamespace(String catalog, String schema) {

public static String byteBufferToString(ByteBuffer buffer) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write tests that show the difference between the previous and new approach

@msrathore-db msrathore-db changed the title Fixed byteBufferToString function and unimplemented methods in DatabricksConnection Fixed byteBufferToString function and added unit tests Jul 25, 2025
ByteBuffer newBuffer = buffer.duplicate(); // This is to avoid a BufferUnderflowException
long sigBits = newBuffer.getLong();
return new UUID(sigBits, sigBits).toString();
if (newBuffer.remaining() >= 16) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use magic numbers

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1. add in DatabricksJdbcConstants

@shivam2680
shivam2680 self-requested a review July 25, 2025 07:28
ByteBuffer newBuffer = buffer.duplicate(); // This is to avoid a BufferUnderflowException
long sigBits = newBuffer.getLong();
return new UUID(sigBits, sigBits).toString();
if (newBuffer.remaining() >= 16) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comments for cases where buffer does have 16 bytes. For example, we saw in sessionId

@madhav-db madhav-db changed the title Fixed byteBufferToString function and added unit tests [PECOBLR-620] Fixed byteBufferToString function and added unit tests Jul 25, 2025
@madhav-db

Copy link
Copy Markdown
Contributor

Congratulations for your first PR! Thanks, and here's to many more! 🥂

LOGGER.debug(
"getOperationHandle {%s} for statementId {%s}",
statementId, byteBufferToString(identifier.guid));
LOGGER.debug("getOperationHandle for statementId {%s}", statementId);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to print just the statement id generated. Why are printing the whole object here?

@msrathore-db
msrathore-db merged commit dff82dd into main Jul 25, 2025
@msrathore-db
msrathore-db deleted the PECOBLR-620 branch July 25, 2025 09:31
eric-wang-1990 added a commit that referenced this pull request Jul 24, 2026
Align the JDBC integration-test sender with design #910: the sender no longer
picks a backend. Both dispatch paths (the single `integration-test` label
preview and the merge-queue required gate) send one payload —
{pr_number, commit_sha, pr_repo, pr_url, proxy_mode: 'replay'} — and driver-test's
receiver runs the full replay matrix (thrift + sea), reporting one aggregated
"JDBC Integration Tests" check.

- Drop the `integration-test-sea` label and the label→jdbc_mode resolution;
  one `integration-test` label now previews the full replay run.
- Remove jdbc_mode from both dispatch payloads.
- SEA is now part of the required merge-queue gate (was preview-only), since the
  receiver runs both backends.

Pairs with the receiver change (databricks-driver-test #908) that computes the
backend matrix and aggregates the check.

Co-authored-by: Isaac
Signed-off-by: Eric Wang <[email protected]>
eric-wang-1990 added a commit that referenced this pull request Jul 24, 2026
## Summary

Wires **databricks-jdbc** into the databricks-driver-test test platform
with two independent senders:

### 1. Coverage fan-out (`trigger-coverage-fanout.yml`)
On a merged PR to `main` that touched JDBC driver source (`src/main/`),
dispatch `coverage-fanout` to driver-test → opens a tracking issue +
runs the language-agnostic multi-language coverage fan-out (spec
authored from the PR diff, conformed across every driver).

### 2. Integration-test PR gate (`trigger-integration-tests.yml`) —
**replay only**
Per-PR gate matching the sql-go / adbc-csharp senders, but **replay-only
by design** — we never trigger a live E2E run from a PR (slow, flaky,
would block landing). On a label / merge-queue event, dispatch
`jdbc-pr-test` to driver-test with `proxy_mode=replay`: driver-test
builds the driver at **this PR's commit** and serves committed
recordings (no credentials, no warehouse), reporting a **"JDBC
Integration Tests"** check back.
- `integration-test` label → Thrift replay preview ·
`integration-test-sea` → SEA replay preview
- merge-queue → required Thrift-replay gate
- `remove-label-on-new-commit` re-review guard + green skip-stub on
ordinary PRs

## Dependencies (both admin/cross-repo)

1. **Receiver PR** databricks/databricks-driver-test#908 adds
`proxy_mode=replay` to `jdbc-integration-tests.yml`. **Must merge for
the integration-test gate to run replay** (without it the receiver
ignores proxy_mode).
2. **`INTEGRATION_TEST_APP_ID` / `INTEGRATION_TEST_PRIVATE_KEY`
secrets** must be added to `databricks-jdbc` (the same App the other
driver repos use) — required for BOTH senders' token mint. Until then
the dispatch steps fail and no dispatch is sent (workflows otherwise
inert).
3. The App must be installed on `databricks-jdbc` with `checks: write`
so driver-test can report the "JDBC Integration Tests" check back.

## Test Plan

- [x] Both workflows validate (YAML + job-guard review).
- [ ] After secrets + #908: a databricks-jdbc PR with `integration-test`
shows a "JDBC Integration Tests" check running in replay against the PR
commit; merge-queue runs the required Thrift-replay gate.
- [ ] A merged `src/main/` PR dispatches `coverage-fanout` + opens a
tracking issue in driver-test.

This pull request and its description were written by Isaac.

<!-- CI/workflow-only change; no user-facing driver behavior. -->
NO_CHANGELOG=true

---------

Signed-off-by: Eric Wang <[email protected]>
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.

4 participants