Skip to content

Fix getColumns() flooding DriverManager log writer with stack traces#1494

Open
sreekanth-db wants to merge 1 commit into
mainfrom
fix/getcolumns-log-writer-flood
Open

Fix getColumns() flooding DriverManager log writer with stack traces#1494
sreekanth-db wants to merge 1 commit into
mainfrom
fix/getcolumns-log-writer-flood

Conversation

@sreekanth-db

Copy link
Copy Markdown
Collaborator

Summary

DatabaseMetaData.getColumns() floods the DriverManager log writer with caught-and-recovered Invalid column index stack traces on every call, even though the call succeeds (GitHub #1490).

Root cause: MetadataResultSetBuilder.getRows() probes JDBC columns that are not present in the underlying SHOW COLUMNS result by calling resultSet.getObject(name), which throws Invalid column index as a control-flow signal for the fallback path. The throw is silenced for telemetry, but its stack trace still reaches the DriverManager log writer.

Fix

Detect absent columns up front via DatabricksResultSetMetaData.getColumnNameIndex() and compute the default value directly, avoiding the throw. The original getObject() path — and a catch-block safety net — are preserved when metadata is unavailable (e.g. test mocks), so output is identical and behavior is unchanged for present columns.

Testing

  • Existing metadata tests pass.
  • A repro (exampleGetColumnsLogFlood) confirms the log writer receives zero Invalid column index lines after the fix.

Fixes #1490

This pull request and its description were written by Isaac.

getColumns() probed JDBC columns absent from the underlying SHOW COLUMNS
result by calling resultSet.getObject(name), which throws "Invalid column
index" as a control-flow signal for the fallback path. The throw was
silenced for telemetry, but its stack trace still reached the DriverManager
log writer, flooding it on every call (GitHub #1490).

Detect absent columns up front via DatabricksResultSetMetaData and compute
the default directly, avoiding the throw. The getObject() path (and a
catch-block safety net) is preserved when metadata is unavailable, so
behavior is unchanged.

Co-authored-by: Isaac
Signed-off-by: Sreekanth Vadigi <sreekanth.vadigi@databricks.com>
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.

Driver version 3.4.1 flods logs with internal exception on SHOW COLUMNS

1 participant