Repository navigation
Conversation
| return new DBArrowStreamResult(manifest, data); | ||
| case JSON_ARRAY: | ||
| // This is only for testing and prototype | ||
| return new DBInlineJsonResult(manifest, data); |
There was a problem hiding this comment.
I think you will actually need it for small result?
There was a problem hiding this comment.
How will we identify queries with small results? IIUC, we won't do any parsing of query provided by the customer. Thus for all SQL execution, Arrow stream will be the default format.
I think for metadata queries (if we happen to use SQL queries for that), we can use inline-json.
|
|
||
| import java.sql.SQLException; | ||
|
|
||
| class DBArrowStreamResult implements IExecutionResult { |
There was a problem hiding this comment.
Can you spell out DB to Databricks? Or you can simplify it to ArrawStreamResult since its namespace is evident.
| ExecuteStatementRequest request = new ExecuteStatementRequest() | ||
| .setStatement(statement) | ||
| .setWarehouseId(warehouseId) | ||
| .setDisposition(Disposition.INLINE) |
There was a problem hiding this comment.
I wonder if at the end this will become part of configuration at connection level.
There was a problem hiding this comment.
That would depend on what controls we want to provide to our users. And if we want to support multiple formats in full fledged manner. I think for now we will use only Arrow stream for user provided queries.
| this.connectionContext = connectionContext; | ||
| // Handle more auth types | ||
| this.databricksConfig = new DatabricksConfig(); | ||
| databricksConfig.setHost(connectionContext.getHostUrl()); |
There was a problem hiding this comment.
I miss this pattern
this.databricksConfig = new DatabricksConfig()
.setHost(connectionContext.getHostUrl())
.setToken(connectionContext.getToken());
| * @param statementId statement which should be closed | ||
| * @return response for statement execution | ||
| */ | ||
| void closeStatement(String statementId); |
There was a problem hiding this comment.
- Why not both executeStatement and closeStatement live off "session" or you do not have session object or class?
- Which session will be used in closeStatement?
There was a problem hiding this comment.
Close statement request takes only the statement-Id. Since a statement is associated uniquely with a session, the underlying session would be used, which I believe would be handled on server side. ExecuteStatement creates the statement, so session-Id is required here, otherwise it would create a new one on backend side.
|
|
||
| private int currentRow; | ||
| private List<List<String>> data; | ||
| private ResultManifest resultManifest; |
There was a problem hiding this comment.
resultManifest and resultData are final/readonly?
| if (columnIndex < data.get(currentRow).size()) { | ||
| return data.get(currentRow).get(columnIndex); | ||
| } | ||
| throw new DatabricksSQLException("Column index out of bounds " + (columnIndex -1)); |
There was a problem hiding this comment.
Can you print the original value of columnIndex (do not tweak the value in the log or exception which can cause confusions).
|
|
||
| @Override | ||
| public synchronized int getCurrentRow() { | ||
| return currentRow + 1; |
There was a problem hiding this comment.
currentRowis initialized to zero which is current? Do you skip the first row by chance?
There was a problem hiding this comment.
No, I intended this to be JDBC index, which starts from 1. But I think it is better to use internal index for this class, which starts from 0, and have all those index translations in upper level class.
| */ | ||
| String columnTypeText(); | ||
|
|
||
| int typePrecision(); |
There was a problem hiding this comment.
Add method doc.
precision is the maximum number of significant digits that can be stored in a column. For string, it's 255.
| import com.databricks.jdbc.core.DatabricksResultSet; | ||
| import com.databricks.sdk.service.sql.*; | ||
|
|
||
| public class FakeDatabricksClient implements DatabricksClient { |
There was a problem hiding this comment.
Do you want to mock the client or mock SQL Exec API?
There was a problem hiding this comment.
I wanted to mock only StatementExecutionService, but there were some other nuances in WorkspaceClient, so I created a Fake client, which would directly call the statement execution service without going into Workspace client. I think for that, we can keep separate E2E tests, which will cover testing through all layers.
| * @return response for statement execution | ||
| */ | ||
| void closeStatement(String statementId); | ||
| } No newline at end of file |
| String getSessionId(); | ||
|
|
||
| void close(boolean removeFromSession) throws SQLException; | ||
| } No newline at end of file |
| public void closeStatement(String statementId) { | ||
| statementExecutionService.closeStatement(new CloseStatementRequest().setStatementId(statementId)); | ||
| } | ||
| } No newline at end of file |
- Add comment explaining directResultsReceived timing: the flag checked is from the PREVIOUS execution, reset happens below - Add comment explaining synchronous close latency tradeoff: consistent with pgJDBC's closeForNextExecution, correctness over latency - Expand catch comment to cover transport-level errors - Add testReExecutionHandlesTransportErrorGracefully: verifies re-execution succeeds even when closeStatement throws a RuntimeException (transport-level error like HTTP 500), not just DatabricksSQLException Note on integration test gap (databricks#3): the existing mock-based tests verify the close is called. Transport-level regression requires a real Thrift endpoint — tracked as a follow-up with the fake service infrastructure. Signed-off-by: Gopal Lal <[email protected]> Co-authored-by: Isaac Signed-off-by: Gopal Lal <[email protected]>
Major fixes: - #1: Use 2-thread pool instead of single-thread to prevent one blocked heartbeat RPC from starving others on the same connection - #3: Fix getStoppedFlag() leak — use get() + ALREADY_STOPPED sentinel instead of computeIfAbsent() which re-created a false flag after stopHeartbeat() removed it, causing RPCs after stop Minor fixes: - #2: Increase awaitTermination from 5s to 10s with explanatory comment - #4: Add comment about client capture retaining session reference - #5: Document reactive vs proactive heartbeat stop limitation - #6, #7, #9, #10, #11: Acknowledged as correct/acceptable per reviewer Co-authored-by: Isaac Signed-off-by: Gopal Lal <[email protected]>
Removes the OWASP step, NVD database cache, and OWASP findings parsing
from securityScan.yml. OSV-Scanner now drives the gate alone.
Motivation:
- OSV's database is a strict superset of NVD's (federates GHSA, NVD,
PyPA, RustSec, Go vuln DB). We've already seen two real CVEs OSV
catches that OWASP misses entirely -- CVE-2025-66566 in lz4 and
CVE-2026-5598 in bouncycastle, both GHSA-only with no NVD CPE.
- The release pipeline at databricks/secure-public-registry-releases-eng
already skips OWASP (every Maven step has -Ddependency-check.skip=true)
and runs its own artifact-level scan via databricks/gh-action-scan.
So removing OWASP from this repo's CI does not disturb release gating.
- OWASP's NVD database (~150-700 MB), the NVD_API_KEY secret, and the
cache machinery added minutes per run for coverage we don't actually
use any more.
The OWASP plugin block stays in jdbc-core/pom.xml and owasp-suppressions.xml
stays in the repo, because the disabled-anyway in-repo release.yml /
release-thin.yml workflows still reference them. Cleaning those up is a
separate change.
Also addresses these from the PR review:
#1 (SBOM existence guard): the OSV step now explicitly checks
target/bom.json exists before scanning, and that osv-scanner
produced a non-empty output. Build failures now surface with a
clear ::error:: instead of a downstream jq error.
#3 (set -uo pipefail without -e): added a comment explaining that -e
is dropped intentionally because osv-scanner exits 1 on any
finding regardless of severity; the severity >= 7 filter below is
the real gate.
#4 (severity filter silently treats malformed scores as 0): the
Collect findings step now logs total_findings alongside
high_count, so a mismatch (e.g. "10 total / 0 high") would be
visible in the step summary and warn ops about OSV format drift.
#5 (suppressions are CVE-id global, not package-scoped): OSV-Scanner
v2.3.8 does not actually support per-package CVE-id ignores
(verified against internal/config/config.go -- PackageOverrides
has no per-CVE field). Documented the trade-off explicitly in
osv-scanner.toml's header so future readers understand the
scoping model and the acceptable-risk reasoning.
#7 (fork PR maven config): added a comment in the workflow explaining
that fork PRs work even with JFrog OIDC skipped, because all of
the driver's direct dependencies are published to public Maven
Central. JFrog is just a mirror, not a source.
Verified locally: OSV reports the same 2 unsuppressed CVSS>=7 findings
(bouncycastle CVE-2026-5598 + libthrift cluster) as before, with no
schema errors against the corrected osv-scanner.toml.
Co-authored-by: Isaac
Signed-off-by: Vikrant Puppala <[email protected]>
Removes the OWASP step, NVD database cache, and OWASP findings parsing
from securityScan.yml. OSV-Scanner now drives the gate alone.
Motivation:
- OSV's database is a strict superset of NVD's (federates GHSA, NVD,
PyPA, RustSec, Go vuln DB). We've already seen two real CVEs OSV
catches that OWASP misses entirely -- CVE-2025-66566 in lz4 and
CVE-2026-5598 in bouncycastle, both GHSA-only with no NVD CPE.
- The release pipeline at databricks/secure-public-registry-releases-eng
already skips OWASP (every Maven step has -Ddependency-check.skip=true)
and runs its own artifact-level scan via databricks/gh-action-scan.
So removing OWASP from this repo's CI does not disturb release gating.
- OWASP's NVD database (~150-700 MB), the NVD_API_KEY secret, and the
cache machinery added minutes per run for coverage we don't actually
use any more.
The OWASP plugin block stays in jdbc-core/pom.xml and owasp-suppressions.xml
stays in the repo, because the disabled-anyway in-repo release.yml /
release-thin.yml workflows still reference them. Cleaning those up is a
separate change.
Also addresses these from the PR review:
#1 (SBOM existence guard): the OSV step now explicitly checks
target/bom.json exists before scanning, and that osv-scanner
produced a non-empty output. Build failures now surface with a
clear ::error:: instead of a downstream jq error.
#3 (set -uo pipefail without -e): added a comment explaining that -e
is dropped intentionally because osv-scanner exits 1 on any
finding regardless of severity; the severity >= 7 filter below is
the real gate.
#4 (severity filter silently treats malformed scores as 0): the
Collect findings step now logs total_findings alongside
high_count, so a mismatch (e.g. "10 total / 0 high") would be
visible in the step summary and warn ops about OSV format drift.
#5 (suppressions are CVE-id global, not package-scoped): OSV-Scanner
v2.3.8 does not actually support per-package CVE-id ignores
(verified against internal/config/config.go -- PackageOverrides
has no per-CVE field). Documented the trade-off explicitly in
osv-scanner.toml's header so future readers understand the
scoping model and the acceptable-risk reasoning.
#7 (fork PR maven config): added a comment in the workflow explaining
that fork PRs work even with JFrog OIDC skipped, because all of
the driver's direct dependencies are published to public Maven
Central. JFrog is just a mirror, not a source.
Verified locally: OSV reports the same 2 unsuppressed CVSS>=7 findings
(bouncycastle CVE-2026-5598 + libthrift cluster) as before, with no
schema errors against the corrected osv-scanner.toml.
Co-authored-by: Isaac
Signed-off-by: Vikrant Puppala <[email protected]>
No description provided.